elm_gengrid: jump back to the last selected item on gengrid focus jump
this moves the item into selection and focus that was last focused or selected.
This commit is contained in:
parent
5efe5cd135
commit
c745bdcb5c
|
@ -4179,6 +4179,41 @@ elm_gengrid_add(Evas_Object *parent)
|
|||
return elm_legacy_add(MY_CLASS, parent);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_gengrid_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction direction, Efl_Ui_Focus_Object *entry EINA_UNUSED)
|
||||
{
|
||||
Elm_Object_Item *eo_it = NULL;
|
||||
|
||||
if (direction == EFL_UI_FOCUS_DIRECTION_LAST && entry == NULL) return;
|
||||
|
||||
if (pd->last_focused_item)
|
||||
eo_it = pd->last_focused_item;
|
||||
else if (pd->last_selected_item)
|
||||
eo_it = pd->last_selected_item;
|
||||
else if (_elm_config->first_item_focus_on_first_focus_in)
|
||||
{
|
||||
if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
||||
{
|
||||
eo_it = elm_gengrid_first_item_get(obj);
|
||||
}
|
||||
else if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS)
|
||||
{
|
||||
eo_it = elm_gengrid_last_item_get(obj);
|
||||
}
|
||||
}
|
||||
|
||||
eo_it = _elm_gengrid_nearest_visible_item_get(obj, eo_it);
|
||||
|
||||
if (eo_it)
|
||||
{
|
||||
if (!_elm_config->item_select_on_focus_disable &&
|
||||
eo_it != pd->last_selected_item)
|
||||
elm_gengrid_item_selected_set(eo_it, EINA_TRUE);
|
||||
else
|
||||
efl_ui_focus_manager_focus_set(obj, eo_it);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gengrid_element_focused(void *data, const Efl_Event *ev)
|
||||
{
|
||||
|
|
|
@ -570,6 +570,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface_Scroll
|
|||
Efl.Access.Selection.clear;
|
||||
Efl.Ui.Focus.Composition.prepare;
|
||||
Elm.Widget.focus_state_apply;
|
||||
Efl.Ui.Focus.Manager.setup_on_first_touch;
|
||||
}
|
||||
events {
|
||||
realized; [[Called when gengrid realized]]
|
||||
|
|
Loading…
Reference in New Issue