From 76f44a416da4bee0f4e87632d1a88825984bd863 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 28 Oct 2019 15:48:08 -0400 Subject: [PATCH] elm/genlist: hide cached item contents and mark content unfocusable during calc cached item contents should already be hidden by the edje clipper, so this simply changes their visible state to break them out of the focus calcs contents must also be explicitly marked as unfocusable during calc-only realize operations in order to avoid triggering a full focus recalc which will error due to missing focus adapter in the item block Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10543 --- src/lib/elementary/elm_genlist.c | 29 ++++++++++++++++++++--------- src/lib/elementary/elm_widget_genlist.h | 1 + 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index 5f68fbe..de71744 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -503,7 +503,8 @@ _item_content_realize(Elm_Gen_Item *it, if (elm_widget_is(content)) { - if (!calc) + elm_widget_tree_unfocusable_set(content, it->item->unfocusable); + if (!calc && (!it->item->unfocusable)) _elm_widget_full_eval(content); } } @@ -1789,7 +1790,11 @@ _item_cache_find(Elm_Gen_Item *it) efl_wref_del(itc->base_view, &itc->base_view); itc->base_view = NULL; EINA_LIST_FREE(itc->contents, obj) - elm_widget_tree_unfocusable_set(obj, EINA_FALSE); + { + if (elm_widget_is(obj)) + elm_widget_tree_unfocusable_set(obj, it->item->unfocusable); + evas_object_show(obj); + } itc->contents = NULL; _item_cache_free(itc); return EINA_TRUE; @@ -1810,7 +1815,8 @@ _content_cache_add(Elm_Gen_Item *it, Eina_List **cache) if (!elm_widget_is_legacy(pd->obj)) { eina_hash_del_by_key(pd->content_item_map, &content); - elm_widget_tree_unfocusable_set(content, EINA_TRUE); + if (elm_widget_is(content)) elm_widget_tree_unfocusable_set(content, EINA_TRUE); + evas_object_hide(content); } // } @@ -5690,6 +5696,15 @@ _item_unrealize(Elm_Gen_Item *it) it->want_unrealize = EINA_FALSE; } +static void +_item_temp_realize(Elm_Gen_Item *it, const int index) +{ + it->item->unfocusable = EINA_TRUE; + _item_realize(it, index, EINA_TRUE); + _elm_genlist_item_unrealize(it, EINA_TRUE); + it->item->unfocusable = EINA_FALSE; +} + static Eina_Bool _item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd) { @@ -5725,8 +5740,7 @@ _item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd) { if (!size || (it->item->expanded_depth != size->expanded_depth)) { - _item_realize(it, blk_idx + vis_count, EINA_TRUE); - _elm_genlist_item_unrealize(it, EINA_TRUE); + _item_temp_realize(it, blk_idx + vis_count); } else { @@ -5748,10 +5762,7 @@ _item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd) it->item->mincalcd = EINA_TRUE; } else - { - _item_realize(it, blk_idx + vis_count, EINA_TRUE); - _elm_genlist_item_unrealize(it, EINA_TRUE); - } + _item_temp_realize(it, blk_idx + vis_count); } } else diff --git a/src/lib/elementary/elm_widget_genlist.h b/src/lib/elementary/elm_widget_genlist.h index 6c893d3..6ce705e 100644 --- a/src/lib/elementary/elm_widget_genlist.h +++ b/src/lib/elementary/elm_widget_genlist.h @@ -266,6 +266,7 @@ struct Elm_Gen_Item_Type Eina_Bool queued : 1; Eina_Bool before : 1; Eina_Bool show_me : 1; + Eina_Bool unfocusable : 1; /* item is not focusable; propagate to content */ }; struct _Item_Block -- 2.7.4