summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-29 09:30:54 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-29 12:29:04 -0400
commit16940c5310329699e06e6a5a833916c721b72feb (patch)
tree0e2a1cd5f8bd6c93e610ee89d1f4a70057ca3aa9
parente6cb461ea69d31e7703fd0ff87ddaee059f994ff (diff)
elm/genlist: handle genlist finding of nearest visible item when not realized
Summary: FIXME-- @fix Depends on D8995 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8996
-rw-r--r--src/lib/elementary/elm_genlist.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 9217292132..3d12ebdf06 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -3351,7 +3351,7 @@ _elm_genlist_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
3351 Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry 3351 Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry
3352 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry 3352 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry
3353 Eina_List *item_list = NULL, *l = NULL; 3353 Eina_List *item_list = NULL, *l = NULL;
3354 Elm_Object_Item *eo_item = NULL; 3354 Elm_Object_Item *first_item, *eo_item = NULL;
3355 ELM_GENLIST_DATA_GET(obj, sd); 3355 ELM_GENLIST_DATA_GET(obj, sd);
3356 Eina_Bool search_next = EINA_FALSE; 3356 Eina_Bool search_next = EINA_FALSE;
3357 3357
@@ -3359,19 +3359,27 @@ _elm_genlist_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
3359 ELM_GENLIST_ITEM_DATA_GET(eo_it, it); 3359 ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
3360 3360
3361 evas_object_geometry_get(sd->pan_obj, &vx, &vy, &vw, &vh); 3361 evas_object_geometry_get(sd->pan_obj, &vx, &vy, &vw, &vh);
3362 evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih); // FIXME: check if the item is realized or not
3363 3362
3364 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih)) 3363 if (it->realized)
3365 { 3364 {
3366 if (!elm_object_item_disabled_get(eo_it)) 3365 evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
3367 return eo_it; 3366
3368 else 3367 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
3369 search_next = EINA_TRUE; 3368 {
3369 if (!elm_object_item_disabled_get(eo_it))
3370 return eo_it;
3371 else
3372 search_next = EINA_TRUE;
3373 }
3370 } 3374 }
3371 3375
3372 item_list = elm_genlist_realized_items_get(obj); 3376 item_list = elm_genlist_realized_items_get(obj);
3377 /* if first realized item is before parameter item then parameter item is
3378 * off viewport towards bottom: start at end of list */
3379 first_item = eina_list_data_get(item_list);
3380 ELM_GENLIST_ITEM_DATA_GET(first_item, first_it);
3373 3381
3374 if ((iy < vy) || search_next) 3382 if ((iy < vy) || search_next || (!first_it) || (first_it->position > it->position))
3375 { 3383 {
3376 EINA_LIST_FOREACH(item_list, l, eo_item) 3384 EINA_LIST_FOREACH(item_list, l, eo_item)
3377 { 3385 {
@@ -3401,7 +3409,7 @@ _elm_genlist_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
3401 } 3409 }
3402 eina_list_free(item_list); 3410 eina_list_free(item_list);
3403 3411
3404 return eo_it; 3412 return it->realized ? eo_it : NULL;
3405} 3413}
3406 3414
3407EOLIAN static void 3415EOLIAN static void