return;
}
+ /* 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);
+ }
+
/* 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
* made the choice that this window should be a scratchpad (and floating).
Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
Con *floating;
- /* If the current con or any of its parents are in fullscreen mode, we
- * first need to disable it before showing the scratchpad con. */
- Con *fs = focused;
- while (fs && fs->fullscreen_mode == CF_NONE)
- fs = fs->parent;
-
- if (fs->type != CT_WORKSPACE) {
- con_toggle_fullscreen(focused, CF_OUTPUT);
- }
-
/* If this was 'scratchpad show' without criteria, we check if the
* currently focused window is a scratchpad window and should be hidden
* again. */
return;
}
+ /* If the current con or any of its parents are in fullscreen mode, we
+ * first need to disable it before showing the scratchpad con. */
+ Con *fs = focused;
+ while (fs && fs->fullscreen_mode == CF_NONE)
+ fs = fs->parent;
+
+ if (fs && fs->type != CT_WORKSPACE) {
+ con_toggle_fullscreen(fs, CF_OUTPUT);
+ }
+
/* If this was 'scratchpad show' without criteria, we check if there is a
* unfocused scratchpad on the current workspace and focus it */
Con *walk_con;
--- /dev/null
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Please read the following documents before working on tests:
+# • http://build.i3wm.org/docs/testsuite.html
+# (or docs/testsuite)
+#
+# • http://build.i3wm.org/docs/lib-i3test.html
+# (alternatively: perldoc ./testcases/lib/i3test.pm)
+#
+# • http://build.i3wm.org/docs/ipc.html
+# (or docs/ipc)
+#
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
+# (unless you are already familiar with Perl)
+#
+# Assure that no window is in fullscreen mode after showing a scratchpad window
+# Bug still in: 4.5.1-54-g0f6b5fe
+
+use i3test;
+
+my $tmp = fresh_workspace;
+
+sub fullscreen_windows {
+ my $ws = $tmp;
+ $ws = shift if @_;
+
+ my $nodes = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)->[0]->{nodes}};
+ my $cons = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)};
+ return $nodes + $cons;
+}
+
+##########################################################################################
+# 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;
+
+# fullscreen the focused window
+cmd 'fullscreen';
+
+# see if the window really is in fullscreen mode
+is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen');
+
+# move window to scratchpad
+cmd 'move scratchpad';
+
+###############################################################################
+# show the scratchpad window again; it should not be in fullscreen mode anymore
+###############################################################################
+
+# show window from scratchpad
+cmd 'scratchpad show';
+
+# switch window back to tiling mode
+cmd 'floating toggle';
+
+# see if no window is in fullscreen mode
+is(fullscreen_windows(), 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
+########################################################################################
+
+# make layout tabbed
+cmd 'layout tabbed';
+
+# move one window to scratchpad
+cmd 'move scratchpad';
+
+# focus parent
+cmd 'focus parent';
+
+# fullscreen the container
+cmd 'fullscreen';
+
+# focus child
+cmd 'focus child';
+
+# see if the window really is in fullscreen mode
+is(fullscreen_windows(), 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';
+
+# see if no window is in fullscreen mode
+is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
+
+done_testing;