Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        screen.c size.c 


Log Message:
Fix several bugs with maximizing windows.

===================================================================
RCS file: /cvs/e/e16/e/src/screen.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- screen.c    22 Apr 2006 22:00:02 -0000      1.16
+++ screen.c    23 Apr 2006 08:14:03 -0000      1.17
@@ -129,37 +129,46 @@
 int
 ScreenGetGeometry(int xi, int yi, int *px, int *py, int *pw, int *ph)
 {
-   int                 x, y, w, h, head;
+   int                 i, dx, dy, x, y, w, h, dist, ix;
+   EScreen            *ps;
 
-   head = 0;
-
-   x = 0;
-   y = 0;
-   w = VRoot.w;
-   h = VRoot.h;
+   ix = -1;
+   dist = 2147483647;
 
    if (n_screens > 1)
      {
-       int                 i;
-
        for (i = 0; i < n_screens; i++)
          {
-            EScreen            *ps = p_screens + i;
+            ps = p_screens + i;
 
-            if (xi >= ps->x && xi < ps->x + ps->w &&
-                yi >= ps->y && yi < ps->y + ps->h)
-              {
-                 x = ps->x;
-                 y = ps->y;
-                 w = ps->w;
-                 h = ps->h;
-                 head = ps->head;
-                 /* NB! *First* matching head is used */
-                 break;
-              }
+            dx = xi - (ps->x + ps->w / 2);
+            dy = yi - (ps->y + ps->h / 2);
+            dx = dx * dx + dy * dy;
+            if (dx >= dist)
+               continue;
+            dist = dx;
+            ix = i;
          }
      }
 
+   if (ix >= 0)
+     {
+       ps = p_screens + ix;
+       ix = ps->head;
+       x = ps->x;
+       y = ps->y;
+       w = ps->w;
+       h = ps->h;
+     }
+   else
+     {
+       ix = VRoot.scr;
+       x = 0;
+       y = 0;
+       w = VRoot.w;
+       h = VRoot.h;
+     }
+
    if (px)
       *px = x;
    if (py)
@@ -169,7 +178,7 @@
    if (ph)
       *ph = h;
 
-   return head;
+   return ix;
 }
 
 static void
===================================================================
RCS file: /cvs/e/e16/e/src/size.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- size.c      22 Apr 2006 22:00:02 -0000      1.51
+++ size.c      23 Apr 2006 08:14:03 -0000      1.52
@@ -74,11 +74,10 @@
       type = MAX_XINERAMA;
 
    /* Default is no change */
-   y = EoGetY(ewin);
    x = EoGetX(ewin);
-   h = ewin->client.h;
-   w = ewin->client.w;
-   EwinBorderGetSize(ewin, &bl, &br, &bt, &bb);
+   y = EoGetY(ewin);
+   h = EoGetH(ewin);
+   w = EoGetW(ewin);
 
    switch (type)
      {
@@ -86,19 +85,22 @@
        if (direction & MAX_HOR)
          {
             x = 0;
-            w = VRoot.w - bl - br;
+            w = VRoot.w;
+            ewin->state.maximized_horz = 1;
          }
        if (direction & MAX_VER)
          {
             y = 0;
-            h = VRoot.h - bt - bb;
+            h = VRoot.h;
+            ewin->state.maximized_vert = 1;
          }
        break;
 
+     default:
      case MAX_ABSOLUTE:
      case MAX_AVAILABLE:
      case MAX_CONSERVATIVE:
-       ScreenGetAvailableArea(EoGetX(ewin), EoGetY(ewin), &x1, &y1, &x2, &y2);
+       ScreenGetAvailableArea(x + w / 2, y + h / 2, &x1, &y1, &x2, &y2);
        x2 += x1;
        y2 += y1;
 
@@ -134,7 +136,7 @@
                     y2 = EoGetY(pe);
               }
             y = y1;
-            h = y2 - y1 - (bt + bb);
+            h = y2 - y1;
 
             ewin->state.maximized_vert = 1;
          }
@@ -160,7 +162,7 @@
                     x2 = EoGetX(pe);
               }
             x = x1;
-            w = x2 - x1 - (bl + br);
+            w = x2 - x1;
 
             ewin->state.maximized_horz = 1;
          }
@@ -168,10 +170,19 @@
        break;
      }
 
+   EwinBorderGetSize(ewin, &bl, &br, &bt, &bb);
+   w -= (bl + br);
+   if (w < 10)
+      w = 10;
+   h -= (bt + bb);
+   if (h < 10)
+      h = 10;
+
    ewin->lx = EoGetX(ewin);
    ewin->ly = EoGetY(ewin);
    ewin->lw = ewin->client.w;
    ewin->lh = ewin->client.h;
+
    ewin->state.maximizing = 1;
    EwinMoveResize(ewin, x, y, w, h);
    ewin->state.maximizing = 0;




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to