Fix problem when moving fullscreen window to scratchpad

When moving a fullscreen window to scratchpad with 'move scratchpad', the
focused window would stay fullscreen.

Also, when having a container in fullscreen mode and then focusing a child of
this container and moving it to scratchpad, it would enable fullscreen for
the child window.

This patch fixes both problems, so the scratchpad window is always floating.
This commit is contained in:
haptix@web.de
2013-05-24 15:02:04 +02:00
committed by Michael Stapelberg
parent 609496d13f
commit f0eba6d15c
2 changed files with 110 additions and 10 deletions

View File

@ -39,6 +39,12 @@ void scratchpad_move(Con *con) {
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).
@ -78,16 +84,6 @@ void scratchpad_show(Con *con) {
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. */
@ -99,6 +95,16 @@ void scratchpad_show(Con *con) {
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;