]> git.lizzy.rs Git - bspwm.git/blob - types.h
Move a few functions from tree to desktop/monitor
[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[MAXLEN];
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 node_list_t node_list_t;
165 struct node_list_t {
166     node_t *node;
167     bool latest;
168     node_list_t *prev;
169     node_list_t *next;
170 };
171
172 typedef struct {
173     node_list_t *head;
174     node_list_t *tail;
175 } focus_history_t;
176
177 typedef struct desktop_t desktop_t;
178 struct desktop_t {
179     char name[MAXLEN];
180     layout_t layout;
181     node_t *root;
182     node_t *focus;
183     focus_history_t *history;
184     desktop_t *prev;
185     desktop_t *next;
186     int window_gap;
187 };
188
189 typedef struct monitor_t monitor_t;
190 struct monitor_t {
191     char name[MAXLEN];
192     xcb_randr_output_t id;
193     xcb_rectangle_t rectangle;
194     bool wired;
195     int top_padding;
196     int right_padding;
197     int bottom_padding;
198     int left_padding;
199     desktop_t *desk;
200     desktop_t *last_desk;
201     desktop_t *desk_head;
202     desktop_t *desk_tail;
203     monitor_t *prev;
204     monitor_t *next;
205 };
206
207 typedef struct {
208     monitor_t *monitor;
209     desktop_t *desktop;
210     node_t *node;
211 } coordinates_t;
212
213 typedef struct {
214     char name[MAXLEN];
215 } rule_cause_t;
216
217 typedef struct {
218     bool floating;
219     bool fullscreen;
220     bool locked;
221     bool follow;
222     bool focus;
223     bool unmanage;
224     char desc[MAXLEN];
225 } rule_effect_t;
226
227 typedef struct rule_t rule_t;
228 struct rule_t {
229     unsigned int uid;
230     bool one_shot;
231     rule_cause_t cause;
232     rule_effect_t effect;
233     rule_t *prev;
234     rule_t *next;
235 };
236
237 typedef struct {
238     xcb_point_t position;
239     pointer_action_t action;
240     xcb_rectangle_t rectangle;
241     node_t *vertical_fence;
242     node_t *horizontal_fence;
243     monitor_t *monitor;
244     desktop_t *desktop;
245     node_t *node;
246     client_t *client;
247     xcb_window_t window;
248     bool is_tiled;
249     double vertical_ratio;
250     double horizontal_ratio;
251     corner_t corner;
252     side_t side;
253 } pointer_state_t;
254
255 typedef struct {
256     node_t *fence;
257     unsigned int distance;
258 } fence_distance_t;
259
260 #endif