[list] If selected item is the first one (or the last one), up (or down) key should...
authorWooHyun Jung <wh0705.jung@samsung.com>
Thu, 25 Apr 2013 07:56:23 +0000 (16:56 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Wed, 12 Jun 2013 04:25:00 +0000 (13:25 +0900)
src/lib/elm_list.c

index c124bfa..a4437b0 100644 (file)
@@ -236,14 +236,16 @@ static Elm_List_Item *_item_focused_search(Elm_List_Item *it, int dir)
    return (Elm_List_Item *)eina_list_data_get(tmp);
 }
 
-static void _item_focused_next(Elm_List_Smart_Data *sd, int dir)
+static Eina_Bool _item_focused_next(Elm_List_Smart_Data *sd, int dir)
 {
-   Elm_List_Item *it = NULL;
+   Elm_List_Item *it = NULL, *old_focused = NULL;
 
    if (elm_widget_focus_get(ELM_WIDGET_DATA(sd)->obj))
       edje_object_signal_emit
          (ELM_WIDGET_DATA(sd)->resize_obj, "elm,state,unfocused", "elm");
 
+   old_focused = sd->focused;
+
    if (!sd->focused)
      {
         if (dir == 1)
@@ -258,6 +260,11 @@ static void _item_focused_next(Elm_List_Smart_Data *sd, int dir)
         it = _item_focused_search(it, dir);
      }
    _item_focused(it);
+
+   if (old_focused == sd->focused)
+     return EINA_FALSE;
+   else
+     return EINA_TRUE;
 }
 
 
@@ -331,9 +338,13 @@ _elm_list_smart_event(Evas_Object *obj,
           }
         else
           {
-             _item_focused_next(sd, -1);
-             ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-             return EINA_TRUE;
+             if (_item_focused_next(sd, -1))
+               {
+                  ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+                  return EINA_TRUE;
+               }
+             else
+               return EINA_FALSE;
           }
      }
    else if ((!strcmp(ev->keyname, "Down")) ||
@@ -348,9 +359,13 @@ _elm_list_smart_event(Evas_Object *obj,
           }
         else
           {
-             _item_focused_next(sd, 1);
-             ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-             return EINA_TRUE;
+             if (_item_focused_next(sd, 1))
+               {
+                  ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+                  return EINA_TRUE;
+               }
+             else
+               return EINA_FALSE;
           }
      }
    else if ((!strcmp(ev->keyname, "Home")) ||