/**
* Returns the container which will be focused next when the given container
- * is not available anymore. Called in tree_close and con_move_to_workspace
+ * is not available anymore. Called in tree_close_internal and con_move_to_workspace
* to properly restore focus.
*
*/
BS_NONE = 1,
BS_PIXEL = 2 } border_style_t;
-/** parameter to specify whether tree_close() and x_window_kill() should kill
+/** parameter to specify whether tree_close_internal() and x_window_kill() should kill
* only this specific window or the whole X11 client */
typedef enum { DONT_KILL_WINDOW = 0,
KILL_WINDOW = 1,
void tree_render(void);
/**
- * Closes the current container using tree_close().
+ * Closes the current container using tree_close_internal().
*
*/
void tree_close_con(kill_window_t kill_window);
* recursively while deleting a containers children.
*
* The force_set_focus flag is specified in the case of killing a floating
- * window: tree_close() will be invoked for the CT_FLOATINGCON (the parent
+ * window: tree_close_internal() will be invoked for the CT_FLOATINGCON (the parent
* container) and focus should be set there.
*
*/
-bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus);
+bool tree_close_internal(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus);
/**
* Loads tree from ~/.i3/_restart.json (used for in-place restarts).
else {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
- tree_close(current->con, kill_mode, false, false);
+ tree_close_internal(current->con, kill_mode, false, false);
}
}
/*
* Returns the container which will be focused next when the given container
- * is not available anymore. Called in tree_close and con_move_to_workspace
+ * is not available anymore. Called in tree_close_internal and con_move_to_workspace
* to properly restore focus.
*
*/
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(con, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(con, DONT_KILL_WINDOW, false, false);
const unsigned char *payload;
ylength length;
int children = con_num_children(con);
if (children == 0) {
DLOG("Container empty, closing\n");
- tree_close(con, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(con, DONT_KILL_WINDOW, false, false);
return;
}
}
}
/* 1: detach the container from its parent */
- /* TODO: refactor this with tree_close() */
+ /* TODO: refactor this with tree_close_internal() */
TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
nc->layout = L_SPLITH;
/* We insert nc already, even though its rect is not yet calculated. This
* is necessary because otherwise the workspace might be empty (and get
- * closed in tree_close()) even though it’s not. */
+ * closed in tree_close_internal()) even though it’s not. */
TAILQ_INSERT_TAIL(&(ws->floating_head), nc, floating_windows);
TAILQ_INSERT_TAIL(&(ws->focus_head), nc, focused);
if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) &&
con_num_children(con->parent) == 0) {
DLOG("Old container empty after setting this child to floating, closing\n");
- tree_close(con->parent, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(con->parent, DONT_KILL_WINDOW, false, false);
}
char *name;
/* 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, DONT_KILL_WINDOW, true, false);
+ tree_close_internal(con->parent, DONT_KILL_WINDOW, true, false);
/* 3: re-attach to the parent of the currently focused con on the workspace
* this floating con was on */
goto ignore_end;
}
- tree_close(con, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(con, DONT_KILL_WINDOW, false, false);
tree_render();
ignore_end:
if (event->data.data32[0])
last_timestamp = event->data.data32[0];
- tree_close(con, KILL_WINDOW, false, false);
+ tree_close_internal(con, KILL_WINDOW, false, false);
tree_render();
} else {
DLOG("Couldn't find con for _NET_CLOSE_WINDOW request. (window = %d)\n", event->window);
if (current != next && TAILQ_EMPTY(&(current->focus_head))) {
/* the workspace is empty and not focused, get rid of it */
DLOG("Getting rid of current = %p / %s (empty, unfocused)\n", current, current->name);
- tree_close(current, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(current, DONT_KILL_WINDOW, false, false);
continue;
}
DLOG("Detaching current = %p / %s\n", current, current->name);
}
DLOG("destroying disappearing con %p\n", output->con);
- tree_close(output->con, DONT_KILL_WINDOW, true, false);
+ tree_close_internal(output->con, DONT_KILL_WINDOW, true, false);
DLOG("Done. Should be fine now\n");
output->con = NULL;
}
* recursively while deleting a containers children.
*
* The force_set_focus flag is specified in the case of killing a floating
- * window: tree_close() will be invoked for the CT_FLOATINGCON (the parent
+ * window: tree_close_internal() will be invoked for the CT_FLOATINGCON (the parent
* container) and focus should be set there.
*
*/
-bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus) {
+bool tree_close_internal(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus) {
bool was_mapped = con->mapped;
Con *parent = con->parent;
for (child = TAILQ_FIRST(&(con->nodes_head)); child;) {
nextchild = TAILQ_NEXT(child, nodes);
DLOG("killing child=%p\n", child);
- if (!tree_close(child, kill_window, true, false))
+ if (!tree_close_internal(child, kill_window, true, false))
abort_kill = true;
child = nextchild;
}
* underlying container, see ticket #660.
*
* Rendering has to be avoided when dont_kill_parent is set (when
- * tree_close calls itself recursively) because the tree is in a
+ * tree_close_internal calls itself recursively) because the tree is in a
* non-renderable state during that time. */
if (!dont_kill_parent)
tree_render();
if (con_is_floating(con)) {
DLOG("Container was floating, killing floating container\n");
- tree_close(parent, DONT_KILL_WINDOW, false, (con == focused));
+ tree_close_internal(parent, DONT_KILL_WINDOW, false, (con == focused));
DLOG("parent container killed\n");
}
}
/*
- * Closes the current container using tree_close().
+ * Closes the current container using tree_close_internal().
*
*/
void tree_close_con(kill_window_t kill_window) {
for (child = TAILQ_FIRST(&(focused->focus_head)); child;) {
nextchild = TAILQ_NEXT(child, focused);
DLOG("killing child=%p\n", child);
- tree_close(child, kill_window, false, false);
+ tree_close_internal(child, kill_window, false, false);
child = nextchild;
}
}
/* Kill con */
- tree_close(focused, kill_window, false, false);
+ tree_close_internal(focused, kill_window, false, false);
}
/*
/* 4: close the redundant cons */
DLOG("closing redundant cons\n");
- tree_close(con, DONT_KILL_WINDOW, true, false);
+ tree_close_internal(con, DONT_KILL_WINDOW, true, false);
/* Well, we got to abort the recursion here because we destroyed the
* container. However, if tree_flatten() is called sufficiently often,
DLOG("old = %p / %s\n", old, (old ? old->name : "(null)"));
/* Close old workspace if necessary. This must be done *after* doing
- * urgency handling, because tree_close() will do a con_focus() on the next
+ * urgency handling, because tree_close_internal() will do a con_focus() on the next
* client, which will clear the urgency flag too early. Also, there is no
* way for con_focus() to know about when to clear urgency immediately and
* when to defer it. */
if (!workspace_is_visible(old)) {
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
yajl_gen gen = ipc_marshal_workspace_event("empty", old, NULL);
- tree_close(old, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(old, DONT_KILL_WINDOW, false, false);
const unsigned char *payload;
ylength length;