Implement mode toggle

This commit is contained in:
Michael Stapelberg
2010-05-31 22:48:28 +02:00
parent e67c712f31
commit 71e0e49c0e
3 changed files with 14 additions and 2 deletions

View File

@ -37,6 +37,7 @@ void toggle_floating_mode(Con *con, bool automatic) {
/* 2: kill parent container */
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);
/* 3: re-attach to previous parent */
@ -44,6 +45,8 @@ void toggle_floating_mode(Con *con, bool automatic) {
TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes);
TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused);
con->floating = FLOATING_USER_OFF;
return;
}
@ -72,6 +75,7 @@ void toggle_floating_mode(Con *con, bool automatic) {
nc->orientation = NO_ORIENTATION;
nc->type = CT_FLOATING_CON;
TAILQ_INSERT_TAIL(&(nc->parent->floating_head), nc, floating_windows);
TAILQ_INSERT_TAIL(&(nc->parent->focus_head), nc, focused);
/* 3: attach the child to the new parent container */
con->old_parent = con->parent;