From ba5823f188d225e1cac753c8a5350f813f0dcf87 Mon Sep 17 00:00:00 2001 From: discomfitor Date: Mon, 16 Dec 2013 13:34:59 -0500 Subject: [PATCH] bugfix: unset genlist mincalcd flag when changing to/from having no item contents not backporting because not sure if correct, but definitely a bug also there's a similar issue where objects (I'm looking at you, elm_list) don't size until the first render, which causes the initial genlist calc sizes to be 100% wrong every time --- legacy/elementary/src/lib/elm_gen_common.h | 1 + legacy/elementary/src/lib/elm_genlist.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/legacy/elementary/src/lib/elm_gen_common.h b/legacy/elementary/src/lib/elm_gen_common.h index ba22380c87..19e4a118fc 100644 --- a/legacy/elementary/src/lib/elm_gen_common.h +++ b/legacy/elementary/src/lib/elm_gen_common.h @@ -66,6 +66,7 @@ struct Elm_Gen_Item Eina_Bool reorder : 1; Eina_Bool decorate_it_set : 1; /**< item uses style mode for highlight/select */ Eina_Bool flipped : 1; /**< a flag that shows the flip status of the item. */ + Eina_Bool has_contents : 1; /**< content objs have or previously did exist (size calcs) */ }; #endif diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 3fa3aca862..3ca50ebac4 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -1654,6 +1654,9 @@ _item_realize(Elm_Gen_Item *it, _item_text_realize(it, VIEW(it), &it->texts, NULL); it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, NULL); + if (it->has_contents != (!!it->content_objs)) + it->item->mincalcd = EINA_FALSE; + it->has_contents = !!it->content_objs; _item_state_realize(it, VIEW(it), &it->states, NULL); if (it->flipped) { @@ -6485,7 +6488,9 @@ elm_genlist_item_fields_update(Elm_Object_Item *item, &it->contents, parts); it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, parts); - + if (it->has_contents != (!!it->content_objs)) + it->item->mincalcd = EINA_FALSE; + it->has_contents = !!it->content_objs; if (it->item->type == ELM_GENLIST_ITEM_NONE) { Evas_Object* eobj; @@ -6534,6 +6539,8 @@ elm_genlist_item_fields_update(Elm_Object_Item *item, if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE)) _item_state_realize(it, VIEW(it), &it->states, parts); + if (!it->item->mincalcd) + elm_genlist_item_update(item); } EAPI void