1 /* Copyright (c) 2012, Bastien Dejean
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * 1. Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <xcb/xcb_icccm.h>
30 #include <xcb/randr.h>
31 #include <xcb/xcb_event.h>
34 #define MISSING_VALUE "N/A"
35 #define MAX_WM_STATES 4
55 WM_FLAG_MODAL = 1 << 0,
56 WM_FLAG_STICKY = 1 << 1,
57 WM_FLAG_MAXIMIZED_VERT = 1 << 2,
58 WM_FLAG_MAXIMIZED_HORZ = 1 << 3,
59 WM_FLAG_SHADED = 1 << 4,
60 WM_FLAG_SKIP_TASKBAR = 1 << 5,
61 WM_FLAG_SKIP_PAGER = 1 << 6,
62 WM_FLAG_HIDDEN = 1 << 7,
63 WM_FLAG_FULLSCREEN = 1 << 8,
64 WM_FLAG_ABOVE = 1 << 9,
65 WM_FLAG_BELOW = 1 << 10,
66 WM_FLAG_DEMANDS_ATTENTION = 1 << 11,
109 HANDLE_LEFT = 1 << 0,
111 HANDLE_RIGHT = 1 << 2,
112 HANDLE_BOTTOM = 1 << 3,
113 HANDLE_TOP_LEFT = HANDLE_TOP | HANDLE_LEFT,
114 HANDLE_TOP_RIGHT = HANDLE_TOP | HANDLE_RIGHT,
115 HANDLE_BOTTOM_RIGHT = HANDLE_BOTTOM | HANDLE_RIGHT,
116 HANDLE_BOTTOM_LEFT = HANDLE_BOTTOM | HANDLE_LEFT
148 option_bool_t automatic;
149 option_bool_t focused;
151 option_bool_t active;
153 option_bool_t window;
155 option_bool_t pseudo_tiled;
156 option_bool_t floating;
157 option_bool_t fullscreen;
158 option_bool_t hidden;
159 option_bool_t sticky;
160 option_bool_t private;
161 option_bool_t locked;
162 option_bool_t urgent;
163 option_bool_t same_class;
164 option_bool_t descendant_of;
165 option_bool_t ancestor_of;
167 option_bool_t normal;
172 option_bool_t occupied;
173 option_bool_t focused;
174 option_bool_t urgent;
179 option_bool_t occupied;
180 option_bool_t focused;
183 typedef struct icccm_props_t icccm_props_t;
184 struct icccm_props_t {
191 char class_name[3 * SMALEN / 2];
192 char instance_name[3 * SMALEN / 2];
193 unsigned int border_width;
196 client_state_t state;
197 client_state_t last_state;
199 stack_layer_t last_layer;
200 xcb_rectangle_t floating_rectangle;
201 xcb_rectangle_t tiled_rectangle;
202 xcb_size_hints_t size_hints;
203 icccm_props_t icccm_props;
207 typedef struct presel_t presel_t;
210 direction_t split_dir;
211 xcb_window_t feedback;
214 typedef struct constraints_t constraints_t;
215 struct constraints_t {
220 typedef struct node_t node_t;
223 split_type_t split_type;
227 xcb_rectangle_t rectangle;
228 constraints_t constraints;
235 node_t *second_child;
240 typedef struct padding_t padding_t;
248 typedef struct desktop_t desktop_t;
259 unsigned int border_width;
262 typedef struct monitor_t monitor_t;
266 xcb_randr_output_t randr_id;
270 unsigned int sticky_count;
272 unsigned int border_width;
273 xcb_rectangle_t rectangle;
275 desktop_t *desk_head;
276 desktop_t *desk_tail;
287 typedef struct history_t history_t;
295 typedef struct stacking_list_t stacking_list_t;
296 struct stacking_list_t {
298 stacking_list_t *prev;
299 stacking_list_t *next;
302 typedef struct subscriber_list_t subscriber_list_t;
303 struct subscriber_list_t {
308 subscriber_list_t *prev;
309 subscriber_list_t *next;
312 typedef struct rule_t rule_t;
314 char class_name[MAXLEN];
315 char instance_name[MAXLEN];
323 char class_name[3 * SMALEN / 2];
324 char instance_name[3 * SMALEN / 2];
325 char monitor_desc[MAXLEN];
326 char desktop_desc[MAXLEN];
327 char node_desc[MAXLEN];
328 char split_dir[SMALEN];
330 stack_layer_t *layer;
331 client_state_t *state;
341 xcb_rectangle_t *rect;
342 } rule_consequence_t;
344 typedef struct pending_rule_t pending_rule_t;
345 struct pending_rule_t {
348 rule_consequence_t *csq;
349 pending_rule_t *prev;
350 pending_rule_t *next;