]> git.sur5r.net Git - i3/i3/blob - include/tree.h
Merge pull request #1657 from Georgiy-Tugai/fix-flickering-shortened
[i3/i3] / include / tree.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * tree.c: Everything that primarily modifies the layout tree data structure.
8  *
9  */
10 #pragma once
11
12 extern Con *croot;
13 /* TODO: i am not sure yet how much access to the focused container should
14  * be permitted to source files */
15 extern Con *focused;
16 TAILQ_HEAD(all_cons_head, Con);
17 extern struct all_cons_head all_cons;
18
19 /**
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.
23  *
24  */
25 void tree_init(xcb_get_geometry_reply_t *geometry);
26
27 /**
28  * Opens an empty container in the current container
29  *
30  */
31 Con *tree_open_con(Con *con, i3Window *window);
32
33 /**
34  * Splits (horizontally or vertically) the given container by creating a new
35  * container which contains the old one and the future ones.
36  *
37  */
38 void tree_split(Con *con, orientation_t orientation);
39
40 /**
41  * Moves focus one level up. Returns true if focus changed.
42  *
43  */
44 bool level_up(void);
45
46 /**
47  * Moves focus one level down. Returns true if focus changed.
48  *
49  */
50 bool level_down(void);
51
52 /**
53  * Renders the tree, that is rendering all outputs using render_con() and
54  * pushing the changes to X11 using x_push_changes().
55  *
56  */
57 void tree_render(void);
58
59 /**
60  * Closes the current container using tree_close().
61  *
62  */
63 void tree_close_con(kill_window_t kill_window);
64
65 /**
66  * Changes focus in the given way (next/previous) and given orientation
67  * (horizontal/vertical).
68  *
69  */
70 void tree_next(char way, orientation_t orientation);
71
72 /**
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.
76  *
77  * The dont_kill_parent flag is specified when the function calls itself
78  * recursively while deleting a containers children.
79  *
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.
83  *
84  */
85 bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus);
86
87 /**
88  * Loads tree from ~/.i3/_restart.json (used for in-place restarts).
89  *
90  */
91 bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry);
92
93 /**
94  * tree_flatten() removes pairs of redundant split containers, e.g.:
95  *       [workspace, horizontal]
96  *   [v-split]           [child3]
97  *   [h-split]
98  * [child1] [child2]
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.
104  *
105  */
106 void tree_flatten(Con *child);