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