close empty parent containers, add testcase

This commit is contained in:
Michael Stapelberg
2010-07-17 00:54:47 +02:00
parent 33572b8c4b
commit 09c6b587d3
2 changed files with 57 additions and 0 deletions

View File

@ -201,6 +201,15 @@ void tree_close(Con *con, bool kill_window) {
DLOG("focusing %p / %s\n", next, next->name);
/* TODO: check if the container (or one of its children) was focused */
con_focus(next);
/* check if the parent container is empty now and close it */
if (parent->type != CT_WORKSPACE &&
TAILQ_EMPTY(&(parent->nodes_head))) {
DLOG("Closing empty parent container\n");
/* TODO: check if this container would swallow any other client and
* dont close it automatically. */
tree_close(parent, false);
}
}
/*