diff options
Diffstat (limited to 'include/sway/container.h')
-rw-r--r-- | include/sway/container.h | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/include/sway/container.h b/include/sway/container.h deleted file mode 100644 index f200a1a2..00000000 --- a/include/sway/container.h +++ /dev/null | |||
@@ -1,169 +0,0 @@ | |||
1 | #ifndef _SWAY_CONTAINER_H | ||
2 | #define _SWAY_CONTAINER_H | ||
3 | #include <stdint.h> | ||
4 | #include <sys/types.h> | ||
5 | #include <wlr/types/wlr_box.h> | ||
6 | #include <wlr/types/wlr_surface.h> | ||
7 | #include "list.h" | ||
8 | |||
9 | typedef struct sway_container swayc_t; | ||
10 | |||
11 | extern swayc_t root_container; | ||
12 | |||
13 | struct sway_view; | ||
14 | struct sway_seat; | ||
15 | |||
16 | /** | ||
17 | * Different kinds of containers. | ||
18 | * | ||
19 | * This enum is in order. A container will never be inside of a container below | ||
20 | * it on this list. | ||
21 | */ | ||
22 | enum swayc_types { | ||
23 | C_ROOT, /**< The root container. Only one of these ever exists. */ | ||
24 | C_OUTPUT, /**< An output (aka monitor, head, etc). */ | ||
25 | C_WORKSPACE, /**< A workspace. */ | ||
26 | C_CONTAINER, /**< A manually created container. */ | ||
27 | C_VIEW, /**< A view (aka window). */ | ||
28 | |||
29 | C_TYPES, | ||
30 | }; | ||
31 | |||
32 | /** | ||
33 | * Different ways to arrange a container. | ||
34 | */ | ||
35 | enum swayc_layouts { | ||
36 | L_NONE, /**< Used for containers that have no layout (views, root) */ | ||
37 | L_HORIZ, | ||
38 | L_VERT, | ||
39 | L_STACKED, | ||
40 | L_TABBED, | ||
41 | L_FLOATING, /**< A psuedo-container, removed from the tree, to hold floating windows */ | ||
42 | |||
43 | /* Awesome/Monad style auto layouts */ | ||
44 | L_AUTO_LEFT, | ||
45 | L_AUTO_RIGHT, | ||
46 | L_AUTO_TOP, | ||
47 | L_AUTO_BOTTOM, | ||
48 | |||
49 | L_AUTO_FIRST = L_AUTO_LEFT, | ||
50 | L_AUTO_LAST = L_AUTO_BOTTOM, | ||
51 | |||
52 | // Keep last | ||
53 | L_LAYOUTS, | ||
54 | }; | ||
55 | |||
56 | enum swayc_border_types { | ||
57 | B_NONE, /**< No border */ | ||
58 | B_PIXEL, /**< 1px border */ | ||
59 | B_NORMAL, /**< Normal border with title bar */ | ||
60 | }; | ||
61 | |||
62 | struct sway_root; | ||
63 | struct sway_output; | ||
64 | struct sway_view; | ||
65 | |||
66 | /** | ||
67 | * Stores information about a container. | ||
68 | * | ||
69 | * The tree is made of these. Views are containers that cannot have children. | ||
70 | */ | ||
71 | struct sway_container { | ||
72 | union { | ||
73 | // TODO: Encapsulate state for other node types as well like C_CONTAINER | ||
74 | struct sway_root *sway_root; // C_ROOT | ||
75 | struct sway_output *sway_output; // C_OUTPUT | ||
76 | struct sway_view *sway_view; // C_VIEW | ||
77 | }; | ||
78 | |||
79 | /** | ||
80 | * A unique ID to identify this container. Primarily used in the | ||
81 | * get_tree JSON output. | ||
82 | */ | ||
83 | size_t id; | ||
84 | |||
85 | char *name; | ||
86 | |||
87 | enum swayc_types type; | ||
88 | enum swayc_layouts layout; | ||
89 | enum swayc_layouts prev_layout; | ||
90 | enum swayc_layouts workspace_layout; | ||
91 | |||
92 | /** | ||
93 | * The coordinates that this view appear at, relative to the output they | ||
94 | * are located on (output containers have absolute coordinates). | ||
95 | */ | ||
96 | double x, y; | ||
97 | |||
98 | /** | ||
99 | * Width and height of this container, without borders or gaps. | ||
100 | */ | ||
101 | double width, height; | ||
102 | |||
103 | list_t *children; | ||
104 | |||
105 | /** | ||
106 | * The parent of this container. NULL for the root container. | ||
107 | */ | ||
108 | struct sway_container *parent; | ||
109 | |||
110 | /** | ||
111 | * Number of master views in auto layouts. | ||
112 | */ | ||
113 | size_t nb_master; | ||
114 | |||
115 | /** | ||
116 | * Number of slave groups (e.g. columns) in auto layouts. | ||
117 | */ | ||
118 | size_t nb_slave_groups; | ||
119 | |||
120 | /** | ||
121 | * Marks applied to the container, list_t of char*. | ||
122 | */ | ||
123 | list_t *marks; | ||
124 | |||
125 | struct { | ||
126 | struct wl_signal destroy; | ||
127 | } events; | ||
128 | }; | ||
129 | |||
130 | void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, | ||
131 | void (*func)(swayc_t *item, void *data), void *data); | ||
132 | |||
133 | swayc_t *new_output(struct sway_output *sway_output); | ||
134 | swayc_t *new_workspace(swayc_t *output, const char *name); | ||
135 | swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view); | ||
136 | |||
137 | swayc_t *destroy_output(swayc_t *output); | ||
138 | swayc_t *destroy_view(swayc_t *view); | ||
139 | |||
140 | swayc_t *next_view_sibling(struct sway_seat *seat); | ||
141 | |||
142 | /** | ||
143 | * Finds a container based on test criteria. Returns the first container that | ||
144 | * passes the test. | ||
145 | */ | ||
146 | swayc_t *swayc_by_test(swayc_t *container, | ||
147 | bool (*test)(swayc_t *view, void *data), void *data); | ||
148 | /** | ||
149 | * Finds a parent container with the given swayc_type. | ||
150 | */ | ||
151 | swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); | ||
152 | /** | ||
153 | * Maps a container's children over a function. | ||
154 | */ | ||
155 | void container_map(swayc_t *container, | ||
156 | void (*f)(swayc_t *view, void *data), void *data); | ||
157 | |||
158 | swayc_t *swayc_at(swayc_t *parent, double lx, double ly, | ||
159 | struct wlr_surface **surface, double *sx, double *sy); | ||
160 | |||
161 | /** | ||
162 | * Apply the function for each child of the container breadth first. | ||
163 | */ | ||
164 | void container_for_each_bfs(swayc_t *con, void (*f)(swayc_t *con, void *data), | ||
165 | void *data); | ||
166 | |||
167 | swayc_t *swayc_change_layout(swayc_t *container, enum swayc_layouts layout); | ||
168 | |||
169 | #endif | ||