summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-06 10:52:32 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-08-06 10:52:32 -0400
commit912dfe270ea57721ee0e091c3a30ee9e5d53a6dc (patch)
tree5f674ad18576d33d090511a89d99e2e4a8620392
parent63d3af3ce938c1efc8b44075075f2caa55a63a49 (diff)
efl_ui_focus_manager_root_focus: perform focus switch delayed
Summary: Delaying the unregistering here ensures that there is not focus set call while a object is beeing registered in the focus manager. ref T8081 Reviewers: zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8081 Differential Revision: https://phab.enlightenment.org/D9513
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_root_focus.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_root_focus.c b/src/lib/elementary/efl_ui_focus_manager_root_focus.c
index f47fe3d3fe..29507001fb 100644
--- a/src/lib/elementary/efl_ui_focus_manager_root_focus.c
+++ b/src/lib/elementary/efl_ui_focus_manager_root_focus.c
@@ -19,8 +19,22 @@ typedef struct {
19 Eina_Bool rect_registered; 19 Eina_Bool rect_registered;
20 20
21 Eina_List *iterator_list; 21 Eina_List *iterator_list;
22 Eina_Future *focus_transfer;
22} Efl_Ui_Focus_Manager_Root_Focus_Data; 23} Efl_Ui_Focus_Manager_Root_Focus_Data;
23 24
25static Eina_Value
26_unregister_rect(Eo *obj, void *data EINA_UNUSED, const Eina_Value v EINA_UNUSED)
27{
28 Efl_Ui_Focus_Manager_Root_Focus_Data *pd = efl_data_scope_get(obj, MY_CLASS);
29
30 efl_ui_focus_manager_calc_unregister(obj, pd->rect);
31 pd->rect_registered = EINA_FALSE;
32 efl_ui_focus_composition_adapter_focus_manager_parent_set(pd->rect, NULL);
33 efl_ui_focus_composition_adapter_focus_manager_object_set(pd->rect, NULL);
34 pd->focus_transfer = NULL;
35 return EINA_VALUE_EMPTY;
36}
37
24static Efl_Ui_Focus_Object* 38static Efl_Ui_Focus_Object*
25_trap(Efl_Ui_Focus_Manager_Root_Focus_Data *pd, Efl_Ui_Focus_Object *obj) 39_trap(Efl_Ui_Focus_Manager_Root_Focus_Data *pd, Efl_Ui_Focus_Object *obj)
26{ 40{
@@ -46,15 +60,17 @@ _state_eval(Eo *obj, Efl_Ui_Focus_Manager_Root_Focus_Data *pd)
46 60
47 if (sub && pd->rect_registered) 61 if (sub && pd->rect_registered)
48 { 62 {
49 efl_ui_focus_manager_calc_unregister(obj, pd->rect); 63 pd->focus_transfer = efl_loop_job(efl_main_loop_get());
50 pd->rect_registered = EINA_FALSE; 64 efl_future_then(obj, pd->focus_transfer, _unregister_rect);
51 efl_ui_focus_composition_adapter_focus_manager_parent_set(pd->rect, NULL);
52 efl_ui_focus_composition_adapter_focus_manager_object_set(pd->rect, NULL);
53 } 65 }
54 else if (!sub && !pd->rect_registered) 66 else if (!sub && !pd->rect_registered)
55 { 67 {
56 Efl_Ui_Focus_Object *root; 68 Efl_Ui_Focus_Object *root;
57 69
70 if (pd->focus_transfer)
71 eina_future_cancel(pd->focus_transfer);
72 pd->focus_transfer = NULL;
73
58 root = efl_ui_focus_manager_root_get(obj); 74 root = efl_ui_focus_manager_root_get(obj);
59 efl_ui_focus_manager_calc_register(obj, pd->rect, root, NULL); 75 efl_ui_focus_manager_calc_register(obj, pd->rect, root, NULL);
60 efl_ui_focus_composition_adapter_focus_manager_parent_set(pd->rect, root); 76 efl_ui_focus_composition_adapter_focus_manager_parent_set(pd->rect, root);