Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        arrange.c ipc.c menus.c screen.c screen.h warp.c 


Log Message:
Screen stuff naming consistency and code tweaks.

===================================================================
RCS file: /cvs/e/e16/e/src/arrange.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -3 -r1.99 -r1.100
--- arrange.c   16 Jun 2007 08:41:53 -0000      1.99
+++ arrange.c   29 Sep 2007 19:13:21 -0000      1.100
@@ -286,7 +286,7 @@
      {
        int                 xx1, yy1, xx2, yy2;
 
-       GetPointerScreenAvailableArea(&xx1, &yy1, &xx2, &yy2);
+       ScreenGetAvailableAreaByPointer(&xx1, &yy1, &xx2, &yy2);
        xx2 += xx1;
        yy2 += yy1;
        if (startx < xx1)
@@ -958,7 +958,7 @@
 {
    int                 x, y, w, h;
 
-   GetPointerScreenAvailableArea(&x, &y, &w, &h);
+   ScreenGetAvailableAreaByPointer(&x, &y, &w, &h);
    *px = (w - EoGetW(ewin)) / 2 + x;
    *py = (h - EoGetH(ewin)) / 2 + y;
 }
===================================================================
RCS file: /cvs/e/e16/e/src/ipc.c,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -3 -r1.302 -r1.303
--- ipc.c       9 Jun 2007 14:27:55 -0000       1.302
+++ ipc.c       29 Sep 2007 19:13:21 -0000      1.303
@@ -142,15 +142,12 @@
      }
    else if (!strcmp(param, "split"))
      {
-       int                 i, j, nx, ny;
+       unsigned int        nx, ny;
 
        nx = 2;
        ny = 1;
-       sscanf(p, "%i %i\n", &nx, &ny);
-       for (i = 0; i < nx; i++)
-          for (j = 0; j < ny; j++)
-             ScreenAdd(1, VRoot.scr, i * VRoot.w / nx, j * VRoot.h / ny,
-                       VRoot.w / nx, VRoot.h / ny);
+       sscanf(p, "%u %u\n", &nx, &ny);
+       ScreenSplit(nx, ny);
      }
 }
 
===================================================================
RCS file: /cvs/e/e16/e/src/menus.c,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -3 -r1.288 -r1.289
--- menus.c     29 Sep 2007 16:37:04 -0000      1.288
+++ menus.c     29 Sep 2007 19:13:21 -0000      1.289
@@ -318,8 +318,8 @@
             int                 x_origin;
             int                 y_origin;
 
-            head_num =
-               GetPointerScreenGeometry(&x_origin, &y_origin, &width, &height);
+            head_num = ScreenGetGeometryByPointer(&x_origin, &y_origin,
+                                                  &width, &height);
 
             if (wx > x_origin + width - mw - b->border.right)
                wx = x_origin + width - mw - b->border.right;
===================================================================
RCS file: /cvs/e/e16/e/src/screen.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- screen.c    18 May 2007 08:25:06 -0000      1.25
+++ screen.c    29 Sep 2007 19:13:21 -0000      1.26
@@ -61,6 +61,8 @@
 void
 ScreenInit(void)
 {
+   n_screens = 0;              /* Causes reconfiguration */
+
 #ifdef HAVE_XINERAMA
    XineramaScreenInfo *screens = NULL;
    int                 num_screens = 0;
@@ -80,6 +82,22 @@
 }
 
 void
+ScreenSplit(unsigned int nx, unsigned int ny)
+{
+   unsigned int        i, j;
+
+   if (nx > 8 || ny > 8)       /* At least some limit */
+      return;
+
+   ScreenInit();               /* Reset screen configuration */
+
+   for (i = 0; i < nx; i++)
+      for (j = 0; j < ny; j++)
+        ScreenAdd(1, VRoot.scr, i * VRoot.w / nx, j * VRoot.h / ny,
+                  VRoot.w / nx, VRoot.h / ny);
+}
+
+void
 ScreenShowInfo(const char *prm __UNUSED__)
 {
    int                 i;
@@ -126,13 +144,41 @@
      }
 }
 
+void
+ScreenGetGeometryByHead(int head, int *px, int *py, int *pw, int *ph)
+{
+   EScreen            *ps;
+   int                 x, y, w, h;
+
+   if (head > 0 && head < n_screens)
+     {
+       ps = p_screens + head;
+       x = ps->x;
+       y = ps->y;
+       w = ps->w;
+       h = ps->h;
+     }
+   else
+     {
+       x = 0;
+       y = 0;
+       w = VRoot.w;
+       h = VRoot.h;
+     }
+
+   *px = x;
+   *py = y;
+   *pw = w;
+   *ph = h;
+}
+
 int
 ScreenGetGeometry(int xi, int yi, int *px, int *py, int *pw, int *ph)
 {
-   int                 i, dx, dy, x, y, w, h, dist, ix;
+   int                 i, dx, dy, dist, head;
    EScreen            *ps;
 
-   ix = -1;
+   head = 0;
    dist = 2147483647;
 
    if (n_screens > 1)
@@ -147,38 +193,13 @@
             if (dx >= dist)
                continue;
             dist = dx;
-            ix = i;
+            head = 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)
-      *py = y;
-   if (pw)
-      *pw = w;
-   if (ph)
-      *ph = h;
+   ScreenGetGeometryByHead(head, px, py, pw, ph);
 
-   return ix;
+   return head;
 }
 
 static void
@@ -238,7 +259,7 @@
 }
 
 int
-GetPointerScreenGeometry(int *px, int *py, int *pw, int *ph)
+ScreenGetGeometryByPointer(int *px, int *py, int *pw, int *ph)
 {
    int                 pointer_x, pointer_y;
 
@@ -248,7 +269,7 @@
 }
 
 int
-GetPointerScreenAvailableArea(int *px, int *py, int *pw, int *ph)
+ScreenGetAvailableAreaByPointer(int *px, int *py, int *pw, int *ph)
 {
    int                 pointer_x, pointer_y;
 
===================================================================
RCS file: /cvs/e/e16/e/src/screen.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- screen.h    13 Jan 2007 19:14:28 -0000      1.2
+++ screen.h    29 Sep 2007 19:13:21 -0000      1.3
@@ -28,14 +28,17 @@
 void                ScreenInit(void);
 void                ScreenAdd(int type, int head, int x, int y, unsigned int w,
                              unsigned int h);
+void                ScreenSplit(unsigned int nx, unsigned int ny);
 void                ScreenShowInfo(const char *prm);
 int                 ScreenGetGeometry(int x, int y, int *px, int *py,
                                      int *pw, int *ph);
+void                ScreenGetGeometryByHead(int head, int *px, int *py,
+                                           int *pw, int *ph);
 int                 ScreenGetAvailableArea(int x, int y, int *px, int *py,
                                           int *pw, int *ph);
-int                 GetPointerScreenGeometry(int *px, int *py,
-                                            int *pw, int *ph);
-int                 GetPointerScreenAvailableArea(int *px, int *py,
-                                                 int *pw, int *ph);
+int                 ScreenGetGeometryByPointer(int *px, int *py,
+                                              int *pw, int *ph);
+int                 ScreenGetAvailableAreaByPointer(int *px, int *py,
+                                                   int *pw, int *ph);
 
 #endif /* _SCREEN_H_ */
===================================================================
RCS file: /cvs/e/e16/e/src/warp.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -3 -r1.107 -r1.108
--- warp.c      10 Sep 2007 20:26:53 -0000      1.107
+++ warp.c      29 Sep 2007 19:13:21 -0000      1.108
@@ -164,7 +164,7 @@
    /* Reset shape */
    EShapeCombineMask(EoGetWin(fw), ShapeBounding, 0, 0, None, ShapeSet);
 
-   GetPointerScreenAvailableArea(&x, &y, &ww, &hh);
+   ScreenGetAvailableAreaByPointer(&x, &y, &ww, &hh);
    x += (ww - w) / 2;
    y += (hh - h * warplist_num) / 2;
    EoMoveResize(fw, x, y, w, h * warplist_num);



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to