else {
TAILQ_FOREACH(current, &owindows, owindows) {
printf("matching: %p / %s\n", current->con, current->con->name);
- tree_close(current->con, true);
+ tree_close(current->con, true, false);
}
}
/* 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);
+ tree_close(con->parent, false, false);
/* 3: re-attach to previous parent */
con->parent = con->old_parent;
* Closes the given container including all children
*
*/
-void tree_close(Con *con, bool kill_window) {
+void tree_close(Con *con, bool kill_window, bool dont_kill_parent) {
Con *parent = con->parent;
/* check floating clients and adjust old_parent if necessary */
* in their parent’s nodes_head */
while (!TAILQ_EMPTY(&(con->nodes_head))) {
child = TAILQ_FIRST(&(con->nodes_head));
- tree_close(child, kill_window);
+ DLOG("killing child=%p\n", child);
+ tree_close(child, kill_window, true);
}
if (con->window != NULL) {
con_focus(next);
/* check if the parent container is empty now and close it */
- if (parent->type != CT_WORKSPACE &&
+ if (!dont_kill_parent &&
+ 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
* don’t close it automatically. */
- tree_close(parent, false);
+ tree_close(parent, false, false);
}
}
}
/* Kill con */
- tree_close(focused, true);
+ tree_close(focused, true, false);
}
/*
if (con_num_children(old_parent) == 0) {
DLOG("Old container empty after moving. Let's close it\n");
- tree_close(old_parent, false);
+ tree_close(old_parent, false, false);
}
}
/* check if this workspace is currently visible */
if (!workspace_is_visible(old)) {
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
- tree_close(old, false);
+ tree_close(old, false, false);
}
}