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