|
1 |
From 71d37e110d78d49a1476235aaa61e8614ca761e1 Mon Sep 17 00:00:00 2001 |
|
2 |
From: Olivier Fourdan <fourdan@xfce.org> |
|
3 |
Date: Mon, 18 May 2015 22:18:48 +0200 |
|
4 |
Subject: [PATCH] Only check for known buttons in _NET_WM_MOVERESIZE |
|
5 |
|
|
6 |
For _NET_WM_MOVERESIZE requests, if the given button does not match any |
|
7 |
available physical button, we would wait for that (impossible) button |
|
8 |
combination to be released. |
|
9 |
|
|
10 |
Check that the given button is one of the well known button or just wait |
|
11 |
for any button release otherwise. |
|
12 |
|
|
13 |
That fixes an issue with KDE apps where clicking on the menu bar to move |
|
14 |
the window would hang forever after the mouse button is depressed. |
|
15 |
|
|
16 |
Signed-off-by: Olivier Fourdan <fourdan@xfce.org> |
|
17 |
--- |
|
18 |
src/moveresize.c | 28 ++++++++++++++++++++-------- |
|
19 |
src/netwm.c | 22 +++------------------- |
|
20 |
2 files changed, 23 insertions(+), 27 deletions(-) |
|
21 |
|
|
22 |
diff --git a/src/moveresize.c b/src/moveresize.c |
|
23 |
index c605b17..411520d 100644 |
|
24 |
--- a/src/moveresize.c |
|
25 |
+++ b/src/moveresize.c |
|
26 |
@@ -618,11 +618,19 @@ static eventFilterStatus |
|
27 |
clientButtonReleaseFilter (XEvent * xevent, gpointer data) |
|
28 |
{ |
|
29 |
MoveResizeData *passdata = (MoveResizeData *) data; |
|
30 |
+ ScreenInfo *screen_info; |
|
31 |
+ Client *c; |
|
32 |
+ |
|
33 |
+ c = passdata->c; |
|
34 |
+ screen_info = c->screen_info; |
|
35 |
|
|
36 |
TRACE ("entering clientButtonReleaseFilter"); |
|
37 |
|
|
38 |
- if ((xevent->type == ButtonRelease) && |
|
39 |
- (xevent->xbutton.button == passdata->button)) |
|
40 |
+ if ((xevent->type == ButtonRelease && |
|
41 |
+ (passdata->button == AnyButton || |
|
42 |
+ passdata->button == xevent->xbutton.button)) || |
|
43 |
+ (xevent->type == KeyPress && |
|
44 |
+ xevent->xkey.keycode == screen_info->params->keys[KEY_CANCEL].keycode)) |
|
45 |
{ |
|
46 |
gtk_main_quit (); |
|
47 |
return EVENT_FILTER_STOP; |
|
48 |
@@ -986,7 +994,9 @@ clientMoveEventFilter (XEvent * xevent, gpointer data) |
|
49 |
else if (xevent->type == ButtonRelease) |
|
50 |
{ |
|
51 |
moving = FALSE; |
|
52 |
- passdata->released = passdata->use_keys || (xevent->xbutton.button == passdata->button); |
|
53 |
+ passdata->released = (passdata->use_keys || |
|
54 |
+ passdata->button == AnyButton || |
|
55 |
+ passdata->button == xevent->xbutton.button); |
|
56 |
} |
|
57 |
else if (xevent->type == MotionNotify) |
|
58 |
{ |
|
59 |
@@ -1175,7 +1185,7 @@ clientMove (Client * c, XEvent * ev) |
|
60 |
passdata.use_keys = FALSE; |
|
61 |
passdata.grab = FALSE; |
|
62 |
passdata.released = FALSE; |
|
63 |
- passdata.button = 0; |
|
64 |
+ passdata.button = AnyButton; |
|
65 |
passdata.is_transient = clientIsValidTransientOrModal (c); |
|
66 |
passdata.move_resized = FALSE; |
|
67 |
passdata.wireframe = NULL; |
|
68 |
@@ -1287,7 +1297,7 @@ clientMove (Client * c, XEvent * ev) |
|
69 |
} |
|
70 |
clientConfigure (c, &wc, changes, passdata.configure_flags); |
|
71 |
|
|
72 |
- if (!passdata.released) |
|
73 |
+ if (passdata.button != AnyButton && !passdata.released) |
|
74 |
{ |
|
75 |
/* If this is a drag-move, wait for the button to be released. |
|
76 |
* If we don't, we might get release events in the wrong place. |
|
77 |
@@ -1638,7 +1648,9 @@ clientResizeEventFilter (XEvent * xevent, gpointer data) |
|
78 |
else if (xevent->type == ButtonRelease) |
|
79 |
{ |
|
80 |
resizing = FALSE; |
|
81 |
- passdata->released = (passdata->use_keys || (xevent->xbutton.button == passdata->button)); |
|
82 |
+ passdata->released = (passdata->use_keys || |
|
83 |
+ passdata->button == AnyButton || |
|
84 |
+ passdata->button == xevent->xbutton.button); |
|
85 |
} |
|
86 |
else if ((xevent->type == UnmapNotify) && (xevent->xunmap.window == c->window)) |
|
87 |
{ |
|
88 |
@@ -1715,7 +1727,7 @@ clientResize (Client * c, int handle, XEvent * ev) |
|
89 |
passdata.use_keys = FALSE; |
|
90 |
passdata.grab = FALSE; |
|
91 |
passdata.released = FALSE; |
|
92 |
- passdata.button = 0; |
|
93 |
+ passdata.button = AnyButton; |
|
94 |
passdata.handle = handle; |
|
95 |
passdata.wireframe = NULL; |
|
96 |
w_orig = c->width; |
|
97 |
@@ -1819,7 +1831,7 @@ clientResize (Client * c, int handle, XEvent * ev) |
|
98 |
} |
|
99 |
clientReconfigure (c, NO_CFG_FLAG); |
|
100 |
|
|
101 |
- if (!passdata.released) |
|
102 |
+ if (passdata.button != AnyButton && !passdata.released) |
|
103 |
{ |
|
104 |
/* If this is a drag-resize, wait for the button to be released. |
|
105 |
* If we don't, we might get release events in the wrong place. |
|
106 |
diff --git a/src/netwm.c b/src/netwm.c |
|
107 |
index 93ff43f..ef3552c 100644 |
|
108 |
--- a/src/netwm.c |
|
109 |
+++ b/src/netwm.c |
|
110 |
@@ -613,26 +613,10 @@ clientNetMoveResize (Client * c, XClientMessageEvent * ev) |
|
111 |
button = (int) ev->data.l[3]; |
|
112 |
event = (XEvent *) ev; |
|
113 |
|
|
114 |
- if (button == 0) |
|
115 |
+ /* We don't deal with button > 7, in such a case we pretent it's just any button */ |
|
116 |
+ if (button > Button7) |
|
117 |
{ |
|
118 |
- button_mask = getMouseXY (screen_info, c->window, &dx, &dy); |
|
119 |
- if (button_mask & Button1Mask) |
|
120 |
- { |
|
121 |
- button = Button1; |
|
122 |
- } |
|
123 |
- else if (button_mask & Button2Mask) |
|
124 |
- { |
|
125 |
- button = Button2; |
|
126 |
- } |
|
127 |
- else if (button_mask & Button3Mask) |
|
128 |
- { |
|
129 |
- button = Button3; |
|
130 |
- } |
|
131 |
- else |
|
132 |
- { |
|
133 |
- /* Fallback */ |
|
134 |
- button = Button1; |
|
135 |
- } |
|
136 |
+ button = AnyButton; |
|
137 |
} |
|
138 |
|
|
139 |
corner = CORNER_BOTTOM_RIGHT; |
|
140 |
-- |
|
141 |
2.8.0.rc3 |
|
142 |
|