From 5d0f17d53d12a445ba730a3972f1749f40656e73 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 30 Jun 2010 22:37:57 +0200 Subject: [PATCH] bugfix: correctly focus follow up window when closing floating windows --- src/tree.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tree.c b/src/tree.c index 2bcaeaae..ec8b0a83 100644 --- a/src/tree.c +++ b/src/tree.c @@ -140,7 +140,7 @@ void tree_close(Con *con, bool kill_window) { if (con->type == CT_FLOATING_CON) { next = TAILQ_NEXT(con, floating_windows); if (next == TAILQ_END(&(con->parent->floating_head))) - next = con->parent; + next = con_get_workspace(con); } else { next = TAILQ_NEXT(con, focused); if (next == TAILQ_END(&(con->parent->nodes_head))) @@ -180,12 +180,19 @@ void tree_close(Con *con, bool kill_window) { TAILQ_REMOVE(&(con->parent->parent->floating_head), con->parent, floating_windows); TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused); tree_close(con->parent, false); + next = NULL; } free(con->name); TAILQ_REMOVE(&all_cons, con, all_cons); free(con); + /* in the case of floating windows, we already focused another container + * when closing the parent, so we can exit now. */ + if (!next) + return; + + DLOG("focusing %p / %s\n", next, next->name); /* TODO: check if the container (or one of its children) was focused */ con_focus(next); } -- 2.39.5