[Xfce4-commits] [xfce/xfwm4] 02/02: moveresize: Cancel move/resize if client is gone

noreply at xfce.org noreply at xfce.org
Wed Mar 8 07:31:46 CET 2017


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

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

commit e5cc883ea0d7b3836ed259b168cdcd8cea598634
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Mon Mar 6 22:15:21 2017 +0100

    moveresize: Cancel move/resize if client is gone
    
    Bug: 13344
    
    If a window is unmapped while the user is moving or resizing it, we
    would cancel the move but swallow the event, which would leave the
    window frame on screen as the main event handle would not get the
    unmap notify.
    
    Mark the client as gone when detected in the move/resize event loop,
    let the event get through to the main event handler that will free the
    client and shortcut the move/resize operation if the client is marked
    as gone.
    
    (cherry picked from commit 5155c86cfc198946fdf9d55f88b187a58b0340fc)
---
 src/moveresize.c | 70 +++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 49 insertions(+), 21 deletions(-)

diff --git a/src/moveresize.c b/src/moveresize.c
index 411520d..1c07e8e 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -73,6 +73,7 @@ struct _MoveResizeData
     gboolean is_transient;
     gboolean move_resized;
     gboolean released;
+    gboolean client_gone;
     guint button;
     gint cancel_x, cancel_y;
     gint cancel_w, cancel_h;
@@ -1122,6 +1123,12 @@ clientMoveEventFilter (XEvent * xevent, gpointer data)
     else if ((xevent->type == UnmapNotify) && (xevent->xunmap.window == c->window))
     {
         moving = FALSE;
+        status = EVENT_FILTER_CONTINUE;
+        passdata->client_gone = TRUE;
+        if (use_xor_move(screen_info))
+        {
+            clientDrawOutline (c);
+        }
     }
     else if (xevent->type == EnterNotify)
     {
@@ -1185,6 +1192,7 @@ clientMove (Client * c, XEvent * ev)
     passdata.use_keys = FALSE;
     passdata.grab = FALSE;
     passdata.released = FALSE;
+    passdata.client_gone = FALSE;
     passdata.button = AnyButton;
     passdata.is_transient = clientIsValidTransientOrModal (c);
     passdata.move_resized = FALSE;
@@ -1258,26 +1266,17 @@ clientMove (Client * c, XEvent * ev)
     gtk_main ();
     eventFilterPop (display_info->xfilter);
     TRACE ("leaving move loop");
-    FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING);
-
-    /* Put back the sidewalks as they ought to be */
-    placeSidewalks (screen_info, screen_info->params->wrap_workspaces);
-
-#ifdef SHOW_POSITION
-    if (passdata.poswin)
+    if (passdata.client_gone)
     {
-        poswinDestroy (passdata.poswin);
+        goto move_cleanup;
     }
-#endif /* SHOW_POSITION */
+    FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING);
+
     if (passdata.grab && screen_info->params->box_move)
     {
         clientDrawOutline (c);
     }
 
-    if (passdata.wireframe)
-    {
-        wireframeDelete (passdata.wireframe);
-    }
     /* Set window opacity to its original value */
     clientSetOpacity (c, c->opacity, OPACITY_MOVE, 0);
 
@@ -1307,6 +1306,22 @@ clientMove (Client * c, XEvent * ev)
         eventFilterPop (display_info->xfilter);
     }
 
+move_cleanup:
+    /* Put back the sidewalks as they ought to be */
+    placeSidewalks (screen_info, screen_info->params->wrap_workspaces);
+
+#ifdef SHOW_POSITION
+    if (passdata.poswin)
+    {
+        poswinDestroy (passdata.poswin);
+    }
+#endif /* SHOW_POSITION */
+
+    if (passdata.wireframe)
+    {
+        wireframeDelete (passdata.wireframe);
+    }
+
     myScreenUngrabKeyboard (screen_info, myDisplayGetCurrentTime (display_info));
     myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
 
@@ -1655,6 +1670,12 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
     else if ((xevent->type == UnmapNotify) && (xevent->xunmap.window == c->window))
     {
         resizing = FALSE;
+        status = EVENT_FILTER_CONTINUE;
+        passdata->client_gone = TRUE;
+        if (use_xor_resize(screen_info))
+        {
+            clientDrawOutline (c);
+        }
     }
     else if (xevent->type == EnterNotify)
     {
@@ -1727,6 +1748,7 @@ clientResize (Client * c, int handle, XEvent * ev)
     passdata.use_keys = FALSE;
     passdata.grab = FALSE;
     passdata.released = FALSE;
+    passdata.client_gone = FALSE;
     passdata.button = AnyButton;
     passdata.handle = handle;
     passdata.wireframe = NULL;
@@ -1800,20 +1822,16 @@ clientResize (Client * c, int handle, XEvent * ev)
     gtk_main ();
     eventFilterPop (display_info->xfilter);
     TRACE ("leaving resize loop");
-    FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING);
-
-    if (passdata.poswin)
+    if (passdata.client_gone)
     {
-        poswinDestroy (passdata.poswin);
+        goto resize_cleanup;
     }
+    FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING);
+
     if (passdata.grab && screen_info->params->box_resize)
     {
         clientDrawOutline (c);
     }
-    if (passdata.wireframe)
-    {
-        wireframeDelete (passdata.wireframe);
-    }
 
     /* Set window opacity to its original value */
     clientSetOpacity (c, c->opacity, OPACITY_RESIZE, 0);
@@ -1841,6 +1859,16 @@ clientResize (Client * c, int handle, XEvent * ev)
         eventFilterPop (display_info->xfilter);
     }
 
+resize_cleanup:
+    if (passdata.poswin)
+    {
+        poswinDestroy (passdata.poswin);
+    }
+    if (passdata.wireframe)
+    {
+        wireframeDelete (passdata.wireframe);
+    }
+
     myScreenUngrabKeyboard (screen_info, myDisplayGetCurrentTime (display_info));
     myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
 

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


More information about the Xfce4-commits mailing list