]> git.lizzy.rs Git - bspwm.git/blob - types.h
Start parsing modifiers after the last colon
[bspwm.git] / types.h
1 /* Copyright (c) 2012, Bastien Dejean
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  *    list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright notice,
10  *    this list of conditions and the following disclaimer in the documentation
11  *    and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #ifndef BSPWM_TYPES_H
26 #define BSPWM_TYPES_H
27 #include <stdbool.h>
28 #include <xcb/xcb.h>
29 #include <xcb/randr.h>
30 #include <xcb/xcb_event.h>
31 #include "helpers.h"
32
33 #define MISSING_VALUE        "N/A"
34 #define MAX_WM_STATES        4
35
36 typedef enum {
37         TYPE_HORIZONTAL,
38         TYPE_VERTICAL
39 } split_type_t;
40
41 typedef enum {
42         MODE_AUTOMATIC,
43         MODE_MANUAL
44 } split_mode_t;
45
46 typedef enum {
47         STATE_TILED,
48         STATE_PSEUDO_TILED,
49         STATE_FLOATING,
50         STATE_FULLSCREEN
51 } client_state_t;
52
53 typedef enum {
54         LAYER_BELOW,
55         LAYER_NORMAL,
56         LAYER_ABOVE
57 } stack_layer_t;
58
59 typedef enum {
60         OPTION_NONE,
61         OPTION_TRUE,
62         OPTION_FALSE
63 } option_bool_t;
64
65 typedef enum {
66         ALTER_TOGGLE,
67         ALTER_SET
68 } alter_state_t;
69
70 typedef enum {
71         CYCLE_NEXT,
72         CYCLE_PREV
73 } cycle_dir_t;
74
75 typedef enum {
76         CIRCULATE_FORWARD,
77         CIRCULATE_BACKWARD
78 } circulate_dir_t;
79
80 typedef enum {
81         HISTORY_OLDER,
82         HISTORY_NEWER
83 } history_dir_t;
84
85 typedef enum {
86         DIR_NORTH,
87         DIR_WEST,
88         DIR_SOUTH,
89         DIR_EAST
90 } direction_t;
91
92 typedef enum {
93         CORNER_TOP_LEFT,
94         CORNER_TOP_RIGHT,
95         CORNER_BOTTOM_RIGHT,
96         CORNER_BOTTOM_LEFT
97 } corner_t;
98
99 typedef enum {
100         SIDE_LEFT,
101         SIDE_TOP,
102         SIDE_RIGHT,
103         SIDE_BOTTOM
104 } side_t;
105
106 typedef enum {
107         ACTION_NONE,
108         ACTION_FOCUS,
109         ACTION_MOVE,
110         ACTION_RESIZE_SIDE,
111         ACTION_RESIZE_CORNER
112 } pointer_action_t;
113
114 typedef enum {
115         LAYOUT_TILED,
116         LAYOUT_MONOCLE
117 } layout_t;
118
119 typedef enum {
120         FLIP_HORIZONTAL,
121         FLIP_VERTICAL
122 } flip_t;
123
124 typedef enum {
125         FIRST_CHILD,
126         SECOND_CHILD
127 } child_polarity_t;
128
129 typedef struct {
130         option_bool_t automatic;
131         option_bool_t focused;
132         option_bool_t local;
133         option_bool_t leaf;
134         option_bool_t tiled;
135         option_bool_t pseudo_tiled;
136         option_bool_t floating;
137         option_bool_t fullscreen;
138         option_bool_t locked;
139         option_bool_t sticky;
140         option_bool_t private;
141         option_bool_t urgent;
142         option_bool_t same_class;
143         option_bool_t below;
144         option_bool_t normal;
145         option_bool_t above;
146 } node_select_t;
147
148 typedef struct {
149         option_bool_t occupied;
150         option_bool_t focused;
151         option_bool_t urgent;
152         option_bool_t local;
153 } desktop_select_t;
154
155 typedef struct {
156         option_bool_t occupied;
157         option_bool_t focused;
158 } monitor_select_t;
159
160 typedef struct {
161         char class_name[3 * SMALEN / 2];
162         char instance_name[3 * SMALEN / 2];
163         unsigned int border_width;
164         bool urgent;
165         client_state_t state;
166         client_state_t last_state;
167         stack_layer_t layer;
168         stack_layer_t last_layer;
169         xcb_rectangle_t floating_rectangle;
170         xcb_rectangle_t tiled_rectangle;
171         bool icccm_focus;
172         bool icccm_input;
173         uint16_t min_width;
174         uint16_t max_width;
175         uint16_t min_height;
176         uint16_t max_height;
177         xcb_atom_t wm_state[MAX_WM_STATES];
178         int wm_states_count;
179 } client_t;
180
181 typedef struct presel_t presel_t;
182 struct presel_t {
183         double split_ratio;
184         direction_t split_dir;
185         xcb_window_t feedback;
186 };
187
188 typedef struct node_t node_t;
189 struct node_t {
190         uint32_t id;
191         split_type_t split_type;
192         double split_ratio;
193         int birth_rotation;
194         presel_t *presel;
195         xcb_rectangle_t rectangle;
196         bool vacant;
197         bool sticky;
198         bool private;
199         bool locked;
200         node_t *first_child;
201         node_t *second_child;
202         node_t *parent;
203         client_t *client;
204 };
205
206 typedef struct desktop_t desktop_t;
207 struct desktop_t {
208         char name[SMALEN];
209         layout_t layout;
210         node_t *root;
211         node_t *focus;
212         desktop_t *prev;
213         desktop_t *next;
214         int top_padding;
215         int right_padding;
216         int bottom_padding;
217         int left_padding;
218         int window_gap;
219         unsigned int border_width;
220 };
221
222 typedef struct monitor_t monitor_t;
223 struct monitor_t {
224         char name[SMALEN];
225         xcb_randr_output_t id;
226         xcb_window_t root;
227         bool wired;
228         int top_padding;
229         int right_padding;
230         int bottom_padding;
231         int left_padding;
232         unsigned int sticky_count;
233         xcb_rectangle_t rectangle;
234         desktop_t *desk;
235         desktop_t *desk_head;
236         desktop_t *desk_tail;
237         monitor_t *prev;
238         monitor_t *next;
239 };
240
241 typedef struct {
242         monitor_t *monitor;
243         desktop_t *desktop;
244         node_t *node;
245 } coordinates_t;
246
247 typedef struct history_t history_t;
248 struct history_t {
249         coordinates_t loc;
250         bool latest;
251         history_t *prev;
252         history_t *next;
253 };
254
255 typedef struct stacking_list_t stacking_list_t;
256 struct stacking_list_t {
257         node_t *node;
258         stacking_list_t *prev;
259         stacking_list_t *next;
260 };
261
262 typedef struct subscriber_list_t subscriber_list_t;
263 struct subscriber_list_t {
264         int fd;
265         FILE *stream;
266         int field;
267         subscriber_list_t *prev;
268         subscriber_list_t *next;
269 };
270
271 typedef struct rule_t rule_t;
272 struct rule_t {
273         char class_name[MAXLEN];
274         char instance_name[MAXLEN];
275         char effect[MAXLEN];
276         bool one_shot;
277         rule_t *prev;
278         rule_t *next;
279 };
280
281 typedef struct {
282         char class_name[3 * SMALEN / 2];
283         char instance_name[3 * SMALEN / 2];
284         char monitor_desc[MAXLEN];
285         char desktop_desc[MAXLEN];
286         char node_desc[MAXLEN];
287         char split_dir[SMALEN];
288         double split_ratio;
289         stack_layer_t *layer;
290         client_state_t *state;
291         uint16_t min_width;
292         uint16_t max_width;
293         uint16_t min_height;
294         uint16_t max_height;
295         bool locked;
296         bool sticky;
297         bool private;
298         bool center;
299         bool follow;
300         bool manage;
301         bool focus;
302         bool border;
303 } rule_consequence_t;
304
305 typedef struct pending_rule_t pending_rule_t;
306 struct pending_rule_t {
307         int fd;
308         xcb_window_t win;
309         rule_consequence_t *csq;
310         pending_rule_t *prev;
311         pending_rule_t *next;
312 };
313
314 typedef struct {
315         xcb_point_t position;
316         pointer_action_t action;
317         xcb_rectangle_t rectangle;
318         node_t *vertical_fence;
319         node_t *horizontal_fence;
320         monitor_t *monitor;
321         desktop_t *desktop;
322         node_t *node;
323         client_t *client;
324         xcb_window_t window;
325         bool is_tiled;
326         double vertical_ratio;
327         double horizontal_ratio;
328         corner_t corner;
329         side_t side;
330 } pointer_state_t;
331
332 typedef struct {
333         node_t *fence;
334         unsigned int distance;
335 } fence_distance_t;
336
337 #endif