From bf9c5873fb0a8c6cc006237844022e7468f0a5e1 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 7 Jan 2015 14:47:55 -0500 Subject: [PATCH] ecore-evas-wayland: Fix min/max size calculations Summary: This fixes an issue for windows which do not set a min or max size in the properties. This was discovered when running Enlightenment in a Wayland-Only scenario, and trying to bring up the settings panel which would cause an endless loop in calculating the proper window size due to min/max not being set. @fix NB: Thanks to Mike for the help in tracing this ! :) Signed-off-by: Chris Michael --- .../wayland/ecore_evas_wayland_common.c | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index e8b0853715..dfc31bcf73 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -608,25 +608,33 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h) if (!ee->prop.fullscreen) { int fw = 0, fh = 0; - int maxw, maxh; - int minw, minh; - double a; + int maxw = 0, maxh = 0; + int minw = 0, minh = 0; + double a = 0.0; evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); if (ECORE_EVAS_PORTRAIT(ee)) { - minw = (ee->prop.min.w - fw); - minh = (ee->prop.min.h - fh); - maxw = (ee->prop.max.w + fw); - maxh = (ee->prop.max.h + fh); + if (ee->prop.min.w > 0) + minw = (ee->prop.min.w - fw); + if (ee->prop.min.h > 0) + minh = (ee->prop.min.h - fh); + if (ee->prop.max.w > 0) + maxw = (ee->prop.max.w + fw); + if (ee->prop.max.h > 0) + maxh = (ee->prop.max.h + fh); } else { - minw = (ee->prop.min.w - fh); - minh = (ee->prop.min.h - fw); - maxw = (ee->prop.max.w + fh); - maxh = (ee->prop.max.h + fw); + if (ee->prop.min.w > 0) + minw = (ee->prop.min.w - fh); + if (ee->prop.min.h > 0) + minh = (ee->prop.min.h - fw); + if (ee->prop.max.w > 0) + maxw = (ee->prop.max.w + fh); + if (ee->prop.max.h > 0) + maxh = (ee->prop.max.h + fw); } /* adjust size using aspect */ @@ -690,10 +698,15 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h) h = (minh + (((h - minh) / ee->prop.step.h) * ee->prop.step.h)); } - if (w > maxw) w = maxw; - else if (w < minw) w = minw; - if (h > maxh) h = maxh; - else if (h < minh) h = minh; + if ((maxw > 0) && (w > maxw)) + w = maxw; + else if (w < minw) + w = minw; + + if ((maxh > 0) && (h > maxh)) + h = maxh; + else if (h < minh) + h = minh; orig_w = w; orig_h = h;