From 83f6e445a0f046601bbd9a44df8e03e4f8873e96 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 8 Jan 2011 00:44:03 +0100 Subject: [PATCH] =?UTF-8?q?Bugfix:=20Don=E2=80=99t=20use=20->old=5Fparent?= =?UTF-8?q?=20for=20floating=20cons=20(Thanks=20eelvex)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- include/data.h | 2 -- src/floating.c | 5 +---- src/tree.c | 24 ------------------------ 3 files changed, 1 insertion(+), 30 deletions(-) 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);