From d66ec4a1e88367ebfe523ee0b1628ba57f0309f5 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 16 May 2011 14:09:08 +0000 Subject: [PATCH] Edje min_restricted_calc: Fix the fallback calc to calc more correctly. Ok was shared between width and height and in the error, and in the error case we don't reset maxw and maxh; This caused maxw and maxh to be added a couple of times even when not needed. This would cause weird sizing. SVN revision: 59450 --- legacy/edje/src/lib/edje_util.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index 6572928368..cb268b7603 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -2171,7 +2171,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co Edje *ed; Evas_Coord pw, ph; int maxw, maxh; - int ok; + int okw, okh; int reset_maxwh; Edje_Real_Part *pep = NULL; Eina_Bool has_non_fixed_tb = EINA_FALSE; @@ -2195,12 +2195,11 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co maxw = 0; maxh = 0; - ok = 1; - while (ok) + do { unsigned int i; - ok = 0; + okw = okh = 0; ed->dirty = 1; #ifdef EDJE_CALC_CACHE ed->all_part_change = 1; @@ -2241,7 +2240,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co if (w > maxw) { maxw = w; - ok = 1; + okw = 1; pep = ep; didw = 1; } @@ -2255,7 +2254,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co if (h > maxh) { maxh = h; - ok = 1; + okh = 1; pep = ep; } has_non_fixed_tb = EINA_TRUE; @@ -2263,11 +2262,14 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co } } } - if (ok) + if (okw) { ed->w += maxw; - ed->h += maxh; if (ed->w < restrictedw) ed->w = restrictedw; + } + if (okh) + { + ed->h += maxh; if (ed->h < restrictedh) ed->h = restrictedh; } if ((ed->w > 4000) || (ed->h > 4000)) @@ -2292,6 +2294,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co } } } + while (okw || okh); ed->min.w = ed->w; ed->min.h = ed->h;