naughty: check for D-Bus availability
[awesome.git] / structs.h
bloba0cfc4465e4e015dffec713c8811db15939e0dfa
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 /** Key bindings */
222 keybindings_t keys;
223 /** Icon */
224 image_t *icon;
225 /** Size hints */
226 xcb_size_hints_t size_hints;
227 bool size_hints_honor;
228 /** Window it is transient for */
229 client_t *transient_for;
230 /** Next and previous clients */
231 client_t *prev, *next;
233 ARRAY_TYPE(client_t *, client)
235 /** Tag type */
236 struct tag
238 /** Ref count */
239 int refcount;
240 /** Tag name */
241 char *name;
242 /** Screen */
243 int screen;
244 /** true if selected */
245 bool selected;
246 /** clients in this tag */
247 client_array_t clients;
249 ARRAY_TYPE(tag_t *, tag)
251 typedef struct
253 /** Screen index */
254 int index;
255 /** Screen geometry */
256 area_t geometry;
257 /** true if we need to arrange() */
258 bool need_arrange;
259 /** Tag list */
260 tag_array_t tags;
261 /** Wiboxes */
262 wibox_array_t wiboxes;
263 /** Padding */
264 padding_t padding;
265 /** Window that contains the systray */
266 struct
268 xcb_window_t window;
269 /** Systray window parent */
270 xcb_window_t parent;
271 } systray;
272 /** Focused client */
273 client_t *client_focus;
274 } screen_t;
276 /** Main configuration structure */
277 struct awesome_t
279 /** Connection ref */
280 xcb_connection_t *connection;
281 /** Event and error handlers */
282 xcb_event_handlers_t evenths;
283 /** Property change handler */
284 xcb_property_handlers_t prophs;
285 /** Default screen number */
286 int default_screen;
287 /** Keys symbol table */
288 xcb_key_symbols_t *keysyms;
289 /** Logical screens */
290 screen_t *screens;
291 /** Number of screens */
292 int nscreen;
293 /** True if xinerama is active */
294 bool xinerama_is_active;
295 /** Root window key bindings */
296 keybindings_t keys;
297 /** Root window mouse bindings */
298 button_array_t buttons;
299 /** Numlock mask */
300 unsigned int numlockmask;
301 /** Numlock mask */
302 unsigned int shiftlockmask;
303 /** Numlock mask */
304 unsigned int capslockmask;
305 /** Check for XRandR extension */
306 bool have_randr;
307 /** Check for XTest extension */
308 bool have_xtest;
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