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