From fb6c37f16f56efd9a73ace329bc09b6f07089f00 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 23 Dec 2016 13:48:46 +0100 Subject: [PATCH] elementary: introduce helper functions for the redirects --- src/lib/elementary/efl_ui_focus_manager_sub.c | 6 ++---- src/lib/elementary/efl_ui_focus_manager_sub.eo | 2 +- src/lib/elementary/efl_ui_win.c | 3 +-- src/lib/elementary/elm_interface_scrollable.c | 4 ---- src/lib/elementary/elm_main.c | 18 ++++++++++++++++++ src/lib/elementary/elm_menu.c | 1 + src/lib/elementary/elm_priv.h | 3 +++ 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_manager_sub.c b/src/lib/elementary/efl_ui_focus_manager_sub.c index 8527b1f..a1c0b21 100644 --- a/src/lib/elementary/efl_ui_focus_manager_sub.c +++ b/src/lib/elementary/efl_ui_focus_manager_sub.c @@ -215,15 +215,13 @@ _efl_ui_focus_manager_sub_efl_object_parent_set(Eo *obj, Efl_Ui_Focus_Manager_Su old_parent = efl_parent_get(obj); - efl_event_callback_forwarder_del(obj, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH, old_parent); - efl_event_callback_forwarder_del(obj, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, old_parent); + _efl_ui_focus_manager_redirect_events_del(obj, old_parent); efl_event_callback_array_del(old_parent, self_manager(), obj); efl_parent_set(efl_super(obj, MY_CLASS), parent); new_parent = efl_parent_get(obj); - efl_event_callback_forwarder_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH, new_parent); - efl_event_callback_forwarder_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, new_parent); + _efl_ui_focus_manager_redirect_events_add(obj, new_parent); efl_event_callback_array_add(new_parent, self_manager(), obj); } diff --git a/src/lib/elementary/efl_ui_focus_manager_sub.eo b/src/lib/elementary/efl_ui_focus_manager_sub.eo index 6fb78ef..73af27a 100644 --- a/src/lib/elementary/efl_ui_focus_manager_sub.eo +++ b/src/lib/elementary/efl_ui_focus_manager_sub.eo @@ -10,7 +10,7 @@ class Efl.Ui.Focus.Manager.Sub (Efl.Ui.Focus.Manager, Efl.Object) This class is only working as composite object to a Efl.Ui.Focus.User and Efl.Ui.Focus.Object. - The object itself does redirect the managers settings to the object where this object is attached + The object itself does redirect the managers events to the object where this object is attached ]] methods { } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 8dfe158..eff2fd2 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5249,8 +5249,7 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd) efl_composite_attach(obj, pd->manager); - efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH, obj); - efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj); + _efl_ui_focus_manager_redirect_events_add(pd->manager, obj); return obj; } diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index e92d7df..4c1e4a7 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -4662,10 +4662,6 @@ _elm_interface_scrollable_efl_object_constructor(Eo *obj, Elm_Scrollable_Smart_I efl_composite_attach(obj, pd->manager); - efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj); - efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH , obj); - efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY , obj); - efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, obj); efl_event_callback_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _focused_element, obj); return efl_constructor(efl_super(obj, MY_SCROLLABLE_INTERFACE)); diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index ef22141..bb1938a 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -31,6 +31,24 @@ static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; +void +_efl_ui_focus_manager_redirect_events_del(Efl_Ui_Focus_Manager *manager, Eo *obj) +{ + efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH, obj); + efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj); + efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED , obj); + efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, obj); +} + +void +_efl_ui_focus_manager_redirect_events_add(Efl_Ui_Focus_Manager *manager, Eo *obj) +{ + efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH, obj); + efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj); + efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED , obj); + efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, obj); +} + Eina_Bool _elm_dangerous_call_check(const char *call) { diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c index 7a4b8e3..9a4824d 100644 --- a/src/lib/elementary/elm_menu.c +++ b/src/lib/elementary/elm_menu.c @@ -814,6 +814,7 @@ _elm_menu_efl_object_constructor(Eo *obj, Elm_Menu_Data *sd) ); efl_composite_attach(obj, manager); + _efl_ui_focus_manager_redirect_events_add(manager, obj); } obj = efl_constructor(efl_super(obj, MY_CLASS)); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 903aa34..8abe670 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -540,6 +540,9 @@ void _elm_menu_menu_bar_hide(Eo *obj); void _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor); #endif +void _efl_ui_focus_manager_redirect_events_del(Efl_Ui_Focus_Manager *manager, Eo *obj); +void _efl_ui_focus_manager_redirect_events_add(Efl_Ui_Focus_Manager *manager, Eo *obj); + /* DEPRECATED, will be removed on next release */ void _elm_icon_signal_emit(Evas_Object *obj, const char *emission, -- 2.7.4