forked from enlightenment/efl
elm_genlist: move focus recovering to first_touch instead of
focus_update this means that the function is called more reliable, and not only based on focus state, but also based on the redirect situation.
This commit is contained in:
parent
844854d3e8
commit
be3cfcec66
|
@ -3366,29 +3366,17 @@ _elm_genlist_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
|
||||||
return eo_it;
|
return eo_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static void
|
||||||
_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
|
_elm_genlist_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Genlist_Data *sd, Efl_Ui_Focus_Direction direction EINA_UNUSED, Efl_Ui_Focus_Object *entry EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Eina_Bool int_ret = EINA_FALSE;
|
|
||||||
Elm_Object_Item *eo_it = NULL;
|
Elm_Object_Item *eo_it = NULL;
|
||||||
Eina_Bool is_sel = EINA_FALSE;
|
Eina_Bool is_sel = EINA_FALSE;
|
||||||
|
|
||||||
int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
|
|
||||||
if (!int_ret) return EINA_FALSE;
|
|
||||||
|
|
||||||
if (efl_ui_focus_object_focus_get(obj) && (sd->items) && (sd->selected) &&
|
|
||||||
(!sd->last_selected_item))
|
|
||||||
{
|
|
||||||
sd->last_selected_item = eina_list_data_get(sd->selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (efl_ui_focus_object_focus_get(obj) && !sd->mouse_down)
|
|
||||||
{
|
|
||||||
if (sd->last_focused_item)
|
if (sd->last_focused_item)
|
||||||
eo_it = sd->last_focused_item;
|
eo_it = sd->last_focused_item;
|
||||||
else if (sd->last_selected_item)
|
else if (sd->last_selected_item)
|
||||||
eo_it = sd->last_selected_item;
|
eo_it = sd->last_selected_item;
|
||||||
else if (_elm_config->first_item_focus_on_first_focus_in)
|
else if (_elm_config->first_item_focus_on_first_focus_in || !eo_it)
|
||||||
{
|
{
|
||||||
eo_it = elm_genlist_first_item_get(obj);
|
eo_it = elm_genlist_first_item_get(obj);
|
||||||
is_sel = EINA_TRUE;
|
is_sel = EINA_TRUE;
|
||||||
|
@ -3412,16 +3400,24 @@ _elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
|
||||||
else
|
else
|
||||||
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
||||||
_elm_widget_focus_highlight_start(obj);
|
_elm_widget_focus_highlight_start(obj);
|
||||||
|
//set it again in the manager, there might be the case that the manager focus history and internal item foused logic are in different states
|
||||||
|
efl_ui_focus_manager_focus_set(obj, eo_it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
|
||||||
{
|
{
|
||||||
if (sd->focused_item)
|
Eina_Bool int_ret = EINA_FALSE;
|
||||||
|
|
||||||
|
int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
|
||||||
|
if (!int_ret) return EINA_FALSE;
|
||||||
|
|
||||||
|
if (efl_ui_focus_object_focus_get(obj) && (sd->items) && (sd->selected) &&
|
||||||
|
(!sd->last_selected_item))
|
||||||
{
|
{
|
||||||
sd->last_focused_item = sd->focused_item;
|
sd->last_selected_item = eina_list_data_get(sd->selected);
|
||||||
_elm_genlist_item_unfocused(sd->focused_item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
|
@ -558,6 +558,7 @@ class Elm.Genlist (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface_Scroll
|
||||||
Efl.Access.Selection.access_selection_clear;
|
Efl.Access.Selection.access_selection_clear;
|
||||||
Efl.Ui.Focus.Composition.prepare;
|
Efl.Ui.Focus.Composition.prepare;
|
||||||
Efl.Ui.Widget.focus_state_apply;
|
Efl.Ui.Widget.focus_state_apply;
|
||||||
|
Efl.Ui.Focus.Manager.setup_on_first_touch;
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
item,focused; [[Called when genlist item got focus]]
|
item,focused; [[Called when genlist item got focus]]
|
||||||
|
|
Loading…
Reference in New Issue