toggle_floating_mode(focused, false);
} else {
printf("should switch mode to %s\n", ($<number>3 == TOK_FLOATING ? "floating" : "tiling"));
- /* TODO: actually switch mode (not toggle) */
+ if ($<number>3 == TOK_FLOATING) {
+ floating_enable(focused, false);
+ } else {
+ floating_disable(focused, false);
+ }
}
}
;
extern xcb_connection_t *conn;
void floating_enable(Con *con, bool automatic) {
+ if (con_is_floating(con)) {
+ LOG("Container is already in floating mode, not doing anything.\n");
+ return;
+ }
+
/* 1: detach the container from its parent */
/* TODO: refactor this with tree_close() */
TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
}
void floating_disable(Con *con, bool automatic) {
+ if (!con_is_floating(con)) {
+ LOG("Container isn't floating, not doing anything.\n");
+ return;
+ }
+
assert(con->old_parent != NULL);
/* 1: detach from parent container */