raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=5099f9eeec52ae71746ede0fd3ff375dc0e83aef

commit 5099f9eeec52ae71746ede0fd3ff375dc0e83aef
Author: Vaibhav Gupta <g.vaibh...@samsung.com>
Date:   Thu May 21 18:02:00 2015 +0900

    Gengrid: Updated gengrid to select the last item.
    
    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.vaibh...@samsung.com>
    
    Reviewers: Hermet, SanghyeonLee, raster
    
    Reviewed By: raster
    
    Subscribers: sachin.dev, singh.amitesh
    
    Differential Revision: https://phab.enlightenment.org/D2418
---
 src/lib/elm_gengrid.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index af7cec9..cb9aa78 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -1932,25 +1932,34 @@ static Eina_Bool
 _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);

-- 


Reply via email to