Fix handling of new windows with WM_STATE_FULLSCREEN
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.
This commit is contained in:
parent
3ba8642efd
commit
ee04f8bfda
15
src/manage.c
15
src/manage.c
|
@ -321,11 +321,20 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|||
x_set_name(nc, name);
|
||||
free(name);
|
||||
|
||||
/* handle fullscreen containers */
|
||||
Con *ws = con_get_workspace(nc);
|
||||
Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL);
|
||||
if (fs == NULL)
|
||||
fs = con_get_fullscreen_con(croot, CF_GLOBAL);
|
||||
|
||||
xcb_get_property_reply_t *state_reply = xcb_get_property_reply(conn, state_cookie, NULL);
|
||||
if (xcb_reply_contains_atom(state_reply, A__NET_WM_STATE_FULLSCREEN)) {
|
||||
fs = NULL;
|
||||
con_toggle_fullscreen(nc, CF_OUTPUT);
|
||||
}
|
||||
|
||||
FREE(state_reply);
|
||||
|
||||
if (fs == NULL) {
|
||||
DLOG("Not in fullscreen mode, focusing\n");
|
||||
if (!cwindow->dock) {
|
||||
|
@ -429,12 +438,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|||
xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values);
|
||||
xcb_flush(conn);
|
||||
|
||||
reply = xcb_get_property_reply(conn, state_cookie, NULL);
|
||||
if (xcb_reply_contains_atom(reply, A__NET_WM_STATE_FULLSCREEN))
|
||||
con_toggle_fullscreen(nc, CF_OUTPUT);
|
||||
|
||||
FREE(reply);
|
||||
|
||||
/* Put the client inside the save set. Upon termination (whether killed or
|
||||
* normal exit does not matter) of the window manager, these clients will
|
||||
* be correctly reparented to their most closest living ancestor (=
|
||||
|
|
|
@ -214,4 +214,25 @@ sync_with_i3;
|
|||
# Verify that $swindow was the one that initially remained fullscreen.
|
||||
is(fullscreen_windows($tmp), 0, 'no fullscreen windows on first ws');
|
||||
|
||||
################################################################################
|
||||
# Verify that opening a window with _NET_WM_STATE_FULLSCREEN unfullscreens any
|
||||
# existing container on the workspace and fullscreens the newly opened window.
|
||||
################################################################################
|
||||
|
||||
$tmp = fresh_workspace;
|
||||
|
||||
$window = open_window();
|
||||
|
||||
cmd "fullscreen";
|
||||
|
||||
is(fullscreen_windows($tmp), 1, 'one fullscreen window on ws');
|
||||
is($x->input_focus, $window->id, 'fullscreen window focused');
|
||||
|
||||
$swindow = open_window({
|
||||
fullscreen => 1
|
||||
});
|
||||
|
||||
is(fullscreen_windows($tmp), 1, 'one fullscreen window on ws');
|
||||
is($x->input_focus, $swindow->id, 'fullscreen window focused');
|
||||
|
||||
done_testing;
|
||||
|
|
Loading…
Reference in New Issue