2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
5 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
7 * tree.c: Everything that primarily modifies the layout tree data structure.
13 /* TODO: i am not sure yet how much access to the focused container should
14 * be permitted to source files */
16 TAILQ_HEAD(all_cons_head, Con);
17 extern struct all_cons_head all_cons;
20 * Initializes the tree by creating the root node, adding all RandR outputs
21 * to the tree (that means randr_init() has to be called before) and
22 * assigning a workspace to each RandR output.
25 void tree_init(xcb_get_geometry_reply_t *geometry);
28 * Opens an empty container in the current container
31 Con *tree_open_con(Con *con, i3Window *window);
34 * Splits (horizontally or vertically) the given container by creating a new
35 * container which contains the old one and the future ones.
38 void tree_split(Con *con, orientation_t orientation);
41 * Moves focus one level up. Returns true if focus changed.
47 * Moves focus one level down. Returns true if focus changed.
50 bool level_down(void);
53 * Renders the tree, that is rendering all outputs using render_con() and
54 * pushing the changes to X11 using x_push_changes().
57 void tree_render(void);
60 * Closes the current container using tree_close().
63 void tree_close_con(kill_window_t kill_window);
66 * Changes focus in the given way (next/previous) and given orientation
67 * (horizontal/vertical).
70 void tree_next(char way, orientation_t orientation);
73 * Closes the given container including all children.
74 * Returns true if the container was killed or false if just WM_DELETE was sent
75 * and the window is expected to kill itself.
77 * The dont_kill_parent flag is specified when the function calls itself
78 * recursively while deleting a containers children.
80 * The force_set_focus flag is specified in the case of killing a floating
81 * window: tree_close() will be invoked for the CT_FLOATINGCON (the parent
82 * container) and focus should be set there.
85 bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus);
88 * Loads tree from ~/.i3/_restart.json (used for in-place restarts).
91 bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry);
94 * tree_flatten() removes pairs of redundant split containers, e.g.:
95 * [workspace, horizontal]
99 * In this example, the v-split and h-split container are redundant.
100 * Such a situation can be created by moving containers in a direction which is
101 * not the orientation of their parent container. i3 needs to create a new
102 * split container then and if you move containers this way multiple times,
103 * redundant chains of split-containers can be the result.
106 void tree_flatten(Con *child);