From e3049e4a16c86631507b2572e5e52aa8b3ddb721 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Sat, 21 Apr 2018 18:54:50 +0200 Subject: [PATCH] efl_ui_widget: do not register if the child is missing in a custom chain --- src/lib/elementary/efl_ui_widget.c | 41 +++++++++++++++++++++++++----- src/lib/elementary/elm_priv.h | 1 + src/lib/elementary/elm_widget.h | 1 + 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index f3f1df3d9c..49124aa6dc 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -344,6 +344,32 @@ _tree_unfocusable(Eo *obj) return EINA_FALSE; } +static Eina_Bool +_tree_custom_chain_missing(Eo *obj) +{ + Efl_Ui_Widget *wid = obj; + + while (elm_widget_parent_get(wid)) + { + Efl_Ui_Widget *parent = elm_widget_parent_get(wid); + ELM_WIDGET_DATA_GET(parent, parent_pd); + Eina_List *lst = parent_pd->legacy_focus.custom_chain; + + if (lst) + { + if (!eina_list_data_find(lst, wid)) + { + WRN("Widget %p disabled due to custom chain of %p", wid, parent); + return EINA_TRUE; + } + } + + wid = parent; + } + + return EINA_FALSE; +} + static Eina_Bool _tree_disabled(Eo *obj) { @@ -467,6 +493,7 @@ _eval_registration_candidate(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool *shou (!pd->parent_obj) || (_tree_unfocusable(obj)) || (_tree_disabled(obj)) || + (_tree_custom_chain_missing(obj)) || (!evas_object_visible_get(obj))) return; @@ -896,8 +923,8 @@ _efl_ui_widget_efl_gfx_entity_size_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Dat efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz); } -static void -_full_eval_children(Eo *obj, Elm_Widget_Smart_Data *sd) +void +_elm_widget_full_eval_children(Eo *obj, Elm_Widget_Smart_Data *sd) { Eina_List *l; Eo *child; @@ -911,7 +938,7 @@ _full_eval_children(Eo *obj, Elm_Widget_Smart_Data *sd) if (!efl_isa(child, EFL_UI_WIDGET_CLASS)) continue; sd_child = efl_data_scope_get(child, EFL_UI_WIDGET_CLASS); - _full_eval_children(child, sd_child); + _elm_widget_full_eval_children(child, sd_child); } } @@ -923,13 +950,13 @@ _efl_ui_widget_efl_gfx_entity_visible_set(Eo *obj, Elm_Widget_Smart_Data *pd, Ei if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis)) { - _full_eval_children(obj, pd); + _elm_widget_full_eval_children(obj, pd); return; } efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis); - _full_eval_children(obj, pd); + _elm_widget_full_eval_children(obj, pd); it = evas_object_smart_iterator_new(obj); @@ -1831,7 +1858,7 @@ elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable) _elm_widget_focus_tree_unfocusable_handle(obj); //focus state eval on all children - _full_eval_children(obj, sd); + _elm_widget_full_eval_children(obj, sd); } /** @@ -2506,7 +2533,7 @@ _efl_ui_widget_disabled_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool disabl elm_widget_disabled_internal(obj, disabled); if (efl_finalized_get(obj)) - _full_eval_children(obj, sd); + _elm_widget_full_eval_children(obj, sd); } EOLIAN static Eina_Bool diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index eaa260138c..8505f2ed85 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -731,6 +731,7 @@ void *_elm_icon_signal_callback_del(Evas_Object *obj, /* DO NOT USE THIS this is only for performance optimization! */ void _elm_widget_full_eval(Eo *obj); +void _elm_widget_full_eval_children(Eo *obj, Elm_Widget_Smart_Data *pd); EOAPI void efl_page_transition_page_size_set(Eo *obj, Eina_Size2D sz); EOAPI void efl_page_transition_padding_size_set(Eo *obj, int padding); diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 19d86fa2b4..a355993cfe 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -438,6 +438,7 @@ typedef struct _Elm_Widget_Smart_Data Efl_Ui_Focus_Object *provider; } manager; struct { + Eina_Bool listen_to_manager; Eina_List *custom_chain; Evas_Object *prev, *next, *up, *down, *right, *left; Elm_Object_Item *item_prev, *item_next, *item_up, *item_down, *item_right, *item_left;