Bugfix: Close containers which are empty due to a move (Thanks fernando)

This commit is contained in:
Michael Stapelberg
2010-11-13 14:55:11 +01:00
parent 4aef09ab34
commit dc10c67060
5 changed files with 48 additions and 8 deletions

View File

@ -364,6 +364,7 @@ void tree_next(char way, orientation_t orientation) {
void tree_move(char way, orientation_t orientation) {
/* 1: get the first parent with the same orientation */
Con *parent = focused->parent;
Con *old_parent = parent;
if (focused->type == CT_WORKSPACE)
return;
bool level_changed = false;
@ -431,4 +432,9 @@ void tree_move(char way, orientation_t orientation) {
TAILQ_INSERT_HEAD(&(next->parent->focus_head), focused, focused);
/* TODO: dont influence focus handling? */
}
if (con_num_children(old_parent) == 0) {
DLOG("Old container empty after moving. Let's close it\n");
tree_close(old_parent, false);
}
}