dear all, hello.
authorShinwoo Kim <kimcinoo.efl@gmail.com>
Wed, 24 Oct 2012 01:06:05 +0000 (01:06 +0000)
committerShinwoo Kim <kimcinoo.efl@gmail.com>
Wed, 24 Oct 2012 01:06:05 +0000 (01:06 +0000)
genlist could have LOTS of items. so it would be better to use only displayed items for the focus chain.
please check the attachment and give feedback. thanks.

cordially,
shinwoo kim.

SVN revision: 78378

src/lib/elm_genlist.c

index 76b2580..4dac5fa 100644 (file)
@@ -2362,6 +2362,8 @@ _elm_genlist_smart_focus_next(const Evas_Object *obj,
                            Elm_Focus_Direction dir,
                            Evas_Object **next)
 {
+   Evas_Coord x, y, w, h;
+   Evas_Coord sx, sy, sw, sh;
    Item_Block *itb;
    Eina_List *items = NULL;
    Eina_Bool done = EINA_FALSE;
@@ -2369,6 +2371,8 @@ _elm_genlist_smart_focus_next(const Evas_Object *obj,
    ELM_GENLIST_CHECK(obj) EINA_FALSE;
    ELM_GENLIST_DATA_GET(obj, sd);
 
+   evas_object_geometry_get(ELM_WIDGET_DATA(sd)->obj, &sx, &sy, &sw, &sh);
+
    EINA_INLIST_FOREACH(sd->blocks, itb)
      {
         if (itb->realized)
@@ -2380,7 +2384,16 @@ _elm_genlist_smart_focus_next(const Evas_Object *obj,
              EINA_LIST_FOREACH(itb->items, l, it)
                {
                   if (it->realized)
-                    items = eina_list_append(items, it->base.access_obj);
+                    {
+                       evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
+
+                       /* check item which displays more than half of its size */
+                       if (((x + (w / 2)) >= sx) &&
+                           ((y + (h / 2)) >= sy) &&
+                           ((x + (w / 2)) <= (sx + sw)) &&
+                           ((y + (h / 2)) <= (sy + sh)))
+                         items = eina_list_append(items, it->base.access_obj);
+                    }
                }
           }
         else if (done) break;