From: SangHyeon Lee Date: Mon, 26 Dec 2016 11:40:19 +0000 (+0900) Subject: genlist: fix on focus item search logic to make include content also in current viewport X-Git-Tag: submit/tizen/20170102.091821~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ebaa64c9f335e6bb2db28b7ba34e47a3d6a4e85;p=platform%2Fupstream%2Felementary.git genlist: fix on focus item search logic to make include content also in current viewport Change-Id: Icdfd466b9a07e360a7aa6c0b1ea657b63fe0ae5b Signed-off-by: SangHyeon Lee --- diff --git a/src/mobile_lib/elm_genlist.c b/src/mobile_lib/elm_genlist.c index 4ae01a1fe..5b8fa06a2 100644 --- a/src/mobile_lib/elm_genlist.c +++ b/src/mobile_lib/elm_genlist.c @@ -3897,16 +3897,30 @@ _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd, Elm_Object_Item Elm_Gen_Item *tmp = eina_list_data_get(itb->items); while(tmp && tmp->item->block == itb) { - if ((_item_focusable_search(&tmp, 1)) && (tmp->realized)) + if (tmp->realized) { + Evas_Object *old = tmp; 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)) + /* Item is included viewport and focusable */ + if ((ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h)) && + (_item_focusable_search(&tmp, 1))) { - elm_object_item_focus_set(EO_OBJ(tmp), EINA_TRUE); - goto success; + Eina_Bool include = EINA_TRUE; + if (old != tmp && tmp->realized) + { + evas_object_geometry_get(VIEW(tmp), &x, &y, &w, &h); + evas_object_geometry_get(obj, &sx, &sy, &sw, &sh); + include = ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h); + } + else if (!tmp->realized) include = EINA_FALSE; + + if (include) + { + elm_object_item_focus_set(EO_OBJ(tmp), EINA_TRUE); + goto success; + } } }