[Xfce4-commits] [xfce/xfwm4] 02/02: On canceled move, restore all maximizations states

noreply at xfce.org noreply at xfce.org
Sun Dec 28 21:17:13 CET 2014


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 55e71e890fda9df9cf73b6adade19325c1d76516
Author: Peter de Ridder <cavalier at the-cavalry.org>
Date:   Mon Dec 22 14:58:45 2014 +0100

    On canceled move, restore all maximizations states
---
 src/client.h     |    6 +++---
 src/moveresize.c |   17 ++++++++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/client.h b/src/client.h
index dd48d42..0b57c8f 100644
--- a/src/client.h
+++ b/src/client.h
@@ -203,9 +203,9 @@
 #define OPACITY_INACTIVE                (1<<2)
 
 /* Convenient macros */
-#define FLAG_TEST(flag,bits)                   (flag & (bits))
-#define FLAG_TEST_ALL(flag,bits)               ((flag & (bits)) == (bits))
-#define FLAG_TEST_AND_NOT(flag,bits1,bits2)    ((flag & (bits1 | bits2)) == (bits1))
+#define FLAG_TEST(flag,bits)                   ((flag) & (bits))
+#define FLAG_TEST_ALL(flag,bits)               (((flag) & (bits)) == (bits))
+#define FLAG_TEST_AND_NOT(flag,bits1,bits2)    (((flag) & ((bits1) | (bits2))) == (bits1))
 #define FLAG_SET(flag,bits)                    (flag |= (bits))
 #define FLAG_UNSET(flag,bits)                  (flag &= ~(bits))
 #define FLAG_TOGGLE(flag,bits)                 (flag ^= (bits))
diff --git a/src/moveresize.c b/src/moveresize.c
index 0067743..384dc37 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -69,6 +69,7 @@ struct _MoveResizeData
     guint button;
     gint cancel_x, cancel_y;
     gint cancel_w, cancel_h;
+    unsigned long cancel_flags;
     guint cancel_workspace;
     gint mx, my;
     gint px, py; /* pointer relative position */
@@ -830,6 +831,7 @@ clientMoveEventFilter (XEvent * xevent, gpointer data)
     gboolean moving;
     XWindowChanges wc;
     int prev_x, prev_y;
+    unsigned long cancel_maximize_flags;
 
     TRACE ("entering clientMoveEventFilter");
 
@@ -892,6 +894,9 @@ clientMoveEventFilter (XEvent * xevent, gpointer data)
 
             c->x = passdata->cancel_x;
             c->y = passdata->cancel_y;
+            /* Restore the width height to correct the outline */
+            c->width = passdata->cancel_w;
+            c->height = passdata->cancel_h;
 
             if (screen_info->params->box_move)
             {
@@ -907,10 +912,12 @@ clientMoveEventFilter (XEvent * xevent, gpointer data)
             {
                 workspaceSwitch (screen_info, passdata->cancel_workspace, c, FALSE, xevent->xkey.time);
             }
-            if (toggled_maximize)
+            cancel_maximize_flags = passdata->cancel_flags & CLIENT_FLAG_MAXIMIZED;
+            if (!FLAG_TEST_AND_NOT(c->flags, cancel_maximize_flags, CLIENT_FLAG_MAXIMIZED))
             {
-                toggled_maximize = FALSE;
-                if (clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED, FALSE))
+                /* Toggle maximize on the differences between the current state and the canceled state */
+                cancel_maximize_flags ^= c->flags & CLIENT_FLAG_MAXIMIZED;
+                if (clientToggleMaximized (c, cancel_maximize_flags, FALSE))
                 {
                     configure_flags = CFG_FORCE_REDRAW;
                     passdata->move_resized = TRUE;
@@ -997,6 +1004,7 @@ clientMoveEventFilter (XEvent * xevent, gpointer data)
         c->y = passdata->oy + (xevent->xmotion.y_root - passdata->my);
 
         clientSnapPosition (c, prev_x, prev_y);
+        /* This allows for moving fullscreen windows between monitors */
         if (screen_info->params->restore_on_move && toggled_maximize)
         {
             if ((clientConstrainPos (c, FALSE) & CLIENT_CONSTRAINED_TOP) &&
@@ -1102,6 +1110,9 @@ clientMove (Client * c, XEvent * ev)
     passdata.c = c;
     passdata.cancel_x = passdata.ox = c->x;
     passdata.cancel_y = passdata.oy = c->y;
+    passdata.cancel_w = c->width;
+    passdata.cancel_h = c->height;
+    passdata.cancel_flags = c->flags;
     passdata.cancel_workspace = c->win_workspace;
     passdata.use_keys = FALSE;
     passdata.grab = FALSE;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list