Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        ewin-ops.c ewins.c ewins.h ewmh.c hints.c icccm.c menus.c 
        snaps.c 


Log Message:
Fix various gravity issues.

===================================================================
RCS file: /cvs/e/e16/e/src/ewin-ops.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -3 -r1.128 -r1.129
--- ewin-ops.c  11 Jul 2008 18:55:23 -0000      1.128
+++ ewin-ops.c  11 Jul 2008 19:38:17 -0000      1.129
@@ -445,7 +445,7 @@
 void
 EwinMoveResizeWithGravity(EWin * ewin, int x, int y, int w, int h, int grav)
 {
-   EwinGetPosition(ewin, x, y, ewin->client.bw, grav, &x, &y);
+   EwinGetPosition(ewin, x, y, grav, &x, &y);
    doEwinMoveResize(ewin, NULL, x, y, w, h, MRF_MOVE | MRF_RESIZE);
 }
 
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.c,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -3 -r1.233 -r1.234
--- ewins.c     22 Jun 2008 22:26:00 -0000      1.233
+++ ewins.c     11 Jul 2008 19:38:17 -0000      1.234
@@ -154,7 +154,6 @@
    ewin->client.h = ewin->save_max.h = ewin->save_fs.h = xwa.height;
    ewin->client.bw = xwa.border_width;
    ewin->client.cmap = xwa.colormap;
-   ewin->client.grav = NorthWestGravity;
 
    if (EDebug(EDBUG_TYPE_SNAPS))
       Eprintf("Snap get attr  %#lx: %4d+%4d %4dx%4d: %s\n",
@@ -297,9 +296,11 @@
 EwinSetGeometry(EWin * ewin)
 {
    int                 x, y, l, r, t, b;
+   int                 grav;
 
-   EwinGetPosition(ewin, ewin->client.x, ewin->client.y, ewin->client.bw,
-                  ewin->client.grav, &x, &y);
+   grav = (ewin->state.identified) ? StaticGravity : ewin->icccm.grav;
+
+   EwinGetPosition(ewin, ewin->client.x, ewin->client.y, grav, &x, &y);
 
    l = ewin->border->border.left;
    r = ewin->border->border.right;
@@ -310,8 +311,6 @@
    ewin->client.y = y + t;
 
    EoMoveResize(ewin, x, y, ewin->client.w + l + r, ewin->client.h + t + b);
-
-   ewin->client.grav = NorthWestGravity;
 }
 
 static void
@@ -539,29 +538,32 @@
  * Derive frame window position from client window and border properties
  */
 void
-EwinGetPosition(const EWin * ewin, int x, int y, int bw, int grav,
-               int *px, int *py)
+EwinGetPosition(const EWin * ewin, int x, int y, int grav, int *px, int *py)
 {
-   int                 bd_lr, bd_tb;
+   int                 bw, bd_lr, bd_tb;
 
+   bw = ewin->client.bw;
    bd_lr = ewin->border->border.left + ewin->border->border.right;
    bd_tb = ewin->border->border.top + ewin->border->border.bottom;
 
+   if (grav == 0)
+      grav = ewin->icccm.grav;
+
    switch (grav)
      {
      case NorthWestGravity:
-     case SouthWestGravity:
      case WestGravity:
+     case SouthWestGravity:
        x -= bw;
        break;
-     case NorthEastGravity:
-     case EastGravity:
-     case SouthEastGravity:
-       x -= bd_lr;
-       break;
      case NorthGravity:
      case CenterGravity:
      case SouthGravity:
+       x -= bd_lr / 2;
+       break;
+     case NorthEastGravity:
+     case EastGravity:
+     case SouthEastGravity:
        x -= bd_lr - bw;
        break;
      case StaticGravity:
@@ -581,7 +583,7 @@
      case WestGravity:
      case CenterGravity:
      case EastGravity:
-       y -= bd_tb;
+       y -= bd_tb / 2;
        break;
      case SouthWestGravity:
      case SouthGravity:
@@ -1268,8 +1270,7 @@
        if (ev->xconfigurerequest.value_mask & (CWX | CWY))
          {
             /* Correct position taking gravity into account */
-            EwinGetPosition(ewin, x, y, ewin->client.bw, ewin->client.grav,
-                            &x, &y);
+            EwinGetPosition(ewin, x, y, 0, &x, &y);
          }
 
        Mode.move.check = 0;    /* Don't restrict client requests */
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- ewins.h     22 Jun 2008 22:23:24 -0000      1.88
+++ ewins.h     11 Jul 2008 19:38:17 -0000      1.89
@@ -75,7 +75,6 @@
    struct {
       Win                 win;
       int                 x, y, w, h, bw;
-      int                 grav;
       Colormap            cmap;
       long                event_mask;
    } client;
@@ -349,8 +348,8 @@
 EWin               *GetFocusEwin(void);
 EWin               *GetContextEwin(void);
 void                SetContextEwin(EWin * ewin);
-void                EwinGetPosition(const EWin * ewin, int x, int y, int bw,
-                                   int grav, int *px, int *py);
+void                EwinGetPosition(const EWin * ewin, int x, int y, int grav,
+                                   int *px, int *py);
 void                EwinUpdateShapeInfo(EWin * ewin);
 void                EwinPropagateShapes(EWin * ewin);
 void                EwinStateUpdate(EWin * ewin);
===================================================================
RCS file: /cvs/e/e16/e/src/ewmh.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -3 -r1.125 -r1.126
--- ewmh.c      22 Jun 2008 22:23:24 -0000      1.125
+++ ewmh.c      11 Jul 2008 19:38:17 -0000      1.126
@@ -998,9 +998,7 @@
        int                 flags, grav, x, y, w, h;
 
        flags = ev->data.l[0];
-       grav = flags & 0xf;
-       if (grav == 0)
-          grav = ewin->client.grav;
+       grav = flags & 0xf;     /* 0 means use client gravity */
        x = (flags & 0x0100) ? ev->data.l[1] : EoGetX(ewin);
        y = (flags & 0x0200) ? ev->data.l[2] : EoGetY(ewin);
        w = (flags & 0x0400) ? ev->data.l[3] : ewin->client.w;
===================================================================
RCS file: /cvs/e/e16/e/src/hints.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- hints.c     30 Mar 2008 12:13:15 -0000      1.90
+++ hints.c     11 Jul 2008 19:38:17 -0000      1.91
@@ -429,7 +429,6 @@
       return;
 
    ewin->state.identified = 1;
-   ewin->client.grav = StaticGravity;
    ewin->state.placed = 1;
 
    if (num < 2)
===================================================================
RCS file: /cvs/e/e16/e/src/icccm.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -3 -r1.147 -r1.148
--- icccm.c     5 Jun 2008 08:55:20 -0000       1.147
+++ icccm.c     11 Jul 2008 19:38:17 -0000      1.148
@@ -256,8 +256,6 @@
 
    ewin->props.no_resize_h = (wmin == wmax);
    ewin->props.no_resize_v = (hmin == hmax);
-
-   ewin->icccm.grav = NorthWestGravity;
 }
 
 void
@@ -407,12 +405,6 @@
          {
             if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
               {
-                 if (hint.flags & PWinGravity)
-                    ewin->icccm.grav = hint.win_gravity;
-                 else
-                    ewin->icccm.grav = NorthWestGravity;
-                 ewin->client.grav = ewin->icccm.grav;
-
                  if ((hint.flags & PPosition) && (!EoIsSticky(ewin)))
                    {
                       Desk               *dsk;
@@ -523,6 +515,11 @@
           ewin->icccm.width_max = ewin->icccm.base_w;
        if (ewin->icccm.height_max < ewin->icccm.base_h)
           ewin->icccm.height_max = ewin->icccm.base_h;
+
+       if (hint.flags & PWinGravity)
+          ewin->icccm.grav = hint.win_gravity;
+       else
+          ewin->icccm.grav = NorthWestGravity;
      }
 
    ewin->props.no_resize_h = (ewin->icccm.width_min == ewin->icccm.width_max);
===================================================================
RCS file: /cvs/e/e16/e/src/menus.c,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -3 -r1.303 -r1.304
--- menus.c     22 Jun 2008 13:34:42 -0000      1.303
+++ menus.c     11 Jul 2008 19:38:18 -0000      1.304
@@ -204,10 +204,10 @@
    ewin->props.skip_winlist = 1;
    ewin->props.ignorearrange = 1;
    EwinInhSetWM(ewin, focus, 1);
-   ewin->client.grav = StaticGravity;
 
    ICCCM_SetSizeConstraints(ewin, m->w, m->h, m->w, m->h, 0, 0, 1, 1,
                            0.0, 65535.0);
+   ewin->icccm.grav = StaticGravity;
 
    EoSetLayer(ewin, 12);
    ewin->ewmh.opacity = OpacityFromPercent(Conf.opacity.menus);
===================================================================
RCS file: /cvs/e/e16/e/src/snaps.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -3 -r1.141 -r1.142
--- snaps.c     22 Jun 2008 22:54:49 -0000      1.141
+++ snaps.c     11 Jul 2008 19:38:18 -0000      1.142
@@ -1445,7 +1445,6 @@
        ewin->state.placed = 1;
        ewin->client.x = sn->x;
        ewin->client.y = sn->y;
-       ewin->client.grav = NorthWestGravity;
 #if 0                          /* No, do later in EwinDetermineArea() */
        ewin->area_x = sn->area_x;
        ewin->area_y = sn->area_y;
@@ -1456,8 +1455,6 @@
             ewin->client.x += ((sn->area_x - ax) * WinGetW(VROOT));
             ewin->client.y += ((sn->area_y - ay) * WinGetH(VROOT));
          }
-       EMoveResizeWindow(EwinGetClientWin(ewin), ewin->client.x,
-                         ewin->client.y, ewin->client.w, ewin->client.h);
      }
 
    if (use_flags & SNAP_USE_LAYER)



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to