[Xfce4-commits] [xfce/xfwm4] 01/01: moveresize: Cancel move/resize if client is gone
noreply at xfce.org
noreply at xfce.org
Wed Mar 8 07:31:21 CET 2017
This is an automated email from the git hooks/post-receive script.
olivier pushed a commit to branch master
in repository xfce/xfwm4.
commit 5155c86cfc198946fdf9d55f88b187a58b0340fc
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.
---
src/moveresize.c | 70 +++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 49 insertions(+), 21 deletions(-)
diff --git a/src/moveresize.c b/src/moveresize.c
index b0f4108..026cc0d 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -74,6 +74,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;
@@ -1123,6 +1124,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)
{
@@ -1186,6 +1193,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;
@@ -1259,26 +1267,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);
@@ -1308,6 +1307,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));
@@ -1656,6 +1671,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)
{
@@ -1728,6 +1749,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;
@@ -1801,20 +1823,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);
@@ -1842,6 +1860,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