From: Michael Stapelberg Date: Fri, 7 Jan 2011 23:44:03 +0000 (+0100) Subject: Bugfix: Don’t use ->old_parent for floating cons (Thanks eelvex) X-Git-Tag: tree-pr2~123 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=83f6e445a0f046601bbd9a44df8e03e4f8873e96;p=i3%2Fi3 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. --- diff --git a/include/data.h b/include/data.h index 91f4afcd..fb6ae4e0 100644 --- a/include/data.h +++ b/include/data.h @@ -275,8 +275,6 @@ struct Con { enum { CT_ROOT = 0, CT_OUTPUT = 1, CT_CON = 2, CT_FLOATING_CON = 3, CT_WORKSPACE = 4 } type; orientation_t orientation; struct Con *parent; - /* parent before setting it to floating */ - struct Con *old_parent; struct Rect rect; struct Rect window_rect; diff --git a/src/floating.c b/src/floating.c index b342c56e..3cf8ab5f 100644 --- a/src/floating.c +++ b/src/floating.c @@ -99,7 +99,6 @@ void floating_enable(Con *con, bool automatic) { TAILQ_INSERT_TAIL(&(nc->parent->focus_head), nc, focused); /* 3: attach the child to the new parent container */ - con->old_parent = con->parent; con->parent = nc; con->floating = FLOATING_USER_ON; @@ -134,8 +133,6 @@ void floating_disable(Con *con, bool automatic) { return; } - assert(con->old_parent != NULL); - /* 1: detach from parent container */ TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes); 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); /* 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->focus_head), con, focused); diff --git a/src/tree.c b/src/tree.c index b601cdd4..3e8be524 100644 --- a/src/tree.c +++ b/src/tree.c @@ -81,27 +81,6 @@ Con *tree_open_con(Con *con) { 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) { Con *child; @@ -127,9 +106,6 @@ void tree_close(Con *con, bool kill_window, bool dont_kill_parent) { 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 */ Con *next = con_next_focused(con); DLOG("next = %p, focused = %p\n", next, focused);