summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-10-24 17:27:53 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-10-24 17:37:31 +0200
commita417af04e86e3974476471867d90637017138403 (patch)
tree13116e8947d91f6daec82926c7466f8b72b0cc73
parent3e726c364bcdf23437b4d30ed5b177a0e45aca7f (diff)
elm_widget: also delay focus set if something is not registered
this fixes a infinite loop
-rw-r--r--src/lib/elementary/elm_main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c
index 1ce7d28476..81cbce4eeb 100644
--- a/src/lib/elementary/elm_main.c
+++ b/src/lib/elementary/elm_main.c
@@ -1663,9 +1663,9 @@ elm_object_focus_get(const Evas_Object *obj)
1663static void _elm_widget_focus(Evas_Object *obj); 1663static void _elm_widget_focus(Evas_Object *obj);
1664 1664
1665static void 1665static void
1666_manager_changed(void *data EINA_UNUSED, const Efl_Event *event) 1666_manager_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
1667{ 1667{
1668 _elm_widget_focus(event->object); 1668 _elm_widget_focus(data);
1669} 1669}
1670 1670
1671static void 1671static void
@@ -1678,13 +1678,13 @@ _elm_widget_focus(Evas_Object *obj)
1678 m2 = efl_ui_focus_user_manager_get(obj); 1678 m2 = efl_ui_focus_user_manager_get(obj);
1679 1679
1680 o = efl_key_data_get(m, "__delayed_focus_set"); 1680 o = efl_key_data_get(m, "__delayed_focus_set");
1681 efl_event_callback_del(o, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, NULL); 1681 efl_event_callback_del(o, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, obj);
1682 efl_key_data_set(m, "__delayed_focus_set", NULL); 1682 efl_key_data_set(m, "__delayed_focus_set", NULL);
1683 1683
1684 if (!m2) 1684 if (!m2)
1685 { 1685 {
1686 efl_key_data_set(m, "__delayed_focus_set", obj); 1686 efl_key_data_set(m, "__delayed_focus_set", obj);
1687 efl_event_callback_add(obj, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, NULL); 1687 efl_event_callback_add(obj, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, obj);
1688 return; 1688 return;
1689 } 1689 }
1690 1690
@@ -1693,6 +1693,14 @@ _elm_widget_focus(Evas_Object *obj)
1693 { 1693 {
1694 Efl_Ui_Focus_Manager *new_manager;; 1694 Efl_Ui_Focus_Manager *new_manager;;
1695 new_manager = efl_ui_focus_user_manager_get(m2); 1695 new_manager = efl_ui_focus_user_manager_get(m2);
1696
1697 /* also delay the registeration if we miss a manager half way */
1698 if (!new_manager)
1699 {
1700 efl_event_callback_add(m2, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, obj);
1701 return;
1702 }
1703
1696 //new manager is in a higher hirarchy than m2 1704 //new manager is in a higher hirarchy than m2
1697 //so we set m2 as redirect in new_manager 1705 //so we set m2 as redirect in new_manager
1698 efl_ui_focus_manager_redirect_set(new_manager, m2); 1706 efl_ui_focus_manager_redirect_set(new_manager, m2);