]> git.lizzy.rs Git - bspwm.git/blob - types.h
801a9048feddae858595718cbf4cfe1b8beb746c
[bspwm.git] / types.h
1 #ifndef _TYPES_H
2 #define _TYPES_H
3
4 #include <stdbool.h>
5 #include <xcb/xcb.h>
6 #include <xcb/randr.h>
7 #include <xcb/xcb_event.h>
8 #include "helpers.h"
9
10 #define MISSING_VALUE        "N/A"
11
12 typedef enum {
13     TYPE_HORIZONTAL,
14     TYPE_VERTICAL
15 } split_type_t;
16
17 typedef enum {
18     MODE_AUTOMATIC,
19     MODE_MANUAL
20 } split_mode_t;
21
22 typedef enum {
23     MOVE_PULL,
24     MOVE_PUSH
25 } fence_move_t;
26
27 typedef enum {
28     CHANGE_INCREASE,
29     CHANGE_DECREASE
30 } value_change_t;
31
32 typedef enum {
33     CLIENT_TYPE_ALL,
34     CLIENT_TYPE_FLOATING,
35     CLIENT_TYPE_TILED
36 } client_type_t;
37
38 typedef enum {
39     CLIENT_CLASS_ALL,
40     CLIENT_CLASS_EQUAL,
41     CLIENT_CLASS_DIFFER
42 } client_class_t;
43
44 typedef enum {
45     CLIENT_MODE_ALL,
46     CLIENT_MODE_AUTOMATIC,
47     CLIENT_MODE_MANUAL
48 } client_mode_t;
49
50 typedef enum {
51     CLIENT_URGENCY_ALL,
52     CLIENT_URGENCY_ON,
53     CLIENT_URGENCY_OFF
54 } client_urgency_t;
55
56 typedef struct {
57     client_type_t type;
58     client_class_t class;
59     client_mode_t mode;
60     client_urgency_t urgency;
61 } client_select_t;
62
63 typedef enum {
64     ALTER_NONE,
65     ALTER_TOGGLE,
66     ALTER_SET
67 } state_alter_t;
68
69 typedef enum {
70     CYCLE_NEXT,
71     CYCLE_PREV
72 } cycle_dir_t;
73
74 typedef enum {
75     CIRCULATE_FORWARD,
76     CIRCULATE_BACKWARD
77 } circulate_dir_t;
78
79 typedef enum {
80     DIR_RIGHT,
81     DIR_DOWN,
82     DIR_LEFT,
83     DIR_UP
84 } direction_t;
85
86 typedef enum {
87     CORNER_TOP_LEFT,
88     CORNER_TOP_RIGHT,
89     CORNER_BOTTOM_RIGHT,
90     CORNER_BOTTOM_LEFT
91 } corner_t;
92
93 typedef enum {
94     SIDE_LEFT,
95     SIDE_TOP,
96     SIDE_RIGHT,
97     SIDE_BOTTOM
98 } side_t;
99
100 typedef enum {
101     ACTION_NONE,
102     ACTION_FOCUS,
103     ACTION_MOVE,
104     ACTION_RESIZE_SIDE,
105     ACTION_RESIZE_CORNER
106 } pointer_action_t;
107
108 typedef enum {
109     LAYOUT_TILED,
110     LAYOUT_MONOCLE
111 } layout_t;
112
113 typedef enum {
114     FLIP_HORIZONTAL,
115     FLIP_VERTICAL
116 } flip_t;
117
118 typedef enum {
119     DESKTOP_STATUS_ALL,
120     DESKTOP_STATUS_FREE,
121     DESKTOP_STATUS_OCCUPIED
122 } desktop_status_t;
123
124 typedef enum {
125     DESKTOP_URGENCY_ALL,
126     DESKTOP_URGENCY_ON,
127     DESKTOP_URGENCY_OFF
128 } desktop_urgency_t;
129
130 typedef struct {
131     desktop_status_t status;
132     desktop_urgency_t urgency;
133 } desktop_select_t;
134
135 typedef struct {
136     xcb_window_t window;
137     char class_name[SMALEN];
138     unsigned int border_width;
139     bool floating;
140     bool transient;    /* transient window are always floating */
141     bool fullscreen;
142     bool locked;       /* protects window from being closed */
143     bool urgent;
144     bool icccm_focus;
145     xcb_rectangle_t floating_rectangle;
146     xcb_rectangle_t tiled_rectangle;
147 } client_t;
148
149 typedef struct node_t node_t;
150 struct node_t {
151     split_type_t split_type;
152     double split_ratio;
153     split_mode_t split_mode;
154     direction_t split_dir;
155     int birth_rotation;
156     xcb_rectangle_t rectangle;
157     bool vacant;          /* vacant nodes only hold floating clients */
158     node_t *first_child;
159     node_t *second_child;
160     node_t *parent;
161     client_t *client;     /* NULL except for leaves */
162 };
163
164 typedef struct desktop_t desktop_t;
165 struct desktop_t {
166     char name[SMALEN];
167     layout_t layout;
168     node_t *root;
169     node_t *focus;
170     desktop_t *prev;
171     desktop_t *next;
172     int window_gap;
173     unsigned int border_width;
174 };
175
176 typedef struct monitor_t monitor_t;
177 struct monitor_t {
178     char name[SMALEN];
179     xcb_randr_output_t id;
180     xcb_rectangle_t rectangle;
181     xcb_window_t root;
182     bool wired;
183     int top_padding;
184     int right_padding;
185     int bottom_padding;
186     int left_padding;
187     desktop_t *desk;
188     desktop_t *desk_head;
189     desktop_t *desk_tail;
190     monitor_t *prev;
191     monitor_t *next;
192 };
193
194 typedef struct {
195     monitor_t *monitor;
196     desktop_t *desktop;
197     node_t *node;
198 } coordinates_t;
199
200 typedef struct history_t history_t;
201 struct history_t {
202     coordinates_t loc;
203     bool latest;
204     history_t *prev;
205     history_t *next;
206 };
207
208 typedef struct stack_t stack_t;
209 struct stack_t {
210     node_t *node;
211     stack_t *prev;
212     stack_t *next;
213 };
214
215 typedef struct {
216     char name[SMALEN];
217 } rule_cause_t;
218
219 typedef struct {
220     bool floating;
221     bool fullscreen;
222     bool locked;
223     bool follow;
224     bool focus;
225     bool unmanage;
226     char desc[MAXLEN];
227 } rule_effect_t;
228
229 typedef struct rule_t rule_t;
230 struct rule_t {
231     unsigned int uid;
232     bool one_shot;
233     rule_cause_t cause;
234     rule_effect_t effect;
235     rule_t *prev;
236     rule_t *next;
237 };
238
239 typedef struct {
240     xcb_point_t position;
241     pointer_action_t action;
242     xcb_rectangle_t rectangle;
243     node_t *vertical_fence;
244     node_t *horizontal_fence;
245     monitor_t *monitor;
246     desktop_t *desktop;
247     node_t *node;
248     client_t *client;
249     xcb_window_t window;
250     bool is_tiled;
251     double vertical_ratio;
252     double horizontal_ratio;
253     corner_t corner;
254     side_t side;
255 } pointer_state_t;
256
257 typedef struct {
258     node_t *fence;
259     unsigned int distance;
260 } fence_distance_t;
261
262 #endif