]> git.lizzy.rs Git - bspwm.git/blob - types.h
ea48f3b3a96d7f67fcf8f2412cc030769a4b5c03
[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     SKIP_NONE,
46     SKIP_FLOATING,
47     SKIP_TILED,
48     SKIP_CLASS_EQUAL,
49     SKIP_CLASS_DIFFER
50 } skip_client_t;
51
52 typedef enum {
53     CYCLE_NEXT,
54     CYCLE_PREV
55 } cycle_dir_t;
56
57 typedef enum {
58     NEAREST_OLDER,
59     NEAREST_NEWER
60 } nearest_arg_t;
61
62 typedef enum {
63     ROTATE_CLOCKWISE,
64     ROTATE_COUNTER_CLOCKWISE,
65     ROTATE_FULL_CYCLE
66 } rotate_t;
67
68 typedef enum {
69     DIR_LEFT,
70     DIR_RIGHT,
71     DIR_UP,
72     DIR_DOWN
73 } direction_t;
74
75 typedef enum {
76     TOP_LEFT,
77     TOP_RIGHT,
78     BOTTOM_LEFT,
79     BOTTOM_RIGHT
80 } corner_t;
81
82 typedef struct {
83     xcb_window_t window;
84     unsigned int uid;
85     char class_name[MAXLEN];
86     unsigned int border_width;
87     bool floating;
88     bool transient;  /* transient window are always floating */
89     bool fullscreen;
90     bool locked;     /* protects window from being closed */
91     bool urgent;
92     xcb_rectangle_t floating_rectangle;
93     xcb_rectangle_t tiled_rectangle;
94 } client_t;
95
96 typedef struct node_t node_t;
97 struct node_t {
98     split_type_t split_type;
99     double split_ratio;
100     xcb_rectangle_t rectangle;
101     bool vacant;          /* vacant nodes only hold floating clients */
102     split_mode_t born_as;
103     node_t *first_child;
104     node_t *second_child;
105     node_t *parent;
106     client_t *client;     /* NULL except for leaves */
107 };
108
109 typedef struct desktop_t desktop_t;
110 struct desktop_t {
111     char name[MAXLEN];
112     layout_t layout;
113     node_t *root;
114     node_t *focus;
115     node_t *last_focus;
116     desktop_t *prev;
117     desktop_t *next;
118 };
119
120 typedef struct monitor_t monitor_t;
121 struct monitor_t {
122     char name[MAXLEN];
123     xcb_rectangle_t rectangle;
124     desktop_t *desk;
125     desktop_t *last_desk;
126     desktop_t *desk_head;
127     desktop_t *desk_tail;
128     monitor_t *prev;
129     monitor_t *next;
130 };
131
132 typedef struct {
133     char name[MAXLEN];
134 } rule_cause_t;
135
136 typedef struct {
137     bool floating;
138 } rule_effect_t;
139
140 typedef struct rule_t rule_t;
141 struct rule_t {
142     rule_cause_t cause;
143     rule_effect_t effect;
144     rule_t *next;
145 };
146
147 typedef struct {
148     node_t *node;
149     desktop_t *desktop;
150     monitor_t *monitor;
151 } window_location_t;
152
153 typedef struct {
154     desktop_t *desktop;
155     monitor_t *monitor;
156 } desktop_location_t;
157
158 typedef struct {
159     xcb_point_t position;
160     xcb_button_t button;
161     xcb_rectangle_t rectangle;
162     monitor_t *monitor;
163     desktop_t *desktop;
164     node_t *node;
165     corner_t corner;
166 } pointer_state_t;
167
168 node_t *make_node(void);
169 monitor_t *make_monitor(xcb_rectangle_t *);
170 desktop_t *make_desktop(const char *);
171 client_t *make_client(xcb_window_t);
172 rule_t *make_rule(void);
173 pointer_state_t *make_pointer_state(void);
174
175 #endif