]> git.sur5r.net Git - i3/i3/blob - include/tree.h
Make workspace_layout handle all cons at workspace level, not only the first one...
[i3/i3] / include / tree.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  */
4
5 #ifndef _TREE_H
6 #define _TREE_H
7
8 extern Con *croot;
9 /* TODO: i am not sure yet how much access to the focused container should
10  * be permitted to source files */
11 extern Con *focused;
12 TAILQ_HEAD(all_cons_head, Con);
13 extern struct all_cons_head all_cons;
14
15 /**
16  * Initializes the tree by creating the root node, adding all RandR outputs
17  * to the tree (that means randr_init() has to be called before) and
18  * assigning a workspace to each RandR output.
19  *
20  */
21 void tree_init();
22
23 /**
24  * Opens an empty container in the current container
25  *
26  */
27 Con *tree_open_con(Con *con, i3Window *window);
28
29 /**
30  * Splits (horizontally or vertically) the given container by creating a new
31  * container which contains the old one and the future ones.
32  *
33  */
34 void tree_split(Con *con, orientation_t orientation);
35
36 /**
37  * Moves focus one level up.
38  *
39  */
40 void level_up();
41
42 /**
43  * Moves focus one level down.
44  *
45  */
46 void level_down();
47
48 /**
49  * Renders the tree, that is rendering all outputs using render_con() and
50  * pushing the changes to X11 using x_push_changes().
51  *
52  */
53 void tree_render();
54
55 /**
56  * Closes the current container using tree_close().
57  *
58  */
59 void tree_close_con(kill_window_t kill_window);
60
61 /**
62  * Changes focus in the given way (next/previous) and given orientation
63  * (horizontal/vertical).
64  *
65  */
66 void tree_next(char way, orientation_t orientation);
67
68 /**
69  * Closes the given container including all children.
70  * Returns true if the container was killed or false if just WM_DELETE was sent
71  * and the window is expected to kill itself.
72  *
73  */
74 bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent);
75
76 /**
77  * Loads tree from ~/.i3/_restart.json (used for in-place restarts).
78  *
79  */
80 bool tree_restore(const char *path);
81
82 /**
83  * tree_flatten() removes pairs of redundant split containers, e.g.:
84  *       [workspace, horizontal]
85  *   [v-split]           [child3]
86  *   [h-split]
87  * [child1] [child2]
88  * In this example, the v-split and h-split container are redundant.
89  * Such a situation can be created by moving containers in a direction which is
90  * not the orientation of their parent container. i3 needs to create a new
91  * split container then and if you move containers this way multiple times,
92  * redundant chains of split-containers can be the result.
93  *
94  */
95 void tree_flatten(Con *child);
96
97 #endif