fix crash: send non-floating window with floating parent to scratchpad (thanks pkordy)

Fix a crash that occured when moving a window to the scratchpad that is
seemingly floating to the user, but actually a descendant of a floating
parent con (and itself non-floating). If that is the case, move the
floating parent container to scratchpad instead of the window.

fixes #740
This commit is contained in:
Simon Elsbrock
2012-09-28 00:38:02 +02:00
committed by Michael Stapelberg
parent 584a6b6b59
commit da2b47c1e5
2 changed files with 55 additions and 37 deletions

View File

@ -39,11 +39,17 @@ void scratchpad_move(Con *con) {
return;
}
/* 1: Ensure the window 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). */
floating_enable(con, false);
con = con->parent;
/* 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 *maybe_floating_con = con_inside_floating(con);
if (maybe_floating_con == NULL) {
floating_enable(con, false);
con = con->parent;
} else {
con = maybe_floating_con;
}
/* 2: Send the window to the __i3_scratch workspace, mainting its
* coordinates and not warping the pointer. */