Author: olivier
Date: 2008-05-17 16:02:21 +0000 (Sat, 17 May 2008)
New Revision: 26967

Modified:
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/client.h
   xfwm4/trunk/src/events.c
Log:
Take gravity bit into account in configure resize only requests to comply with 
standard (bug #3634)

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c    2008-05-17 08:22:17 UTC (rev 26966)
+++ xfwm4/trunk/src/client.c    2008-05-17 16:02:21 UTC (rev 26967)
@@ -429,6 +429,83 @@
     *y = *y + (dy * mode);
 }
 
+void
+clientAdjustCoordGravity (Client * c, unsigned long *mask, XWindowChanges *wc)
+{
+    int tx, ty, dw, dh;
+
+    g_return_if_fail (c != NULL);
+    TRACE ("entering clientCoordGravitate");
+
+    tx = wc->x;
+    ty = wc->y;
+    clientCoordGravitate (c, APPLY, &tx, &ty);
+
+    switch (c->gravity)
+    {
+        case CenterGravity:
+            dw = (c->width  - wc->width)  / 2;
+            dh = (c->height - wc->height) / 2;
+            break;
+        case NorthGravity:
+            dw = (c->width - wc->width) / 2;
+            dh = 0;
+            break;
+        case SouthGravity:
+            dw = (c->width  - wc->width) / 2;
+            dh = (c->height - wc->height);
+            break;
+        case EastGravity:
+            dw = (c->width  - wc->width);
+            dh = (c->height - wc->height) / 2;
+            break;
+        case WestGravity:
+            dw = 0;
+            dh = (c->height - wc->height) / 2;
+            break;
+        case NorthWestGravity:
+            dw = 0;
+            dh = 0;
+            break;
+        case NorthEastGravity:
+            dw = (c->width - wc->width);
+            dh = 0;
+            break;
+        case SouthWestGravity:
+            dw = 0;
+            dh = (c->height - wc->height);
+            break;
+        case SouthEastGravity:
+            dw = (c->width  - wc->width);
+            dh = (c->height - wc->height);
+            break;
+        default:
+            dw = 0;
+            dh = 0;
+            break;
+    }
+
+    if (*mask & CWX)
+    {
+        wc->x = tx;
+    }
+    else if (*mask & CWWidth)
+    {
+        wc->x = c->x + dw;
+        *mask |= CWX;
+    }
+
+    if (*mask & CWY)
+    {
+        wc->y = ty;
+    }
+    else if (*mask & CWHeight)
+    {
+        wc->y = c->y + dh;
+        *mask |= CWY;
+    }
+}
+
 static void
 clientComputeWidth (Client * c, int *w)
 {

Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h    2008-05-17 08:22:17 UTC (rev 26966)
+++ xfwm4/trunk/src/client.h    2008-05-17 16:02:21 UTC (rev 26967)
@@ -323,6 +323,9 @@
                                                                  int,
                                                                  int *,
                                                                  int *);
+void                     clientAdjustCoordGravity               (Client *,
+                                                                 unsigned long 
*,
+                                                                 
XWindowChanges *);
 void                     clientConfigure                        (Client *,
                                                                  
XWindowChanges *,
                                                                  unsigned long,

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c    2008-05-17 08:22:17 UTC (rev 26966)
+++ xfwm4/trunk/src/events.c    2008-05-17 16:02:21 UTC (rev 26967)
@@ -1380,7 +1380,7 @@
             /* Ignore stacking request for DESKTOP windows */
             ev->value_mask &= ~(CWSibling | CWStackMode);
         }
-        clientCoordGravitate (c, APPLY, &wc.x, &wc.y);
+        clientAdjustCoordGravity (c, &ev->value_mask, &wc);
 
         if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
         {

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to