From 849e06f21e601d7f6e75ed2fb10d3861b03a9e54 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 8 Apr 2012 17:53:37 +0200 Subject: [PATCH] Replace the old fullscreen container when requesting fullscreen Fixes: #510 --- src/con.c | 9 +++++---- testcases/t/100-fullscreen.t | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/con.c b/src/con.c index 724961ff..c24a379f 100644 --- a/src/con.c +++ b/src/con.c @@ -520,10 +520,12 @@ void con_toggle_fullscreen(Con *con, int fullscreen_mode) { fullscreen = con_get_fullscreen_con(workspace, CF_OUTPUT); } if (fullscreen != NULL) { - LOG("Not entering fullscreen mode, container (%p/%s) " - "already is in fullscreen mode\n", + /* Disable fullscreen for the currently fullscreened + * container and enable it for the one the user wants + * to have in fullscreen mode. */ + LOG("Disabling fullscreen for (%p/%s) upon user request\n", fullscreen, fullscreen->name); - goto update_netwm_state; + fullscreen->fullscreen_mode = CF_NONE; } /* 2: enable fullscreen */ @@ -533,7 +535,6 @@ void con_toggle_fullscreen(Con *con, int fullscreen_mode) { con->fullscreen_mode = CF_NONE; } -update_netwm_state: DLOG("mode now: %d\n", con->fullscreen_mode); /* update _NET_WM_STATE if this container has a window */ diff --git a/testcases/t/100-fullscreen.t b/testcases/t/100-fullscreen.t index f8fc92a2..cee77132 100644 --- a/testcases/t/100-fullscreen.t +++ b/testcases/t/100-fullscreen.t @@ -104,9 +104,10 @@ ok(($wrect->{y} - $orect->{y}) < $threshold, 'y coordinate fullscreen'); ok(abs($wrect->{width} - $orect->{width}) < $threshold, 'width coordinate fullscreen'); ok(abs($wrect->{height} - $orect->{height}) < $threshold, 'height coordinate fullscreen'); -############################################################################### -# test if setting two windows in fullscreen mode at the same time does not work -############################################################################### +################################################################################ +# Verify that when one window wants to go into fullscreen mode, the old +# fullscreen window will be replaced. +################################################################################ $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30); my $swindow = open_window( @@ -130,7 +131,7 @@ is(fullscreen_windows(), 1, 'amount of fullscreen windows'); $window->fullscreen(0); sync_with_i3; -is(fullscreen_windows(), 0, 'amount of fullscreen windows'); +is(fullscreen_windows(), 1, 'amount of fullscreen windows'); ok($swindow->mapped, 'window mapped after other fullscreen ended'); -- 2.39.5