bugfix: correctly focus follow up window when closing floating windows

This commit is contained in:
Michael Stapelberg 2010-06-30 22:37:57 +02:00
parent 6d152103f5
commit 5d0f17d53d
1 changed files with 8 additions and 1 deletions

View File

@ -140,7 +140,7 @@ void tree_close(Con *con, bool kill_window) {
if (con->type == CT_FLOATING_CON) { if (con->type == CT_FLOATING_CON) {
next = TAILQ_NEXT(con, floating_windows); next = TAILQ_NEXT(con, floating_windows);
if (next == TAILQ_END(&(con->parent->floating_head))) if (next == TAILQ_END(&(con->parent->floating_head)))
next = con->parent; next = con_get_workspace(con);
} else { } else {
next = TAILQ_NEXT(con, focused); next = TAILQ_NEXT(con, focused);
if (next == TAILQ_END(&(con->parent->nodes_head))) 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->floating_head), con->parent, floating_windows);
TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused); TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused);
tree_close(con->parent, false); tree_close(con->parent, false);
next = NULL;
} }
free(con->name); free(con->name);
TAILQ_REMOVE(&all_cons, con, all_cons); TAILQ_REMOVE(&all_cons, con, all_cons);
free(con); 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 */ /* TODO: check if the container (or one of its children) was focused */
con_focus(next); con_focus(next);
} }