]> git.lizzy.rs Git - bspwm.git/blob - types.h
Implement sticky windows
[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 sticky;
144     bool urgent;
145     bool icccm_focus;
146     xcb_rectangle_t floating_rectangle;
147     xcb_rectangle_t tiled_rectangle;
148 } client_t;
149
150 typedef struct node_t node_t;
151 struct node_t {
152     split_type_t split_type;
153     double split_ratio;
154     split_mode_t split_mode;
155     direction_t split_dir;
156     int birth_rotation;
157     xcb_rectangle_t rectangle;
158     bool vacant;          /* vacant nodes only hold floating clients */
159     node_t *first_child;
160     node_t *second_child;
161     node_t *parent;
162     client_t *client;     /* NULL except for leaves */
163 };
164
165 typedef struct desktop_t desktop_t;
166 struct desktop_t {
167     char name[SMALEN];
168     layout_t layout;
169     node_t *root;
170     node_t *focus;
171     desktop_t *prev;
172     desktop_t *next;
173     int window_gap;
174     unsigned int border_width;
175     int num_sticky;
176 };
177
178 typedef struct monitor_t monitor_t;
179 struct monitor_t {
180     char name[SMALEN];
181     xcb_randr_output_t id;
182     xcb_rectangle_t rectangle;
183     xcb_window_t root;
184     bool wired;
185     int top_padding;
186     int right_padding;
187     int bottom_padding;
188     int left_padding;
189     desktop_t *desk;
190     desktop_t *desk_head;
191     desktop_t *desk_tail;
192     monitor_t *prev;
193     monitor_t *next;
194 };
195
196 typedef struct {
197     monitor_t *monitor;
198     desktop_t *desktop;
199     node_t *node;
200 } coordinates_t;
201
202 typedef struct history_t history_t;
203 struct history_t {
204     coordinates_t loc;
205     bool latest;
206     history_t *prev;
207     history_t *next;
208 };
209
210 typedef struct stack_t stack_t;
211 struct stack_t {
212     node_t *node;
213     stack_t *prev;
214     stack_t *next;
215 };
216
217 typedef struct {
218     char name[SMALEN];
219 } rule_cause_t;
220
221 typedef struct {
222     bool floating;
223     bool fullscreen;
224     bool locked;
225     bool sticky;
226     bool follow;
227     bool focus;
228     bool unmanage;
229     char desc[MAXLEN];
230 } rule_effect_t;
231
232 typedef struct rule_t rule_t;
233 struct rule_t {
234     unsigned int uid;
235     bool one_shot;
236     rule_cause_t cause;
237     rule_effect_t effect;
238     rule_t *prev;
239     rule_t *next;
240 };
241
242 typedef struct {
243     xcb_point_t position;
244     pointer_action_t action;
245     xcb_rectangle_t rectangle;
246     node_t *vertical_fence;
247     node_t *horizontal_fence;
248     monitor_t *monitor;
249     desktop_t *desktop;
250     node_t *node;
251     client_t *client;
252     xcb_window_t window;
253     bool is_tiled;
254     double vertical_ratio;
255     double horizontal_ratio;
256     corner_t corner;
257     side_t side;
258 } pointer_state_t;
259
260 typedef struct {
261     node_t *fence;
262     unsigned int distance;
263 } fence_distance_t;
264
265 #endif