Merge pull request #3342 from orestisf1993/tree_close_internal

Simplify tree_close_internal
This commit is contained in:
Ingo Bürk
2018-09-14 12:24:54 +02:00
committed by GitHub
7 changed files with 24 additions and 81 deletions

View File

@ -286,14 +286,14 @@ void con_close(Con *con, kill_window_t kill_window) {
for (child = TAILQ_FIRST(&(con->focus_head)); child;) {
nextchild = TAILQ_NEXT(child, focused);
DLOG("killing child = %p.\n", child);
tree_close_internal(child, kill_window, false, false);
tree_close_internal(child, kill_window, false);
child = nextchild;
}
return;
}
tree_close_internal(con, kill_window, false, false);
tree_close_internal(con, kill_window, false);
}
/*
@ -1454,6 +1454,9 @@ Con *con_next_focused(Con *con) {
DLOG("selecting workspace for dock client\n");
return con_descend_focused(output_get_content(con->parent->parent));
}
if (con_is_floating(con)) {
con = con->parent;
}
/* if 'con' is not the first entry in the focus stack, use the first one as
* its currently focused already */
@ -1971,7 +1974,7 @@ static void con_on_remove_child(Con *con) {
if (TAILQ_EMPTY(&(con->focus_head)) && !workspace_is_visible(con)) {
LOG("Closing old workspace (%p / %s), it is empty\n", con, con->name);
yajl_gen gen = ipc_marshal_workspace_event("empty", con, NULL);
tree_close_internal(con, DONT_KILL_WINDOW, false, false);
tree_close_internal(con, DONT_KILL_WINDOW, false);
const unsigned char *payload;
ylength length;
@ -1992,7 +1995,7 @@ static void con_on_remove_child(Con *con) {
int children = con_num_children(con);
if (children == 0) {
DLOG("Container empty, closing\n");
tree_close_internal(con, DONT_KILL_WINDOW, false, false);
tree_close_internal(con, DONT_KILL_WINDOW, false);
return;
}
}