aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-09-24 11:02:09 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-11-13 17:01:37 +0100
commitc972347c1c513618ce62900be7a205763c107d91 (patch)
treebaf0d36c06884d937165de272cf9a57e01f49a79
parentelm: add unfocus / focus signals to gen* and toolbar (diff)
downloadefl-c972347c1c513618ce62900be7a205763c107d91.tar.gz
efl_ui_focus: add flag to indicate if a child has the focus
this is usefull for later implementations in spinner and fileselector. A event for this was not added because the result is only really usefull after a focus operation has been successfull. Differential Revision: https://phab.enlightenment.org/D7102
-rw-r--r--src/lib/elementary/efl_ui_focus_object.c17
-rw-r--r--src/lib/elementary/efl_ui_focus_object.eo6
2 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_focus_object.c b/src/lib/elementary/efl_ui_focus_object.c
index 946d605ccf..89e7af2a5d 100644
--- a/src/lib/elementary/efl_ui_focus_object.c
+++ b/src/lib/elementary/efl_ui_focus_object.c
@@ -10,6 +10,7 @@
typedef struct {
Eina_Bool old_focus;
Eina_Bool ongoing_prepare_call;
+ Eina_Bool child_focus;
} Efl_Ui_Focus_Object_Data;
EOLIAN static void
@@ -18,6 +19,7 @@ _efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd, Eina_Bool
if (pd->old_focus == focus) return;
pd->old_focus = focus;
+ efl_ui_focus_object_child_focus_set(efl_ui_focus_object_focus_parent_get(obj), focus);
efl_event_callback_call(obj, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , (void*) (uintptr_t) focus);
}
@@ -39,6 +41,21 @@ _efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Object_Data *pd)
pd->ongoing_prepare_call = EINA_FALSE;
}
+EOLIAN static void
+_efl_ui_focus_object_child_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd, Eina_Bool child_focus)
+{
+ if (child_focus == pd->child_focus) return;
+
+ pd->child_focus = child_focus;
+ efl_ui_focus_object_child_focus_set(efl_ui_focus_object_focus_parent_get(obj), pd->child_focus);
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_focus_object_child_focus_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Object_Data *pd)
+{
+ return pd->child_focus;
+}
+
#include "efl_ui_focus_object.eo.c"
diff --git a/src/lib/elementary/efl_ui_focus_object.eo b/src/lib/elementary/efl_ui_focus_object.eo
index 77be807ff7..dd22339965 100644
--- a/src/lib/elementary/efl_ui_focus_object.eo
+++ b/src/lib/elementary/efl_ui_focus_object.eo
@@ -54,6 +54,12 @@ mixin Efl.Ui.Focus.Object
logical_parent : Efl.Ui.Focus.Object; [[The focus parent.]]
}
}
+ @property child_focus @protected {
+ [[set if a child of this element has focus or not.]]
+ values {
+ child_focus : bool;
+ }
+ }
prepare_logical {
[[Tells the object that its children will be queried soon by the given manager.
The call will be a NOP if there is already a active preprare_logical call on this object