From 3dbf7c1d3012a0c97b13617f8d383726ff701d0f Mon Sep 17 00:00:00 2001 From: Davide Andreoli Date: Wed, 5 Nov 2008 00:47:28 +0000 Subject: [PATCH] * Respect Aspect and Min size spawning gadgets on the desktop. SVN revision: 37463 --- src/modules/gadman/e_mod_gadman.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/modules/gadman/e_mod_gadman.c b/src/modules/gadman/e_mod_gadman.c index 8eeefd553..3809d10d8 100644 --- a/src/modules/gadman/e_mod_gadman.c +++ b/src/modules/gadman/e_mod_gadman.c @@ -189,6 +189,7 @@ gadman_gadget_add(E_Gadcon_Client_Class *cc, int ontop) E_Config_Gadcon_Client *cf = NULL; E_Gadcon_Client *gcc; E_Gadcon *gc; + int w, h; if (ontop) gc = Man->gc_top; @@ -206,6 +207,19 @@ gadman_gadget_add(E_Gadcon_Client_Class *cc, int ontop) /* Place the new gadget */ gcc = gadman_gadget_place(cf, ontop); + /* Respect Aspect */ + evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h); + if (gcc->aspect.w && gcc->aspect.h) + { + if (gcc->aspect.w > gcc->aspect.h) + w = ((float)h / (float)gcc->aspect.h) * (gcc->aspect.w); + else + h = ((float)w / (float)gcc->aspect.w) * (gcc->aspect.h); + if (h < gcc->min.h) h = gcc->min.h; + if (w < gcc->min.w) w = gcc->min.w; + evas_object_resize(gcc->o_frame, w, h); + } + return gcc; }