Bugfix: Don’t use ->old_parent for floating cons (Thanks eelvex)

Instead, we attach them to their workspace when toggling back to tiling. This
makes more sense; afterall, floating clients are always directly below a
CT_WORKSPACE container.
This commit is contained in:
Michael Stapelberg 2011-01-08 00:44:03 +01:00
parent 0ea15ed962
commit 83f6e445a0
3 changed files with 1 additions and 30 deletions

View File

@ -275,8 +275,6 @@ struct Con {
enum { CT_ROOT = 0, CT_OUTPUT = 1, CT_CON = 2, CT_FLOATING_CON = 3, CT_WORKSPACE = 4 } type; enum { CT_ROOT = 0, CT_OUTPUT = 1, CT_CON = 2, CT_FLOATING_CON = 3, CT_WORKSPACE = 4 } type;
orientation_t orientation; orientation_t orientation;
struct Con *parent; struct Con *parent;
/* parent before setting it to floating */
struct Con *old_parent;
struct Rect rect; struct Rect rect;
struct Rect window_rect; struct Rect window_rect;

View File

@ -99,7 +99,6 @@ void floating_enable(Con *con, bool automatic) {
TAILQ_INSERT_TAIL(&(nc->parent->focus_head), nc, focused); TAILQ_INSERT_TAIL(&(nc->parent->focus_head), nc, focused);
/* 3: attach the child to the new parent container */ /* 3: attach the child to the new parent container */
con->old_parent = con->parent;
con->parent = nc; con->parent = nc;
con->floating = FLOATING_USER_ON; con->floating = FLOATING_USER_ON;
@ -134,8 +133,6 @@ void floating_disable(Con *con, bool automatic) {
return; return;
} }
assert(con->old_parent != NULL);
/* 1: detach from parent container */ /* 1: detach from parent container */
TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes); TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
TAILQ_REMOVE(&(con->parent->focus_head), con, focused); TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
@ -146,7 +143,7 @@ void floating_disable(Con *con, bool automatic) {
tree_close(con->parent, false, false); tree_close(con->parent, false, false);
/* 3: re-attach to previous parent */ /* 3: re-attach to previous parent */
con->parent = con->old_parent; con->parent = con_get_workspace(con);
TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes); TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes);
TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused); TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused);

View File

@ -81,27 +81,6 @@ Con *tree_open_con(Con *con) {
return new; return new;
} }
/*
* vanishing is the container that is about to be closed (so any floating
* client which has old_parent == vanishing needs to be "re-parented").
*
*/
static void fix_floating_parent(Con *con, Con *vanishing) {
Con *child;
if (con->old_parent == vanishing) {
LOG("Fixing vanishing old_parent (%p) of container %p to be %p\n",
vanishing, con, vanishing->parent);
con->old_parent = vanishing->parent;
}
TAILQ_FOREACH(child, &(con->floating_head), floating_windows)
fix_floating_parent(child, vanishing);
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
fix_floating_parent(child, vanishing);
}
static bool _is_con_mapped(Con *con) { static bool _is_con_mapped(Con *con) {
Con *child; Con *child;
@ -127,9 +106,6 @@ void tree_close(Con *con, bool kill_window, bool dont_kill_parent) {
was_mapped = _is_con_mapped(con); was_mapped = _is_con_mapped(con);
} }
/* check floating clients and adjust old_parent if necessary */
fix_floating_parent(croot, con);
/* Get the container which is next focused */ /* Get the container which is next focused */
Con *next = con_next_focused(con); Con *next = con_next_focused(con);
DLOG("next = %p, focused = %p\n", next, focused); DLOG("next = %p, focused = %p\n", next, focused);