about summary refs log tree commit diff stats
path: root/util.h
diff options
context:
space:
mode:
authorStein <bakkeby@gmail.com>2022-08-01 11:42:44 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-08-02 18:04:56 +0200
commit786f6e2a6f8466ad94706781bc93bc6eb6e69512 (patch)
treea206ac62d6a5ec78730a1c17e57a85125a2bdbf1 /util.h
parente03248a4d5feaaacb130416be6e467a04de81f78 (diff)
downloaddwm-786f6e2a6f8466ad94706781bc93bc6eb6e69512.tar.gz
unmanage: stop listening for events for unmanaged windows
This is in particular to avoid flickering in dwm (and high CPU usage)
when hovering the mouse over a tabbed window that was previously
managed by dwm.

Consider the following two scenarios:

1)

We start tabbed (window 0xc000003), tabbed is managed by the
window manager.
We start st being embedded into tabbed.

$ st -w 0xc000003

What happens here is that:
   - tabbed gets a MapRequest for the st window
   - tabbed reparents the st window
   - tabbed will receive X events for the window

The window manager will have no awareness of the st window and the
X server will not send X events to the window manager relating to
the st window.

There is no flickering or any other issues relating to focus.

2)

We start tabbed (window 0xc000003), tabbed is managed by the
window manager.
We start st as normal (window 0xd400005).

What happens here is that:
   - the window manager gets a MapRequest for the st window
   - dwm manages the st window as a normal client
   - dwm will receive X events for the window

Now we use xdotool to trigger a reparenting of the st window into
tabbed.

$ xdotool windowreparent 0xd400005 0xc000003

What happens here is that:
   - tabbed gets a MapRequest for the st window
   - tabbed reparents the st window
   - the window manager gets an UnmapNotify
   - the window manager no longer manages the st window
   - both the window manager and tabbed will receive X events
     for the st window

In dwm move the mouse cursor over the tabbed window.

What happens now is that:
   - dwm will receive a FocusIn event for the tabbed window
   - dwm will set input focus for the tabbed window
   - tabbed will receive a FocusIn event for the main window
   - tabbed will give focus to the window on the currently selected
     tab
   - which again triggers a FocusIn event which dwm receives
   - dwm determines that the window that the FocusIn event is for
     (0xd400005) is not the currently selected client (tabbed)
   - dwm sets input focus for the tabbed window
   - this causes an infinite loop as long as the mouse cursor hovers
     the tabbed window, resulting in flickering and high CPU usage

The fix here is to tell the X server that we are no longer interested
in receiving events for this window when the window manager stops
managing the window.
Diffstat (limited to 'util.h')
0 files changed, 0 insertions, 0 deletions
he previous revision' href='/akkartik/mu/blame/090trace_browser.cc?h=hlt&id=95b2a140094697dec176167154f9b3b31c2ef70f'>^
3d8e5101 ^
3d8e5101 ^

bf458036 ^
3d8e5101 ^
b24eb476 ^
293dbd7e ^
3d8e5101 ^

4243d710 ^

e02d7e98 ^
341239c9 ^

4243d710 ^




b24eb476 ^
4243d710 ^
b1ce29dd ^
1725a858 ^
22d1a275 ^

b1ce29dd ^
1725a858 ^
22d1a275 ^

9463d417 ^
1725a858 ^
9463d417 ^


1725a858 ^
9463d417 ^


1725a858 ^
9463d417 ^

b1ce29dd ^
1725a858 ^
9463d417 ^
f22250a1 ^
9463d417 ^


b1ce29dd ^
1725a858 ^
63030ea7 ^
9463d417 ^

f3760b0f ^
9463d417 ^
9463d417 ^
4d03f69c ^
9463d417 ^

63030ea7 ^





f3760b0f ^
63030ea7 ^






293dbd7e ^
1725a858 ^
f3760b0f ^
b24eb476 ^

293dbd7e ^


f3760b0f ^
293dbd7e ^
293dbd7e ^


b24eb476 ^
293dbd7e ^



293dbd7e ^


293dbd7e ^

12f93e4a ^
1725a858 ^
f3760b0f ^
b24eb476 ^

ff1f5976 ^

12f93e4a ^
f3760b0f ^
12f93e4a ^
ff1f5976 ^
12f93e4a ^
b24eb476 ^
12f93e4a ^
ff1f5976 ^

12f93e4a ^


4243d710 ^



341239c9 ^

b24eb476 ^
341239c9 ^
4243d710 ^

f3760b0f ^
4243d710 ^



f22250a1 ^
341239c9 ^




b24eb476 ^
341239c9 ^
f3760b0f ^
f22250a1 ^
4243d710 ^

1164aefc ^
b24eb476 ^
1164aefc ^

777aae2e ^
1164aefc ^

4243d710 ^

4243d710 ^
22d1a275 ^
4243d710 ^







b24eb476 ^
f3760b0f ^

f22250a1 ^
1164aefc ^
f22250a1 ^
1164aefc ^

4243d710 ^
b24eb476 ^
1164aefc ^
4243d710 ^
1164aefc ^
4243d710 ^
1164aefc ^



4243d710 ^

10a3b8cc ^
4243d710 ^

8f249677 ^








bf458036 ^







8f249677 ^








bf458036 ^
8f249677 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249