efl_ui_widget: skip custom focus parent logic

asking for a parent provider only makes sense if we are having a custom
focus parent provider, otherwise this will just result in the normal
parent relation. Not doing this safes us a lot of time that we spent for
nothing in the focus evalulation code.

The gengrid change is needed as the parent provider should be applied
after the constructor is called, otherwise there is no garantee that
shared_win_data is not NULL.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9643
This commit is contained in:
Marcel Hollerbach 2019-08-20 09:14:43 +02:00 committed by Cedric BAIL
parent aa2d94f901
commit b4b17993d5
4 changed files with 20 additions and 7 deletions

View File

@ -37,6 +37,10 @@ _efl_ui_focus_parent_provider_gen_container_set(Eo *obj, Efl_Ui_Focus_Parent_Pro
EINA_SAFETY_ON_NULL_RETURN(efl_parent_get(pd->container));
pd->provider = efl_provider_find(efl_parent_get(pd->container), EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE);
ELM_WIDGET_DATA_GET(pd->container, wid_pd);
((Efl_Ui_Shared_Win_Data*)wid_pd->shared_win_data)->custom_parent_provider = EINA_TRUE;
}
EOLIAN static Efl_Ui_Widget*

View File

@ -452,14 +452,21 @@ _logical_parent_eval(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool s
Efl_Ui_Widget *parent;
Efl_Ui_Focus_Parent_Provider *provider;
if (should)
if (((Efl_Ui_Shared_Win_Data*)pd->shared_win_data)->custom_parent_provider)
{
provider = efl_provider_find(obj, EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE);
EINA_SAFETY_ON_NULL_RETURN_VAL(provider, NULL);
parent = efl_ui_focus_parent_provider_find_logical_parent(provider, obj);
if (should)
{
provider = efl_provider_find(obj, EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE);
EINA_SAFETY_ON_NULL_RETURN_VAL(provider, NULL);
parent = efl_ui_focus_parent_provider_find_logical_parent(provider, obj);
}
else
parent = NULL;
}
else
parent = NULL;
{
parent = efl_ui_widget_parent_get(obj);
}
if (pd->logical.parent != parent)

View File

@ -4380,11 +4380,13 @@ _elm_gengrid_efl_object_constructor(Eo *obj, Elm_Gengrid_Data *sd)
{
legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
sd->content_item_map = eina_hash_pointer_new(NULL);
obj = efl_constructor(efl_super(obj, MY_CLASS));
sd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_GEN_CLASS, obj,
efl_ui_focus_parent_provider_gen_container_set(efl_added, obj),
efl_ui_focus_parent_provider_gen_content_item_map_set(efl_added, sd->content_item_map));
obj = efl_constructor(efl_super(obj, MY_CLASS));
sd->obj = obj;
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);

View File

@ -1043,7 +1043,7 @@ void efl_ui_scroll_connector_unbind(Eo *obj);
typedef struct
{
Eina_Bool custom_parent_provider;
} Efl_Ui_Shared_Win_Data;
Efl_Ui_Shared_Win_Data* efl_ui_win_shared_data_get(Efl_Ui_Win *win);