]> git.lizzy.rs Git - bspwm.git/blob - types.h
Fix typo
[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/xcb_icccm.h>
30 #include <xcb/randr.h>
31 #include <xcb/xcb_event.h>
32 #include "helpers.h"
33
34 #define MISSING_VALUE        "N/A"
35 #define MAX_WM_STATES        4
36
37 typedef enum {
38         TYPE_HORIZONTAL,
39         TYPE_VERTICAL
40 } split_type_t;
41
42 typedef enum {
43         MODE_AUTOMATIC,
44         MODE_MANUAL
45 } split_mode_t;
46
47 typedef enum {
48         STATE_TILED,
49         STATE_PSEUDO_TILED,
50         STATE_FLOATING,
51         STATE_FULLSCREEN
52 } client_state_t;
53
54 typedef enum {
55         WM_FLAG_MODAL = 1 << 0,
56         WM_FLAG_STICKY = 1 << 1,
57         WM_FLAG_MAXIMIZED_VERT = 1 << 2,
58         WM_FLAG_MAXIMIZED_HORZ = 1 << 3,
59         WM_FLAG_SHADED = 1 << 4,
60         WM_FLAG_SKIP_TASKBAR = 1 << 5,
61         WM_FLAG_SKIP_PAGER = 1 << 6,
62         WM_FLAG_HIDDEN = 1 << 7,
63         WM_FLAG_FULLSCREEN = 1 << 8,
64         WM_FLAG_ABOVE = 1 << 9,
65         WM_FLAG_BELOW = 1 << 10,
66         WM_FLAG_DEMANDS_ATTENTION = 1 << 11,
67 } wm_flags_t;
68
69 typedef enum {
70         LAYER_BELOW,
71         LAYER_NORMAL,
72         LAYER_ABOVE
73 } stack_layer_t;
74
75 typedef enum {
76         OPTION_NONE,
77         OPTION_TRUE,
78         OPTION_FALSE
79 } option_bool_t;
80
81 typedef enum {
82         ALTER_TOGGLE,
83         ALTER_SET
84 } alter_state_t;
85
86 typedef enum {
87         CYCLE_NEXT,
88         CYCLE_PREV
89 } cycle_dir_t;
90
91 typedef enum {
92         CIRCULATE_FORWARD,
93         CIRCULATE_BACKWARD
94 } circulate_dir_t;
95
96 typedef enum {
97         HISTORY_OLDER,
98         HISTORY_NEWER
99 } history_dir_t;
100
101 typedef enum {
102         DIR_NORTH,
103         DIR_WEST,
104         DIR_SOUTH,
105         DIR_EAST
106 } direction_t;
107
108 typedef enum {
109         HANDLE_LEFT = 1 << 0,
110         HANDLE_TOP = 1 << 1,
111         HANDLE_RIGHT = 1 << 2,
112         HANDLE_BOTTOM = 1 << 3,
113         HANDLE_TOP_LEFT = HANDLE_TOP | HANDLE_LEFT,
114         HANDLE_TOP_RIGHT = HANDLE_TOP | HANDLE_RIGHT,
115         HANDLE_BOTTOM_RIGHT = HANDLE_BOTTOM | HANDLE_RIGHT,
116         HANDLE_BOTTOM_LEFT = HANDLE_BOTTOM | HANDLE_LEFT
117 } resize_handle_t;
118
119 typedef enum {
120         ACTION_FOCUS,
121         ACTION_MOVE,
122         ACTION_RESIZE_SIDE,
123         ACTION_RESIZE_CORNER
124 } pointer_action_t;
125
126 typedef enum {
127         LAYOUT_TILED,
128         LAYOUT_MONOCLE
129 } layout_t;
130
131 typedef enum {
132         FLIP_HORIZONTAL,
133         FLIP_VERTICAL
134 } flip_t;
135
136 typedef enum {
137         FIRST_CHILD,
138         SECOND_CHILD
139 } child_polarity_t;
140
141 typedef struct {
142         option_bool_t automatic;
143         option_bool_t focused;
144         option_bool_t local;
145         option_bool_t leaf;
146         option_bool_t window;
147         option_bool_t tiled;
148         option_bool_t pseudo_tiled;
149         option_bool_t floating;
150         option_bool_t fullscreen;
151         option_bool_t locked;
152         option_bool_t sticky;
153         option_bool_t private;
154         option_bool_t urgent;
155         option_bool_t same_class;
156         option_bool_t below;
157         option_bool_t normal;
158         option_bool_t above;
159 } node_select_t;
160
161 typedef struct {
162         option_bool_t occupied;
163         option_bool_t focused;
164         option_bool_t urgent;
165         option_bool_t local;
166 } desktop_select_t;
167
168 typedef struct {
169         option_bool_t occupied;
170         option_bool_t focused;
171 } monitor_select_t;
172
173 typedef struct icccm_props_t icccm_props_t;
174 struct icccm_props_t {
175         bool take_focus;
176         bool input_hint;
177 };
178
179 typedef struct {
180         char class_name[3 * SMALEN / 2];
181         char instance_name[3 * SMALEN / 2];
182         unsigned int border_width;
183         bool urgent;
184         bool visible;
185         client_state_t state;
186         client_state_t last_state;
187         stack_layer_t layer;
188         stack_layer_t last_layer;
189         xcb_rectangle_t floating_rectangle;
190         xcb_rectangle_t tiled_rectangle;
191         xcb_size_hints_t size_hints;
192         icccm_props_t icccm_props;
193         wm_flags_t wm_flags;
194 } client_t;
195
196 typedef struct presel_t presel_t;
197 struct presel_t {
198         double split_ratio;
199         direction_t split_dir;
200         xcb_window_t feedback;
201 };
202
203 typedef struct node_t node_t;
204 struct node_t {
205         uint32_t id;
206         split_type_t split_type;
207         double split_ratio;
208         int birth_rotation;
209         presel_t *presel;
210         xcb_rectangle_t rectangle;
211         bool vacant;
212         bool sticky;
213         bool private;
214         bool locked;
215         node_t *first_child;
216         node_t *second_child;
217         node_t *parent;
218         client_t *client;
219 };
220
221 typedef struct padding_t padding_t;
222 struct padding_t {
223         int top;
224         int right;
225         int bottom;
226         int left;
227 };
228
229 typedef struct desktop_t desktop_t;
230 struct desktop_t {
231         char name[SMALEN];
232         uint32_t id;
233         layout_t layout;
234         node_t *root;
235         node_t *focus;
236         desktop_t *prev;
237         desktop_t *next;
238         padding_t padding;
239         int window_gap;
240         unsigned int border_width;
241 };
242
243 typedef struct monitor_t monitor_t;
244 struct monitor_t {
245         char name[SMALEN];
246         uint32_t id;
247         xcb_randr_output_t randr_id;
248         xcb_window_t root;
249         bool wired;
250         padding_t padding;
251         unsigned int sticky_count;
252         int window_gap;
253         unsigned int border_width;
254         xcb_rectangle_t rectangle;
255         desktop_t *desk;
256         desktop_t *desk_head;
257         desktop_t *desk_tail;
258         monitor_t *prev;
259         monitor_t *next;
260 };
261
262 typedef struct {
263         monitor_t *monitor;
264         desktop_t *desktop;
265         node_t *node;
266 } coordinates_t;
267
268 typedef struct history_t history_t;
269 struct history_t {
270         coordinates_t loc;
271         bool latest;
272         history_t *prev;
273         history_t *next;
274 };
275
276 typedef struct stacking_list_t stacking_list_t;
277 struct stacking_list_t {
278         node_t *node;
279         stacking_list_t *prev;
280         stacking_list_t *next;
281 };
282
283 typedef struct subscriber_list_t subscriber_list_t;
284 struct subscriber_list_t {
285         int fd;
286         FILE *stream;
287         int field;
288         subscriber_list_t *prev;
289         subscriber_list_t *next;
290 };
291
292 typedef struct rule_t rule_t;
293 struct rule_t {
294         char class_name[MAXLEN];
295         char instance_name[MAXLEN];
296         char effect[MAXLEN];
297         bool one_shot;
298         rule_t *prev;
299         rule_t *next;
300 };
301
302 typedef struct {
303         char class_name[3 * SMALEN / 2];
304         char instance_name[3 * SMALEN / 2];
305         char monitor_desc[MAXLEN];
306         char desktop_desc[MAXLEN];
307         char node_desc[MAXLEN];
308         char split_dir[SMALEN];
309         double split_ratio;
310         stack_layer_t *layer;
311         client_state_t *state;
312         bool locked;
313         bool sticky;
314         bool private;
315         bool center;
316         bool follow;
317         bool manage;
318         bool focus;
319         bool border;
320 } rule_consequence_t;
321
322 typedef struct pending_rule_t pending_rule_t;
323 struct pending_rule_t {
324         int fd;
325         xcb_window_t win;
326         rule_consequence_t *csq;
327         pending_rule_t *prev;
328         pending_rule_t *next;
329 };
330
331 #endif