]> git.lizzy.rs Git - bspwm.git/blob - types.h
5f02f352edfc7f864a16fcd2b46452b98ed8c753
[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/xcb_event.h>
7 #include "helpers.h"
8
9 #define SPLIT_RATIO  0.5
10 #define DEFAULT_DESK_NAME    "Desktop"
11 #define DEFAULT_MON_NAME     "Monitor"
12 #define MISSING_VALUE        "N/A"
13
14 typedef enum {
15     TYPE_HORIZONTAL,
16     TYPE_VERTICAL
17 } split_type_t;
18
19 typedef enum {
20     MODE_AUTOMATIC,
21     MODE_MANUAL
22 } split_mode_t;
23
24 typedef enum {
25     LAYOUT_TILED,
26     LAYOUT_MONOCLE
27 } layout_t;
28
29 typedef enum {
30     MOVE_PULL,
31     MOVE_PUSH
32 } fence_move_t;
33
34 typedef enum {
35     CHANGE_INCREASE,
36     CHANGE_DECREASE
37 } value_change_t;
38
39 typedef enum {
40     LIST_OPTION_VERBOSE,
41     LIST_OPTION_QUIET
42 } list_option_t;
43
44 typedef enum {
45     CLIENT_SKIP_NONE,
46     CLIENT_SKIP_FLOATING,
47     CLIENT_SKIP_TILED,
48     CLIENT_SKIP_CLASS_EQUAL,
49     CLIENT_SKIP_CLASS_DIFFER
50 } skip_client_t;
51
52 typedef enum {
53     DESKTOP_SKIP_NONE,
54     DESKTOP_SKIP_FREE,
55     DESKTOP_SKIP_OCCUPIED
56 } skip_desktop_t;
57
58 typedef enum {
59     CYCLE_NEXT,
60     CYCLE_PREV
61 } cycle_dir_t;
62
63 typedef enum {
64     NEAREST_OLDER,
65     NEAREST_NEWER
66 } nearest_arg_t;
67
68 typedef enum {
69     CIRCULATE_FORWARD,
70     CIRCULATE_BACKWARD
71 } circulate_dir_t;
72
73 typedef enum {
74     ROTATE_CLOCKWISE,
75     ROTATE_COUNTER_CLOCKWISE,
76     ROTATE_FULL_CYCLE
77 } rotate_t;
78
79 typedef enum {
80     DIR_LEFT,
81     DIR_RIGHT,
82     DIR_UP,
83     DIR_DOWN
84 } direction_t;
85
86 typedef enum {
87     TOP_LEFT,
88     TOP_RIGHT,
89     BOTTOM_LEFT,
90     BOTTOM_RIGHT
91 } corner_t;
92
93 typedef struct {
94     xcb_window_t window;
95     unsigned int uid;
96     char class_name[MAXLEN];
97     unsigned int border_width;
98     bool floating;
99     bool transient;  /* transient window are always floating */
100     bool fullscreen;
101     bool locked;     /* protects window from being closed */
102     bool urgent;
103     xcb_rectangle_t floating_rectangle;
104     xcb_rectangle_t tiled_rectangle;
105 } client_t;
106
107 typedef struct node_t node_t;
108 struct node_t {
109     split_type_t split_type;
110     double split_ratio;
111     xcb_rectangle_t rectangle;
112     bool vacant;          /* vacant nodes only hold floating clients */
113     split_mode_t born_as;
114     node_t *first_child;
115     node_t *second_child;
116     node_t *parent;
117     client_t *client;     /* NULL except for leaves */
118 };
119
120 typedef struct desktop_t desktop_t;
121 struct desktop_t {
122     char name[MAXLEN];
123     layout_t layout;
124     node_t *root;
125     node_t *focus;
126     node_t *last_focus;
127     desktop_t *prev;
128     desktop_t *next;
129 };
130
131 typedef struct monitor_t monitor_t;
132 struct monitor_t {
133     char name[MAXLEN];
134     xcb_rectangle_t rectangle;
135     desktop_t *desk;
136     desktop_t *last_desk;
137     desktop_t *desk_head;
138     desktop_t *desk_tail;
139     monitor_t *prev;
140     monitor_t *next;
141 };
142
143 typedef struct {
144     char name[MAXLEN];
145 } rule_cause_t;
146
147 typedef struct {
148     bool floating;
149 } rule_effect_t;
150
151 typedef struct rule_t rule_t;
152 struct rule_t {
153     rule_cause_t cause;
154     rule_effect_t effect;
155     rule_t *next;
156 };
157
158 typedef struct {
159     node_t *node;
160     desktop_t *desktop;
161     monitor_t *monitor;
162 } window_location_t;
163
164 typedef struct {
165     desktop_t *desktop;
166     monitor_t *monitor;
167 } desktop_location_t;
168
169 typedef struct {
170     xcb_point_t position;
171     xcb_button_t button;
172     xcb_rectangle_t rectangle;
173     monitor_t *monitor;
174     desktop_t *desktop;
175     node_t *node;
176     corner_t corner;
177 } pointer_state_t;
178
179 node_t *make_node(void);
180 monitor_t *make_monitor(xcb_rectangle_t *);
181 desktop_t *make_desktop(const char *);
182 client_t *make_client(xcb_window_t);
183 rule_t *make_rule(void);
184 pointer_state_t *make_pointer_state(void);
185
186 #endif