From 332cdd1e7c02a4f784a51a0af350e87dfd7c808b Mon Sep 17 00:00:00 2001 From: Viacheslav Lvov Date: Fri, 6 Dec 2013 16:08:09 +0900 Subject: [PATCH] genlist - don't do heavy queue work for 0 width genlists and defer fill Scenario: 1. Create elm_genlist. 2. Add some items to it. 3. Do not resize the genlist and leave it with width == 0. PROPOSAL: 1. When the element is queued for recalculation check current width of widget. If it is equal to 0 do not add idle enterer. 2. In smart callback on resize check if queue of items that need recalculation is not empty and new width is not 0. In this situation add idle enterer. --- legacy/elementary/src/lib/elm_genlist.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index c797216da0..4cc6c2db2e 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -4000,11 +4000,20 @@ _item_idle_enterer(void *data) return ok; } +static void +_requeue_idle_enterer(Elm_Genlist_Smart_Data *sd) +{ + if (sd->queue_idle_enterer) ecore_idle_enterer_del(sd->queue_idle_enterer); + sd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, sd->obj); +} + static void _item_queue(Elm_Genlist_Smart_Data *sd, Elm_Gen_Item *it, Eina_Compare_Cb cb) { + Evas_Coord w = 0; + if (it->item->queued) return; it->item->queued = EINA_TRUE; if (cb && !sd->requeued) @@ -4028,8 +4037,8 @@ _item_queue(Elm_Genlist_Smart_Data *sd, // evas_event_thaw(evas_object_evas_get(sd->obj)); // evas_event_thaw_eval(evas_object_evas_get(sd->obj)); - if (!sd->queue_idle_enterer) - sd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, sd->obj); + evas_object_geometry_get(sd->obj, NULL, NULL, &w, NULL); + if (w > 0) _requeue_idle_enterer(sd); } /* If the application wants to know the relative item, use @@ -5003,6 +5012,8 @@ _elm_genlist_smart_resize(Eo *obj, void *_pd, va_list *list) eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h)); evas_object_resize(sd->hit_rect, w, h); + if ((sd->queue) && (!sd->queue_idle_enterer) && (w > 0)) + _requeue_idle_enterer(sd); } static void