Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        iconify.c 


Log Message:
Added sanity check.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -3 -r1.137 -r1.138
--- iconify.c   27 Feb 2005 13:17:29 -0000      1.137
+++ iconify.c   5 Mar 2005 00:41:29 -0000       1.138
@@ -732,7 +732,7 @@
 IB_SnapEWin(EWin * ewin)
 {
    /* Make snapshot of window */
-   int                 w, h, scale;
+   int                 w, h, ww, hh, scale;
    Iconbox            *ib;
    Imlib_Image        *im;
    Drawable            draw;
@@ -740,6 +740,11 @@
    if (!EwinIsMapped(ewin))
       return;
 
+   ww = EoGetW(ewin);
+   hh = EoGetH(ewin);
+   if (ww <= 0 || hh <= 0)
+      return;
+
    w = 40;
    h = 40;
    ib = SelectIconboxForEwin(ewin);
@@ -754,18 +759,18 @@
    w *= scale;
    h *= scale;
 
-   if (EoGetW(ewin) > EoGetH(ewin))
-      h = (w * EoGetH(ewin)) / EoGetW(ewin);
+   if (ww > hh)
+      h = (w * hh) / ww;
    else
-      w = (h * EoGetW(ewin)) / EoGetH(ewin);
+      w = (h * ww) / hh;
    if (w < 4)
       w = 4;
    if (h < 4)
       h = 4;
-   if (w > EoGetW(ewin) || h > EoGetH(ewin))
+   if (w > ww || h > hh)
      {
-       w = EoGetW(ewin);
-       h = EoGetH(ewin);
+       w = ww;
+       h = hh;
      }
 
 #if USE_COMPOSITE
@@ -776,8 +781,8 @@
 
        mask = EWindowGetShapePixmap(EoGetWin(ewin));
        imlib_context_set_drawable(draw);
-       im = imlib_create_scaled_image_from_drawable(mask, 0, 0, EoGetW(ewin),
-                                                    EoGetH(ewin), w, h, 1, 0);
+       im = imlib_create_scaled_image_from_drawable(mask, 0, 0, ww, hh,
+                                                    w, h, 1, 0);
        imlib_context_set_image(im);
        imlib_image_set_has_alpha(1);   /* Should be set by imlib? */
      }
@@ -786,8 +791,8 @@
      {
        draw = EoGetWin(ewin);
        imlib_context_set_drawable(draw);
-       im = imlib_create_scaled_image_from_drawable(None, 0, 0, EoGetW(ewin),
-                                                    EoGetH(ewin), w, h, 1, 1);
+       im = imlib_create_scaled_image_from_drawable(None, 0, 0, ww, hh,
+                                                    w, h, 1, 1);
        imlib_context_set_image(im);
        imlib_image_set_has_alpha(1);   /* Should be set by imlib? */
      }




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to