Fix handling of new windows with WM_STATE_FULLSCREEN
Patch status: superseded
Patch by jj
Long description:
If the currently focused window is in fullscreen mode, and a new window is opened with WM_STATE_FULLSCREEN set, the new window now becomes the new fullscreen window and gains focus.
To apply this patch, use:
curl http://cr.i3wm.org/patch/218/raw.patch | git am
b/src/manage.c
16 |
@@ -321,11 +321,32 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki |
17 |
x_set_name(nc, name); |
18 |
free(name); |
19 |
|
20 |
+ /* set floating if necessary */ |
21 |
+ bool want_floating = false; |
22 |
+ if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DIALOG) || |
23 |
+ xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_UTILITY) || |
24 |
+ xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_TOOLBAR) || |
25 |
+ xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_SPLASH)) { |
26 |
+ LOG("This window is a dialog window, setting floating\n"); |
27 |
+ want_floating = true; |
28 |
+ } |
29 |
+ |
30 |
+ FREE(reply); |
31 |
+ |
32 |
+ /* handle fullscreen containers */ |
33 |
Con *ws = con_get_workspace(nc); |
34 |
Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL); |
35 |
if (fs == NULL) |
36 |
fs = con_get_fullscreen_con(croot, CF_GLOBAL); |
37 |
|
38 |
+ reply = xcb_get_property_reply(conn, state_cookie, NULL); |
39 |
+ if (xcb_reply_contains_atom(reply, A__NET_WM_STATE_FULLSCREEN)) { |
40 |
+ fs = NULL; |
41 |
+ con_toggle_fullscreen(nc, CF_OUTPUT); |
42 |
+ } |
43 |
+ |
44 |
+ FREE(reply); |
45 |
+ |
46 |
if (fs == NULL) { |
47 |
DLOG("Not in fullscreen mode, focusing\n"); |
48 |
if (!cwindow->dock) { |
49 |
@@ -356,18 +377,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki |
50 |
} |
51 |
} |
52 |
|
53 |
- /* set floating if necessary */ |
54 |
- bool want_floating = false; |
55 |
- if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DIALOG) || |
56 |
- xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_UTILITY) || |
57 |
- xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_TOOLBAR) || |
58 |
- xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_SPLASH)) { |
59 |
- LOG("This window is a dialog window, setting floating\n"); |
60 |
- want_floating = true; |
61 |
- } |
62 |
- |
63 |
- FREE(reply); |
64 |
- |
65 |
if (cwindow->transient_for != XCB_NONE || |
66 |
(cwindow->leader != XCB_NONE && |
67 |
cwindow->leader != cwindow->id && |
68 |
@@ -429,12 +438,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki |
69 |
xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); |
70 |
xcb_flush(conn); |
71 |
|
72 |
- reply = xcb_get_property_reply(conn, state_cookie, NULL); |
73 |
- if (xcb_reply_contains_atom(reply, A__NET_WM_STATE_FULLSCREEN)) |
74 |
- con_toggle_fullscreen(nc, CF_OUTPUT); |
75 |
- |
76 |
- FREE(reply); |
77 |
- |
78 |
/* Put the client inside the save set. Upon termination (whether killed or |
79 |
* normal exit does not matter) of the window manager, these clients will |
80 |
* be correctly reparented to their most closest living ancestor (= |