summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-04-07 23:59:47 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-04-09 18:05:27 +0200
commit33921385f9eb2f9062d9a28c030d1e0ff418658c (patch)
treeb084abde103023c523cf960d6c1a0ccd55cd9e14
parent59828721d80ecad0689cc469018318877e158c38 (diff)
efl_ui_focus_util: support later managers not beeing registered
this should fix some corner cases when setting focus by hand
-rw-r--r--src/lib/elementary/efl_ui_focus_util.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/lib/elementary/efl_ui_focus_util.c b/src/lib/elementary/efl_ui_focus_util.c
index 8758047eda..a8549e4da0 100644
--- a/src/lib/elementary/efl_ui_focus_util.c
+++ b/src/lib/elementary/efl_ui_focus_util.c
@@ -18,9 +18,9 @@ _manager_changed(void *data, const Efl_Event *event EINA_UNUSED)
18EOLIAN static void 18EOLIAN static void
19_efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus_Object *user) 19_efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus_Object *user)
20{ 20{
21 Efl_Ui_Focus_Object *entry;
21 Efl_Ui_Widget *top, *o; 22 Efl_Ui_Widget *top, *o;
22 Efl_Ui_Focus_Manager *m; 23 Efl_Ui_Focus_Manager *m, *registered_manager;
23 m = efl_ui_focus_object_focus_manager_get(user);
24 24
25 top = elm_widget_top_get(user); 25 top = elm_widget_top_get(user);
26 26
@@ -28,15 +28,29 @@ _efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus
28 if (o) efl_event_callback_del(o, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, o); 28 if (o) efl_event_callback_del(o, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, o);
29 efl_key_data_set(top, "__delayed_focus_set", NULL); 29 efl_key_data_set(top, "__delayed_focus_set", NULL);
30 30
31 if (!m) 31 registered_manager = m = efl_ui_focus_object_focus_manager_get(user);
32 { 32 entry = user;
33 //delayed focusung 33
34 efl_key_data_set(top, "__delayed_focus_set", user); 34 do {
35 efl_event_callback_add(user, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, user); 35 //check if the root of a manager is the window root, set focus to this object in the manager than
36 return; 36 entry = efl_ui_focus_manager_root_get(m);
37 } 37 if (efl_isa(m, EFL_UI_WIN_CLASS))
38 38 {
39 efl_ui_focus_manager_focus_set(m, user); 39 //we are at the root of the window, we can set the focus to the object
40 efl_ui_focus_manager_focus_set(registered_manager, user);
41 return;
42 }
43
44 //if there is no manager yet, delay the focus setting until this entity gets registered for one chain
45 m = efl_ui_focus_object_focus_manager_get(entry);
46 if (!m)
47 {
48 //delayed focusung
49 efl_key_data_set(top, "__delayed_focus_set", entry);
50 efl_event_callback_add(entry, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, user);
51 return;
52 }
53 } while (m);
40} 54}
41 55
42#include "efl_ui_focus_util.eo.c" 56#include "efl_ui_focus_util.eo.c"