genlist : add on focus handling about realized item firstly
authorSangHyeon Lee <sh10233.lee@samsung.com>
Fri, 18 Nov 2016 08:41:23 +0000 (17:41 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 29 Nov 2016 12:32:35 +0000 (21:32 +0900)
Change-Id: I6e7b8b102d010b5133ebc1494b1eb671d2f4b92c
Signed-off-by: SangHyeon Lee <sh10233.lee@samsung.com>
src/mobile_lib/elm_genlist.c

index 775dc5e..7aa5f67 100644 (file)
@@ -3598,7 +3598,38 @@ _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd, Elm_Object_Item
                }
           }
         else
-          _item_focus_next(sd, FOCUS_DIR_DOWN);
+          {
+             Item_Block *itb, *nib;
+             EINA_INLIST_FOREACH(sd->blocks, itb)
+               {
+                  if (itb->realized)
+                    {
+                       Elm_Gen_Item *tmp = eina_list_data_get(itb->items);
+                       while(tmp && tmp->item->block == itb)
+                         {
+                            if ((_item_focusable_search(&tmp, 1)) && (tmp->realized))
+                              {
+                                 Evas_Coord x, y, w, h, sx, sy, sw, sh;
+                                 evas_object_geometry_get(VIEW(tmp), &x, &y, &w, &h);
+                                 evas_object_geometry_get(obj, &sx, &sy, &sw, &sh);
+                                 /* Item is included viewport */
+                                 if (ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h))
+                                   {
+                                      elm_object_item_focus_set(EO_OBJ(tmp), EINA_TRUE);
+                                      goto done;
+                                   }
+                              }
+
+                            tmp = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(tmp)->next);
+                         }
+
+                       nib = EINA_INLIST_CONTAINER_GET(EINA_INLIST_GET(itb)->next, Item_Block);
+                       if (!nib || !nib->realized) goto done;
+                    }
+               }
+done:
+             if (!sd->focused_item) _item_focus_next(sd, FOCUS_DIR_DOWN);
+          }
      }
    else
      {