diff options
author | Marcel Hollerbach <marcel@osg.samsung.com> | 2017-10-27 12:02:31 +0200 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-10-30 15:52:44 +0900 |
commit | 847cc06ff4e29ac75d75f5959528a6806336735a (patch) | |
tree | a2ad4f2f3f4d53ecb30bffe0e0a6d9b885ddb58f | |
parent | 6deafedcf5e71300b340ccd94b31062beb28d72e (diff) | |
download | efl-847cc06ff4e29ac75d75f5959528a6806336735a.tar.gz |
elm_mutlibuttonentry: fix legacy events
This should fix the test cases
-rw-r--r-- | src/lib/elementary/efl_ui_multibuttonentry.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c index 81e2b391ca..18129b0d5b 100644 --- a/src/lib/elementary/efl_ui_multibuttonentry.c +++ b/src/lib/elementary/efl_ui_multibuttonentry.c @@ -1715,6 +1715,43 @@ elm_multibuttonentry_add(Evas_Object *parent) return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); } +static void +_legacy_focused(void *data, const Efl_Event *ev) +{ + Efl_Ui_Focus_Object *new_focus; + Eina_Bool meaningfull_focus_in = EINA_FALSE, meaningfull_focus_out = EINA_FALSE; + EFL_UI_MULTIBUTTONENTRY_DATA_GET(data, pd); + + new_focus = efl_ui_focus_manager_focus_get(ev->object); + + if (efl_isa(ev->info, ELM_WIDGET_CLASS) && elm_widget_parent_get(ev->info) == pd->box) + { + meaningfull_focus_out = EINA_TRUE; + } + + if (efl_isa(new_focus, ELM_WIDGET_CLASS) && elm_widget_parent_get(new_focus) == pd->box) + { + meaningfull_focus_in = EINA_TRUE; + } + + if (meaningfull_focus_in && !meaningfull_focus_out) + { + efl_event_callback_legacy_call(data, EFL_UI_WIDGET_EVENT_FOCUSED, NULL); + } + + if (!meaningfull_focus_in && meaningfull_focus_out) + { + efl_event_callback_legacy_call(data, EFL_UI_WIDGET_EVENT_UNFOCUSED, NULL); + } +} + +static void +_legacy_manager_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev) +{ + efl_event_callback_del(ev->info, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _legacy_focused, ev->object); + efl_event_callback_add(efl_ui_focus_user_manager_get(ev->object), EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _legacy_focused, ev->object); +} + EOLIAN static Eo * _efl_ui_multibuttonentry_efl_object_constructor(Eo *obj, Efl_Ui_Multibuttonentry_Data *sd EINA_UNUSED) { @@ -1723,6 +1760,9 @@ _efl_ui_multibuttonentry_efl_object_constructor(Eo *obj, Efl_Ui_Multibuttonentry evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_role_set(obj, EFL_ACCESS_ROLE_PANEL); + //listen to manager changes here + efl_event_callback_add(obj, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _legacy_manager_changed_cb, NULL); + return obj; } |