Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
_item_single_select_down(Elm_Gengrid_Data *sd)
{
unsigned int i;
- Elm_Object_Item *eo_next;
+ unsigned int idx;
+ Elm_Object_Item *eo_next, *eo_orig;
if (!sd->selected)
eo_next = EO_OBJ(ELM_GEN_ITEM_FROM_INLIST(sd->items));
else
eo_next = sd->last_selected_item;
+ eo_orig = eo_next;
while (eo_next)
{
for (i = 0; i < sd->nmax; i++)
{
eo_next = elm_gengrid_item_next_get(eo_next);
- if (!eo_next) return EINA_FALSE;
+ if (!eo_next) break;
}
- if (!elm_object_item_disabled_get(eo_next)) break;
+ if (eo_next && !elm_object_item_disabled_get(eo_next)) break;
}
- if (!eo_next) return EINA_FALSE;
+ if (!eo_next)
+ {
+ idx = elm_gengrid_item_index_get(eo_orig);
+ if ((idx == sd->item_count) || ((sd->item_count) % (sd->nmax) == 0))
+ return EINA_FALSE;
+ else
+ eo_next = elm_gengrid_last_item_get(sd->obj);
+ }
_all_items_deselect(sd);
elm_gengrid_item_selected_set(eo_next, EINA_TRUE);