Gengrid: Fix wrong focus movement in _item_single_select_down
authorVaibhav Gupta <g.vaibhav1@samsung.com>
Fri, 28 Aug 2015 06:34:49 +0000 (12:04 +0530)
committerAmitesh Singh <amitesh.sh@samsung.com>
Fri, 28 Aug 2015 06:34:49 +0000 (12:04 +0530)
Summary:
The focus movement is wrong when down key press
is done of first item of last row, intsead of
taking the focus out, it moves the focus to next
item (right).

@fix

Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Test Plan:
1. Launch elementary_test -> Gengrid 2 sample
2. Add a few items such that there are 2 items in last row
3. Do a down key press on 1st item of last row
4. Observe focus movement

Reviewers: raster, Hermet, SanghyeonLee, singh.amitesh

Subscribers: sachin.dev

Differential Revision: https://phab.enlightenment.org/D3001

legacy/elementary/src/lib/elm_gengrid.c

index acdd04d..3f392e2 100644 (file)
@@ -2334,7 +2334,9 @@ _item_single_select_down(Elm_Gengrid_Data *sd)
    if (!eo_next)
      {
         idx = elm_gengrid_item_index_get(eo_orig);
-        if ((idx == sd->item_count) || ((sd->item_count) % (sd->nmax) == 0))
+        if (idx > sd->item_count -
+            ((sd->item_count % sd->nmax) == 0 ?
+             sd->nmax : (sd->item_count % sd->nmax)))
            return EINA_FALSE;
         else
            eo_next = elm_gengrid_last_item_get(sd->obj);