bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=75f5ea686fb6475cdbb9d8106c696c4d52fefe69
commit 75f5ea686fb6475cdbb9d8106c696c4d52fefe69 Author: Marcel Hollerbach <[email protected]> Date: Thu Oct 12 21:25:49 2017 +0200 efl_ui_focus: add parent_provider thats just a little helper, where the logic to find and fetch the provider is bound to the position in the widget tree, this means that for example gengrid could change the way the logical parent is evalulated. (For example to map the logical parent to a item) --- src/Makefile_Elementary.am | 6 +++++- src/lib/elementary/efl_ui_focus_parent_provider.c | 8 ++++++++ src/lib/elementary/efl_ui_focus_parent_provider.eo | 11 +++++++++++ .../efl_ui_focus_parent_provider_standard.c | 19 +++++++++++++++++++ .../efl_ui_focus_parent_provider_standard.eo | 5 +++++ src/lib/elementary/efl_ui_win.c | 6 ++++++ src/lib/elementary/elm_priv.h | 2 ++ src/lib/elementary/elm_widget.c | 6 +++++- src/lib/elementary/elm_widget.h | 2 +- 9 files changed, 62 insertions(+), 3 deletions(-) diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 039f50b455..11ad8c3e98 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -155,6 +155,8 @@ elm_private_eolian_files = \ tests/elementary/focus_test_sub_main.eo \ lib/elementary/efl_ui_focus_rectangle.eo \ lib/elementary/elm_calendar_item.eo \ + lib/elementary/efl_ui_focus_parent_provider.eo \ + lib/elementary/efl_ui_focus_parent_provider_standard.eo \ $(NULL) # Legacy classes - not part of public EO API @@ -707,7 +709,9 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/efl_ui_focus_manager_root_focus.c \ lib/elementary/efl_ui_textpath.c \ lib/elementary/efl_ui_focus_layer.c \ - lib/elementary/efl_ui_focus_composition.c \ + lib/elementary/efl_ui_focus_composition.c \ + lib/elementary/efl_ui_focus_parent_provider.c \ + lib/elementary/efl_ui_focus_parent_provider_standard.c \ $(NULL) diff --git a/src/lib/elementary/efl_ui_focus_parent_provider.c b/src/lib/elementary/efl_ui_focus_parent_provider.c new file mode 100644 index 0000000000..97de15a451 --- /dev/null +++ b/src/lib/elementary/efl_ui_focus_parent_provider.c @@ -0,0 +1,8 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Elementary.h> +#include "elm_priv.h" + +#include "efl_ui_focus_parent_provider.eo.c" diff --git a/src/lib/elementary/efl_ui_focus_parent_provider.eo b/src/lib/elementary/efl_ui_focus_parent_provider.eo new file mode 100644 index 0000000000..13d4638cf2 --- /dev/null +++ b/src/lib/elementary/efl_ui_focus_parent_provider.eo @@ -0,0 +1,11 @@ +interface Efl.Ui.Focus.Parent_Provider { + methods { + find_logical_parent { + [[Called to get the logical parent of widget]] + params { + widget : Efl.Ui.Focus.Object; + } + return : Efl.Ui.Focus.Object; + } + } +} diff --git a/src/lib/elementary/efl_ui_focus_parent_provider_standard.c b/src/lib/elementary/efl_ui_focus_parent_provider_standard.c new file mode 100644 index 0000000000..821d812463 --- /dev/null +++ b/src/lib/elementary/efl_ui_focus_parent_provider_standard.c @@ -0,0 +1,19 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Elementary.h> +#include "elm_priv.h" + +typedef struct { + +} Efl_Ui_Focus_Parent_Provider_Standard_Data; + +EOLIAN static Efl_Ui_Focus_Object* +_efl_ui_focus_parent_provider_standard_efl_ui_focus_parent_provider_find_logical_parent(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Parent_Provider_Standard_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *widget) +{ + return elm_object_parent_widget_get(widget); +} + + +#include "efl_ui_focus_parent_provider_standard.eo.c" diff --git a/src/lib/elementary/efl_ui_focus_parent_provider_standard.eo b/src/lib/elementary/efl_ui_focus_parent_provider_standard.eo new file mode 100644 index 0000000000..9daa4aef98 --- /dev/null +++ b/src/lib/elementary/efl_ui_focus_parent_provider_standard.eo @@ -0,0 +1,5 @@ +class Efl.Ui.Focus.Parent_Provider.Standard(Efl.Object, Efl.Ui.Focus.Parent_Provider) { + implements { + Efl.Ui.Focus.Parent_Provider.find_logical_parent; + } +} diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index bc66ecedf0..af94426b3f 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -176,6 +176,7 @@ struct _Efl_Ui_Win_Data Evas_Object *main_menu; Efl_Ui_Focus_Manager *manager; + Efl_Ui_Focus_Parent_Provider_Standard *provider; struct { @@ -5361,6 +5362,7 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd) pd->obj = obj; pd->manager = elm_obj_widget_focus_manager_create(obj, obj); + pd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_STANDARD_CLASS, obj); pd->profile.available = eina_array_new(4); efl_composite_attach(obj, pd->manager); @@ -6756,6 +6758,10 @@ _efl_ui_win_efl_object_provider_find(Eo *obj, Efl_Ui_Win_Data *pd EINA_UNUSED, { if (klass == EFL_UI_WIN_CLASS) return obj; + + if (klass == EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE) + return pd->provider; + return efl_provider_find(efl_super(obj, MY_CLASS), klass); } diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 8d905ca913..03051baa3f 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -53,6 +53,8 @@ #include "elm_widget.h" #include "elm_access.eo.h" #include "elm_code_private.h" +#include "efl_ui_focus_parent_provider.eo.h" +#include "efl_ui_focus_parent_provider_standard.eo.h" #ifdef HAVE_LANGINFO_H # include <langinfo.h> diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 5d5dc62863..880e291dc3 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -453,7 +453,10 @@ static Efl_Ui_Focus_Object* _logical_parent_eval(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd) { Elm_Widget *parent; - parent = pd->parent_obj; + Efl_Ui_Focus_Parent_Provider *provider; + + parent = efl_ui_focus_parent_provider_find_logical_parent(pd->provider, obj); + if (pd->logical.parent != parent) { Efl_Ui_Focus_Object *old = NULL; @@ -5081,6 +5084,7 @@ _elm_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSE evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); parent = efl_parent_get(obj); elm_obj_widget_parent_set(obj, parent); + sd->provider = efl_provider_find(obj, EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE); sd->on_create = EINA_FALSE; elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_UNKNOWN); diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 0f0caca7b1..4f2f0df6a6 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -416,7 +416,7 @@ typedef struct _Elm_Widget_Smart_Data Eina_Inlist *translate_strings; Eina_List *focus_chain; Eina_List *event_cb; - + Eo *provider; /* this is a hook to be set on-the-fly on widgets. this is code * handling the request of showing a specific region from an inner * widget (mainly issued by entries, on cursor moving) */ --
