]> git.sur5r.net Git - i3/i3/blob - include/tree.h
Merge branch 'release-4.16.1'
[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 #include <config.h>
13
14 extern Con *croot;
15 /* TODO: i am not sure yet how much access to the focused container should
16  * be permitted to source files */
17 extern Con *focused;
18 TAILQ_HEAD(all_cons_head, Con);
19 extern struct all_cons_head all_cons;
20
21 /**
22  * Initializes the tree by creating the root node, adding all RandR outputs
23  * to the tree (that means randr_init() has to be called before) and
24  * assigning a workspace to each RandR output.
25  *
26  */
27 void tree_init(xcb_get_geometry_reply_t *geometry);
28
29 /**
30  * Opens an empty container in the current container
31  *
32  */
33 Con *tree_open_con(Con *con, i3Window *window);
34
35 /**
36  * Splits (horizontally or vertically) the given container by creating a new
37  * container which contains the old one and the future ones.
38  *
39  */
40 void tree_split(Con *con, orientation_t orientation);
41
42 /**
43  * Moves focus one level up. Returns true if focus changed.
44  *
45  */
46 bool level_up(void);
47
48 /**
49  * Moves focus one level down. Returns true if focus changed.
50  *
51  */
52 bool level_down(void);
53
54 /**
55  * Renders the tree, that is rendering all outputs using render_con() and
56  * pushing the changes to X11 using x_push_changes().
57  *
58  */
59 void tree_render(void);
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  * The dont_kill_parent flag is specified when the function calls itself
74  * recursively while deleting a containers children.
75  *
76  * The force_set_focus flag is specified in the case of killing a floating
77  * window: tree_close_internal() will be invoked for the CT_FLOATINGCON (the parent
78  * container) and focus should be set there.
79  *
80  */
81 bool tree_close_internal(Con *con, kill_window_t kill_window, bool dont_kill_parent);
82
83 /**
84  * Loads tree from ~/.i3/_restart.json (used for in-place restarts).
85  *
86  */
87 bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry);
88
89 /**
90  * tree_flatten() removes pairs of redundant split containers, e.g.:
91  *       [workspace, horizontal]
92  *   [v-split]           [child3]
93  *   [h-split]
94  * [child1] [child2]
95  * In this example, the v-split and h-split container are redundant.
96  * Such a situation can be created by moving containers in a direction which is
97  * not the orientation of their parent container. i3 needs to create a new
98  * split container then and if you move containers this way multiple times,
99  * redundant chains of split-containers can be the result.
100  *
101  */
102 void tree_flatten(Con *child);