awesomerc: do not change windows screen if filtered out.
[awesome.git] / structs.h
blob97beb40af949cda4cb4409f0a5480d3eea43adb7
1 /*
2 * structs.h - basic structs header
4 * Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef AWESOME_STRUCTS_H
23 #define AWESOME_STRUCTS_H
25 #include <xcb/xcb_icccm.h>
26 #include <xcb/xcb_property.h>
28 #include "config.h"
29 #include "luaa.h"
30 #include "swindow.h"
31 #include "key.h"
32 #include "common/xutil.h"
33 #include "common/xembed.h"
34 #include "common/refcount.h"
35 #include "common/tokenize.h"
37 /** Windows type */
38 typedef enum
40 WINDOW_TYPE_NORMAL = 0,
41 WINDOW_TYPE_DESKTOP,
42 WINDOW_TYPE_DOCK,
43 WINDOW_TYPE_SPLASH,
44 WINDOW_TYPE_DIALOG,
45 /* The ones below may have TRANSIENT_FOR, but are not plain dialogs.
46 * They were purposefully placed below DIALOG.
48 WINDOW_TYPE_MENU,
49 WINDOW_TYPE_TOOLBAR,
50 WINDOW_TYPE_UTILITY
51 } window_type_t;
53 /** Wibox types */
54 typedef enum
56 WIBOX_TYPE_NORMAL = 0,
57 WIBOX_TYPE_TITLEBAR
58 } wibox_type_t;
60 typedef struct button_t button_t;
61 typedef struct widget_t widget_t;
62 typedef struct widget_node_t widget_node_t;
63 typedef struct client_t client_t;
64 typedef struct client_node client_node_t;
65 typedef struct tag tag_t;
66 typedef struct tag_client_node_t tag_client_node_t;
67 typedef widget_t *(widget_constructor_t)(widget_t *);
68 typedef void (widget_destructor_t)(widget_t *);
69 typedef struct awesome_t awesome_t;
71 ARRAY_TYPE(widget_node_t, widget_node)
72 ARRAY_TYPE(button_t *, button)
74 /** Wibox type */
75 typedef struct
77 /** Ref count */
78 int refcount;
79 /** Ontop */
80 bool ontop;
81 /** Visible */
82 bool isvisible;
83 /** Position */
84 position_t position;
85 /** Wibox type */
86 wibox_type_t type;
87 /** Window */
88 simple_window_t sw;
89 /** Alignment */
90 alignment_t align;
91 /** Screen */
92 int screen;
93 /** Widget list */
94 widget_node_array_t widgets;
95 luaA_ref widgets_table;
96 /** Widget the mouse is over */
97 widget_t *mouse_over;
98 /** Need update */
99 bool need_update;
100 /** Cursor */
101 char *cursor;
102 /** Button bindings */
103 button_array_t buttons;
104 } wibox_t;
105 ARRAY_TYPE(wibox_t *, wibox)
107 /** Widget */
108 struct widget_t
110 /** Ref count */
111 int refcount;
112 /** Widget type is constructor */
113 widget_constructor_t *type;
114 /** Widget destructor */
115 widget_destructor_t *destructor;
116 /** Geometry function */
117 area_t (*geometry)(widget_t *, int, int, int);
118 /** Draw function */
119 void (*draw)(widget_t *, draw_context_t *, area_t, int, wibox_t *);
120 /** Index function */
121 int (*index)(lua_State *, awesome_token_t);
122 /** Newindex function */
123 int (*newindex)(lua_State *, awesome_token_t);
124 /** Mouse over event handler */
125 luaA_ref mouse_enter, mouse_leave;
126 /** Alignement */
127 alignment_t align;
128 /** Supported alignment */
129 alignment_t align_supported;
130 /** Misc private data */
131 void *data;
132 /** Button bindings */
133 button_array_t buttons;
134 /** True if the widget is visible */
135 bool isvisible;
138 /* Strut */
139 typedef struct
141 uint16_t left, right, top, bottom;
142 uint16_t left_start_y, left_end_y;
143 uint16_t right_start_y, right_end_y;
144 uint16_t top_start_x, top_end_x;
145 uint16_t bottom_start_x, bottom_end_x;
146 } strut_t;
148 /** client_t type */
149 struct client_t
151 /** Ref counter */
152 int refcount;
153 /** Valid, or not ? */
154 bool invalid;
155 /** Client name */
156 char *name, *icon_name;
157 /** Window geometry */
158 area_t geometry;
159 struct
161 /** Client geometry when (un)fullscreen */
162 area_t fullscreen;
163 /** Client geometry when (un)-max */
164 area_t max;
165 /** Internal geometry (matching X11 protocol) */
166 area_t internal;
167 } geometries;
168 /** Strut */
169 strut_t strut;
170 /** Border width and pre-fullscreen border width */
171 int border, border_fs;
172 xcolor_t border_color;
173 /** True if the client is sticky */
174 bool issticky;
175 /** Has urgency hint */
176 bool isurgent;
177 /** True if the client is hidden */
178 bool ishidden;
179 /** True if the client is minimized */
180 bool isminimized;
181 /** True if the client is fullscreen */
182 bool isfullscreen;
183 /** True if the client is maximized horizontally */
184 bool ismaxhoriz;
185 /** True if the client is maximized vertically */
186 bool ismaxvert;
187 /** True if the client is above others */
188 bool isabove;
189 /** True if the client is below others */
190 bool isbelow;
191 /** True if the client is modal */
192 bool ismodal;
193 /** True if the client is on top */
194 bool isontop;
195 /** True if a client is banned to a position outside the viewport.
196 * Note that the geometry remains unchanged and that the window is still mapped.
198 bool isbanned;
199 /** true if the client must be skipped from task bar client list */
200 bool skiptb;
201 /** True if the client cannot have focus */
202 bool nofocus;
203 /** The window type */
204 window_type_t type;
205 /** Window of the client */
206 xcb_window_t win;
207 /** Window of the group leader */
208 xcb_window_t group_win;
209 /** Window holding command needed to start it (session management related) */
210 xcb_window_t leader_win;
211 /** Client logical screen */
212 int screen;
213 /** Client physical screen */
214 int phys_screen;
215 /** Path to an icon */
216 char *icon_path;
217 /** Titlebar */
218 wibox_t *titlebar;
219 /** Button bindings */
220 button_array_t buttons;
221 /** Icon */
222 image_t *icon;
223 /** Size hints */
224 xcb_size_hints_t size_hints;
225 bool size_hints_honor;
226 /** Window it is transient for */
227 client_t *transient_for;
228 /** Next and previous clients */
229 client_t *prev, *next;
231 ARRAY_TYPE(client_t *, client)
233 /** Tag type */
234 struct tag
236 /** Ref count */
237 int refcount;
238 /** Tag name */
239 char *name;
240 /** Screen */
241 int screen;
242 /** true if selected */
243 bool selected;
244 /** clients in this tag */
245 client_array_t clients;
247 ARRAY_TYPE(tag_t *, tag)
249 typedef struct
251 /** Screen index */
252 int index;
253 /** Screen geometry */
254 area_t geometry;
255 /** true if we need to arrange() */
256 bool need_arrange;
257 /** Tag list */
258 tag_array_t tags;
259 /** Wiboxes */
260 wibox_array_t wiboxes;
261 /** Padding */
262 padding_t padding;
263 /** Window that contains the systray */
264 struct
266 xcb_window_t window;
267 /** Systray window parent */
268 xcb_window_t parent;
269 } systray;
270 /** Focused client */
271 client_t *client_focus;
272 } screen_t;
274 /** Main configuration structure */
275 struct awesome_t
277 /** Connection ref */
278 xcb_connection_t *connection;
279 /** Event and error handlers */
280 xcb_event_handlers_t evenths;
281 /** Property change handler */
282 xcb_property_handlers_t prophs;
283 /** Default screen number */
284 int default_screen;
285 /** Keys symbol table */
286 xcb_key_symbols_t *keysyms;
287 /** Logical screens */
288 screen_t *screens;
289 /** Number of screens */
290 int nscreen;
291 /** True if xinerama is active */
292 bool xinerama_is_active;
293 /** Key bindings */
294 struct
296 key_array_t by_code;
297 key_array_t by_sym;
298 } keys;
299 /** Mouse bindings list */
300 button_array_t buttons;
301 /** Numlock mask */
302 unsigned int numlockmask;
303 /** Numlock mask */
304 unsigned int shiftlockmask;
305 /** Numlock mask */
306 unsigned int capslockmask;
307 /** Check for XRandR extension */
308 bool have_randr;
309 /** Clients list */
310 client_t *clients;
311 /** Embedded windows */
312 xembed_window_array_t embedded;
313 /** Path to config file */
314 char *conffile;
315 /** Stack client history */
316 client_node_t *stack;
317 /** Command line passed to awesome */
318 char *argv;
319 /** Last XMotionEvent coords */
320 int pointer_x, pointer_y;
321 /** Lua VM state */
322 lua_State *L;
323 /** Default colors */
324 struct
326 xcolor_t fg, bg;
327 } colors;
328 /** Default font */
329 font_t *font;
330 struct
332 /** Command to execute when spawning a new client */
333 luaA_ref manage;
334 /** Command to execute when unmanaging client */
335 luaA_ref unmanage;
336 /** Command to execute when giving focus to a client */
337 luaA_ref focus;
338 /** Command to execute when removing focus to a client */
339 luaA_ref unfocus;
340 /** Command to run when mouse enter a client */
341 luaA_ref mouse_enter;
342 /** Command to run when mouse leave a client */
343 luaA_ref mouse_leave;
344 /** Command to run on arrange */
345 luaA_ref arrange;
346 /** Command to run when client list changes */
347 luaA_ref clients;
348 /** Command to run on numbers of tag changes */
349 luaA_ref tags;
350 /** Command to run when client gets (un)tagged */
351 luaA_ref tagged;
352 /** Command to run on property change */
353 luaA_ref property;
354 /** Command to run on time */
355 luaA_ref timer;
356 #ifdef WITH_DBUS
357 /** Command to run on dbus events */
358 luaA_ref dbus;
359 #endif
360 } hooks;
361 /** The event loop */
362 struct ev_loop *loop;
363 /** The timeout after which we need to stop select() */
364 struct ev_timer timer;
365 /** The key grabber function */
366 luaA_ref keygrabber;
367 /** The mouse pointer grabber function */
368 luaA_ref mousegrabber;
369 /** Focused screen */
370 screen_t *screen_focus;
373 #endif
374 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80