scratchpad_move: un-fullscreen correct container

Fixes https://github.com/i3/i3/issues/2857#issuecomment-496264445
This commit is contained in:
Orestis Floros 2019-10-17 18:14:21 +03:00
parent 879fd6c08b
commit 95d4ce3ed6
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
2 changed files with 36 additions and 11 deletions

View File

@ -40,9 +40,7 @@ void scratchpad_move(Con *con) {
/* If the current con is in fullscreen mode, we need to disable that,
* as a scratchpad window should never be in fullscreen mode */
if (focused && focused->type != CT_WORKSPACE && focused->fullscreen_mode != CF_NONE) {
con_toggle_fullscreen(focused, CF_OUTPUT);
}
con_disable_fullscreen(con);
/* 1: Ensure the window or any parent is floating. From now on, we deal
* with the CT_FLOATING_CON. We use automatic == false because the user

View File

@ -21,9 +21,10 @@ use i3test;
my $tmp = fresh_workspace;
##########################################################################################
# map two windows in one container, fullscreen one of them and then move it to scratchpad
##########################################################################################
###############################################################################
# map two windows in one container, fullscreen one of them and then move it to
# scratchpad
###############################################################################
my $first_win = open_window;
my $second_win = open_window;
@ -50,9 +51,10 @@ cmd 'floating toggle';
# see if no window is in fullscreen mode
is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after showing previously fullscreened scratchpad window');
########################################################################################
# move a window to scratchpad, focus parent container, make it fullscreen, focus a child
########################################################################################
###############################################################################
# move a window to scratchpad, focus parent container, make it fullscreen,
# focus a child
###############################################################################
# make layout tabbed
cmd 'layout tabbed';
@ -72,9 +74,9 @@ cmd 'focus child';
# see if the window really is in fullscreen mode
is_num_fullscreen($tmp, 1, 'amount of fullscreen windows after enabling fullscreen on parent');
##########################################################################
###############################################################################
# show a scratchpad window; no window should be in fullscreen mode anymore
##########################################################################
###############################################################################
# show the scratchpad window
cmd 'scratchpad show';
@ -82,4 +84,29 @@ cmd 'scratchpad show';
# see if no window is in fullscreen mode
is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
###############################################################################
# Moving window to scratchpad with command criteria does not unfullscreen
# currently focused container
# See https://github.com/i3/i3/issues/2857#issuecomment-496264445
###############################################################################
kill_all_windows;
$tmp = fresh_workspace;
$first_win = open_window;
$second_win = open_window;
cmd 'fullscreen';
cmd '[id=' . $first_win->id . '] move scratchpad';
is_num_fullscreen($tmp, 1, 'second window still fullscreen');
my $__i3_scratch = get_ws('__i3_scratch');
my @scratch_nodes = @{$__i3_scratch->{floating_nodes}};
is(scalar @scratch_nodes, 1, 'one window in scratchpad');
cmd '[id=' . $first_win->id . '] scratchpad show';
is_num_fullscreen($tmp, 0, 'second window not fullscreen');
$__i3_scratch = get_ws('__i3_scratch');
@scratch_nodes = @{$__i3_scratch->{floating_nodes}};
is(scalar @scratch_nodes, 0, 'windows in scratchpad');
done_testing;