]> git.lizzy.rs Git - bspwm.git/blob - types.h
*leaf_monocle*: only consider tiled windows
[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
28 #include <stdbool.h>
29 #include <xcb/xcb.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_STATE            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         CLIENT_TYPE_ALL,
49         CLIENT_TYPE_FLOATING,
50         CLIENT_TYPE_TILED
51 } client_type_t;
52
53 typedef enum {
54         CLIENT_CLASS_ALL,
55         CLIENT_CLASS_EQUAL,
56         CLIENT_CLASS_DIFFER
57 } client_class_t;
58
59 typedef enum {
60         CLIENT_MODE_ALL,
61         CLIENT_MODE_AUTOMATIC,
62         CLIENT_MODE_MANUAL
63 } client_mode_t;
64
65 typedef struct {
66         client_type_t type;
67         client_class_t class;
68         client_mode_t mode;
69         bool urgent;
70         bool local;
71         bool unfocused;
72 } client_select_t;
73
74 typedef enum {
75         ALTER_TOGGLE,
76         ALTER_SET
77 } alter_state_t;
78
79 typedef enum {
80         CYCLE_NEXT,
81         CYCLE_PREV
82 } cycle_dir_t;
83
84 typedef enum {
85         CIRCULATE_FORWARD,
86         CIRCULATE_BACKWARD
87 } circulate_dir_t;
88
89 typedef enum {
90         HISTORY_OLDER,
91         HISTORY_NEWER
92 } history_dir_t;
93
94 typedef enum {
95         DIR_RIGHT,
96         DIR_DOWN,
97         DIR_LEFT,
98         DIR_UP
99 } direction_t;
100
101 typedef enum {
102         CORNER_TOP_LEFT,
103         CORNER_TOP_RIGHT,
104         CORNER_BOTTOM_RIGHT,
105         CORNER_BOTTOM_LEFT
106 } corner_t;
107
108 typedef enum {
109         SIDE_LEFT,
110         SIDE_TOP,
111         SIDE_RIGHT,
112         SIDE_BOTTOM
113 } side_t;
114
115 typedef enum {
116         ACTION_NONE,
117         ACTION_FOCUS,
118         ACTION_MOVE,
119         ACTION_RESIZE_SIDE,
120         ACTION_RESIZE_CORNER
121 } pointer_action_t;
122
123 typedef enum {
124         LAYOUT_TILED,
125         LAYOUT_MONOCLE
126 } layout_t;
127
128 typedef enum {
129         FLIP_HORIZONTAL,
130         FLIP_VERTICAL
131 } flip_t;
132
133 typedef enum {
134         DESKTOP_STATUS_ALL,
135         DESKTOP_STATUS_FREE,
136         DESKTOP_STATUS_OCCUPIED
137 } desktop_status_t;
138
139 typedef enum {
140         DESKTOP_URGENCY_ALL,
141         DESKTOP_URGENCY_ON,
142         DESKTOP_URGENCY_OFF
143 } desktop_urgency_t;
144
145 typedef enum {
146         FIRST_CHILD,
147         SECOND_CHILD
148 } child_polarity_t;
149
150 typedef struct {
151         desktop_status_t status;
152         bool urgent;
153         bool local;
154 } desktop_select_t;
155
156 typedef struct {
157         xcb_window_t window;
158         char class_name[3 * SMALEN / 2];
159         char instance_name[3 * SMALEN / 2];
160         unsigned int border_width;
161         bool pseudo_tiled;
162         bool floating;
163         bool fullscreen;
164         bool locked;                            /* protects window from being closed */
165         bool sticky;
166         bool urgent;
167         bool private;
168         bool icccm_focus;
169         xcb_rectangle_t floating_rectangle;
170         xcb_rectangle_t tiled_rectangle;
171         uint16_t min_width;
172         uint16_t max_width;
173         uint16_t min_height;
174         uint16_t max_height;
175         xcb_atom_t wm_state[MAX_STATE];
176         int num_states;
177 } client_t;
178
179 typedef struct node_t node_t;
180 struct node_t {
181         split_type_t split_type;
182         double split_ratio;
183         split_mode_t split_mode;
184         direction_t split_dir;
185         int birth_rotation;
186         xcb_rectangle_t rectangle;
187         bool vacant;                            /* vacant nodes only hold floating clients */
188         int privacy_level;
189         node_t *first_child;
190         node_t *second_child;
191         node_t *parent;
192         client_t *client;                       /* NULL except for leaves */
193 };
194
195 typedef struct desktop_t desktop_t;
196 struct desktop_t {
197         char name[SMALEN];
198         layout_t layout;
199         node_t *root;
200         node_t *focus;
201         desktop_t *prev;
202         desktop_t *next;
203         int top_padding;
204         int right_padding;
205         int bottom_padding;
206         int left_padding;
207         int window_gap;
208         unsigned int border_width;
209         bool floating;
210 };
211
212 typedef struct monitor_t monitor_t;
213 struct monitor_t {
214         char name[SMALEN];
215         xcb_randr_output_t id;
216         xcb_rectangle_t rectangle;
217         xcb_window_t root;
218         bool wired;
219         int top_padding;
220         int right_padding;
221         int bottom_padding;
222         int left_padding;
223         desktop_t *desk;
224         desktop_t *desk_head;
225         desktop_t *desk_tail;
226         monitor_t *prev;
227         monitor_t *next;
228         int num_sticky;
229 };
230
231 typedef struct {
232         monitor_t *monitor;
233         desktop_t *desktop;
234         node_t *node;
235 } coordinates_t;
236
237 typedef struct history_t history_t;
238 struct history_t {
239         coordinates_t loc;
240         bool latest;
241         history_t *prev;
242         history_t *next;
243 };
244
245 typedef struct stacking_list_t stacking_list_t;
246 struct stacking_list_t {
247         node_t *node;
248         stacking_list_t *prev;
249         stacking_list_t *next;
250 };
251
252 typedef struct subscriber_list_t subscriber_list_t;
253 struct subscriber_list_t {
254         int fd;
255         FILE *stream;
256         int field;
257         subscriber_list_t *prev;
258         subscriber_list_t *next;
259 };
260
261 typedef struct rule_t rule_t;
262 struct rule_t {
263         char cause[MAXLEN];
264         char effect[MAXLEN];
265         bool one_shot;
266         rule_t *prev;
267         rule_t *next;
268 };
269
270 typedef struct {
271         char class_name[3 * SMALEN / 2];
272         char instance_name[3 * SMALEN / 2];
273         char monitor_desc[MAXLEN];
274         char desktop_desc[MAXLEN];
275         char node_desc[MAXLEN];
276         char split_dir[SMALEN];
277         double split_ratio;
278         uint16_t min_width;
279         uint16_t max_width;
280         uint16_t min_height;
281         uint16_t max_height;
282         bool pseudo_tiled;
283         bool floating;
284         bool fullscreen;
285         bool locked;
286         bool sticky;
287         bool private;
288         bool center;
289         bool follow;
290         bool manage;
291         bool focus;
292         bool border;
293 } rule_consequence_t;
294
295 typedef struct pending_rule_t pending_rule_t;
296 struct pending_rule_t {
297         int fd;
298         xcb_window_t win;
299         rule_consequence_t *csq;
300         pending_rule_t *prev;
301         pending_rule_t *next;
302 };
303
304 typedef struct {
305         xcb_point_t position;
306         pointer_action_t action;
307         xcb_rectangle_t rectangle;
308         node_t *vertical_fence;
309         node_t *horizontal_fence;
310         monitor_t *monitor;
311         desktop_t *desktop;
312         node_t *node;
313         client_t *client;
314         xcb_window_t window;
315         bool is_tiled;
316         double vertical_ratio;
317         double horizontal_ratio;
318         corner_t corner;
319         side_t side;
320 } pointer_state_t;
321
322 typedef struct {
323         node_t *fence;
324         unsigned int distance;
325 } fence_distance_t;
326
327 #endif