summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-30 13:09:10 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-30 13:09:10 -0400
commitca5b68a6203a6947739c9e72c5bef5e6071de325 (patch)
treec2669165f69b1d0fa987691b11bfa66b35e47abb
parent5292729e376338472a025c3bf27f6c80e755e445 (diff)
elm/gengrid: handle gengrid finding of nearest visible item when not realized
Summary: FIXME-- @fix Depends on D8960 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8961
-rw-r--r--src/lib/elementary/elm_gengrid.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 8a5bd597ef..8c36f4b722 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -3505,7 +3505,7 @@ _elm_gengrid_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
3505 Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry 3505 Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry
3506 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry 3506 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry
3507 Eina_List *item_list = NULL, *l = NULL; 3507 Eina_List *item_list = NULL, *l = NULL;
3508 Elm_Object_Item *eo_item = NULL; 3508 Elm_Object_Item *first_item, *eo_item = NULL;
3509 ELM_GENGRID_DATA_GET(obj, sd); 3509 ELM_GENGRID_DATA_GET(obj, sd);
3510 Eina_Bool search_next = EINA_FALSE; 3510 Eina_Bool search_next = EINA_FALSE;
3511 3511
@@ -3513,19 +3513,26 @@ _elm_gengrid_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
3513 ELM_GENGRID_ITEM_DATA_GET(eo_it, it); 3513 ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
3514 3514
3515 evas_object_geometry_get(sd->pan_obj, &vx, &vy, &vw, &vh); 3515 evas_object_geometry_get(sd->pan_obj, &vx, &vy, &vw, &vh);
3516 evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih); // FIXME: check if the item is realized or not 3516 if (it->realized)
3517
3518 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
3519 { 3517 {
3520 if (!elm_object_item_disabled_get(eo_it)) 3518 evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
3521 return eo_it; 3519
3522 else 3520 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
3523 search_next = EINA_TRUE; 3521 {
3522 if (!elm_object_item_disabled_get(eo_it))
3523 return eo_it;
3524 else
3525 search_next = EINA_TRUE;
3526 }
3524 } 3527 }
3525 3528
3526 item_list = elm_gengrid_realized_items_get(obj); 3529 item_list = elm_gengrid_realized_items_get(obj);
3530 /* if first realized item is before parameter item then parameter item is
3531 * off viewport towards bottom: start at end of list */
3532 first_item = eina_list_data_get(item_list);
3533 ELM_GENGRID_ITEM_DATA_GET(first_item, first_it);
3527 3534
3528 if ((iy < vy) || search_next) 3535 if ((iy < vy) || search_next || (!first_it) || (first_it->position > it->position))
3529 { 3536 {
3530 EINA_LIST_FOREACH(item_list, l, eo_item) 3537 EINA_LIST_FOREACH(item_list, l, eo_item)
3531 { 3538 {
@@ -3555,7 +3562,7 @@ _elm_gengrid_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
3555 } 3562 }
3556 eina_list_free(item_list); 3563 eina_list_free(item_list);
3557 3564
3558 return eo_it; 3565 return it->realized ? eo_it : NULL;
3559} 3566}
3560 3567
3561EOLIAN static Eina_Rect 3568EOLIAN static Eina_Rect