efl_ui_focus_parent_provider_gen: do not accidently flatten the widgets

in the provider we accidently flattend out the widget history by
returning the wrong parent. However, this flattening code was required
for the element focus code of the two generic widgets, so the item is
found for every widget, in every subtree.
This commit is contained in:
Marcel Hollerbach 2018-06-12 10:40:38 +02:00
parent 78d1fdd746
commit 42bb537170
4 changed files with 39 additions and 26 deletions

View File

@ -52,6 +52,26 @@ _efl_ui_focus_parent_provider_gen_efl_ui_focus_parent_provider_find_logical_pare
Elm_Widget_Item *item, *above_gengrid = widget;
Efl_Ui_Widget *parent = elm_widget_parent_widget_get(widget);
if (parent == pd->container)
{
item = eina_hash_find(pd->map, &above_gengrid);
efl_ui_focus_object_prepare_logical(pd->container);
if (item)
return item;
}
// We dont have a map entry
return efl_ui_focus_parent_provider_find_logical_parent(pd->provider, widget);
}
EOLIAN static Efl_Ui_Widget*
_efl_ui_focus_parent_provider_gen_item_fetch(Eo *obj, Efl_Ui_Focus_Parent_Provider_Gen_Data *pd, Efl_Ui_Widget *widget)
{
//first check if this item is in the map
Elm_Widget_Item *item, *above_gengrid = widget;
Efl_Ui_Widget *parent = elm_widget_parent_widget_get(widget);
//move forward so we get the last widget above the gengrid level,
//this may be the widget out of the map
while (parent && parent != pd->container)
@ -64,12 +84,7 @@ _efl_ui_focus_parent_provider_gen_efl_ui_focus_parent_provider_find_logical_pare
efl_ui_focus_object_prepare_logical(pd->container);
if (item)
return item;
// We dont have a map entry
return efl_ui_focus_parent_provider_find_logical_parent(pd->provider, widget);
return item;
}
#include "efl_ui_focus_parent_provider_gen.eo.c"

View File

@ -13,6 +13,13 @@ class Efl.Ui.Focus.Parent_Provider_Gen(Efl.Object, Efl.Ui.Focus.Parent_Provider)
container : Efl.Ui.Widget; [[Container widget]]
}
}
item_fetch {
[[Fetch the item where the item is a subchild from]]
params {
widget : Efl.Ui.Widget;
}
return : Efl.Ui.Widget;
}
}
implements {
Efl.Ui.Focus.Parent_Provider.find_logical_parent;

View File

@ -4235,20 +4235,16 @@ _gengrid_element_focused(void *data, const Efl_Event *ev)
if (!focused) return;
if (efl_isa(focused, EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS))
item = efl_parent_get(focused);
else
item = efl_ui_focus_parent_provider_find_logical_parent(pd->provider, focused);
item = efl_ui_focus_parent_provider_gen_item_fetch(pd->provider, focused);
if (efl_isa(item, ELM_GENGRID_ITEM_CLASS))
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(item, ELM_GENGRID_ITEM_CLASS));
_elm_gengrid_item_focused(item);
_all_items_deselect(pd);
if (!_elm_config->item_select_on_focus_disable)
{
_elm_gengrid_item_focused(item);
_all_items_deselect(pd);
if (!_elm_config->item_select_on_focus_disable)
{
elm_gengrid_item_selected_set(item, EINA_TRUE);
elm_gengrid_item_bring_in(item, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
}
elm_gengrid_item_selected_set(item, EINA_TRUE);
elm_gengrid_item_bring_in(item, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
}
}

View File

@ -5804,15 +5804,10 @@ _genlist_element_focused(void *data, const Efl_Event *ev)
if (!focused) return;
if (efl_isa(focused, EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS))
item = efl_parent_get(focused);
else
item = efl_ui_focus_parent_provider_find_logical_parent(pd->provider, focused);
item = efl_ui_focus_parent_provider_gen_item_fetch(pd->provider, focused);
if (efl_isa(item, ELM_GENLIST_ITEM_CLASS))
{
elm_object_item_focus_set(item, EINA_TRUE);
}
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(item, ELM_GENLIST_ITEM_CLASS));
elm_object_item_focus_set(item, EINA_TRUE);
}
EOLIAN static Eo *