naughty: add opacity option
[awesome.git] / structs.h
bloba7d61a09366845b8fdaf61b6aff47216657dc695
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 /* This ones are usually set on override-redirect windows. */
52 WINDOW_TYPE_DROPDOWN_MENU,
53 WINDOW_TYPE_POPUP_MENU,
54 WINDOW_TYPE_TOOLTIP,
55 WINDOW_TYPE_NOTIFICATION,
56 WINDOW_TYPE_COMBO,
57 WINDOW_TYPE_DND
58 } window_type_t;
60 /** Wibox types */
61 typedef enum
63 WIBOX_TYPE_NORMAL = 0,
64 WIBOX_TYPE_TITLEBAR
65 } wibox_type_t;
67 typedef struct button_t button_t;
68 typedef struct widget_t widget_t;
69 typedef struct widget_node_t widget_node_t;
70 typedef struct client_t client_t;
71 typedef struct client_node client_node_t;
72 typedef struct tag tag_t;
73 typedef struct tag_client_node_t tag_client_node_t;
74 typedef widget_t *(widget_constructor_t)(widget_t *);
75 typedef void (widget_destructor_t)(widget_t *);
76 typedef struct awesome_t awesome_t;
78 ARRAY_TYPE(widget_node_t, widget_node)
79 ARRAY_TYPE(button_t *, button)
81 /** Wibox type */
82 typedef struct
84 /** Ref count */
85 int refcount;
86 /** Ontop */
87 bool ontop;
88 /** Visible */
89 bool isvisible;
90 /** Position */
91 position_t position;
92 /** Wibox type */
93 wibox_type_t type;
94 /** Window */
95 simple_window_t sw;
96 /** Alignment */
97 alignment_t align;
98 /** Screen */
99 int screen;
100 /** Widget list */
101 widget_node_array_t widgets;
102 luaA_ref widgets_table;
103 /** Widget the mouse is over */
104 widget_t *mouse_over;
105 /** Mouse over event handler */
106 luaA_ref mouse_enter, mouse_leave;
107 /** Need update */
108 bool need_update;
109 /** Cursor */
110 char *cursor;
111 /** Background image */
112 image_t *bg_image;
113 /* Banned? used for titlebars */
114 bool isbanned;
115 /** Button bindings */
116 button_array_t buttons;
117 } wibox_t;
118 ARRAY_TYPE(wibox_t *, wibox)
120 /** Widget */
121 struct widget_t
123 /** Ref count */
124 int refcount;
125 /** Widget type is constructor */
126 widget_constructor_t *type;
127 /** Widget destructor */
128 widget_destructor_t *destructor;
129 /** Geometry function */
130 area_t (*geometry)(widget_t *, int, int, int);
131 /** Draw function */
132 void (*draw)(widget_t *, draw_context_t *, area_t, int, wibox_t *);
133 /** Index function */
134 int (*index)(lua_State *, awesome_token_t);
135 /** Newindex function */
136 int (*newindex)(lua_State *, awesome_token_t);
137 /** Mouse over event handler */
138 luaA_ref mouse_enter, mouse_leave;
139 /** Alignement */
140 alignment_t align;
141 /** Supported alignment */
142 alignment_t align_supported;
143 /** Misc private data */
144 void *data;
145 /** Button bindings */
146 button_array_t buttons;
147 /** True if the widget is visible */
148 bool isvisible;
151 /* Strut */
152 typedef struct
154 uint16_t left, right, top, bottom;
155 uint16_t left_start_y, left_end_y;
156 uint16_t right_start_y, right_end_y;
157 uint16_t top_start_x, top_end_x;
158 uint16_t bottom_start_x, bottom_end_x;
159 } strut_t;
161 /** client_t type */
162 struct client_t
164 /** Ref counter */
165 int refcount;
166 /** Valid, or not ? */
167 bool invalid;
168 /** Client name */
169 char *name, *icon_name;
170 /** WM_CLASS stuff */
171 char *class, *instance;
172 /** Window geometry */
173 area_t geometry;
174 struct
176 /** Client geometry when (un)fullscreen */
177 area_t fullscreen;
178 /** Client geometry when (un)-max */
179 area_t max;
180 /** Internal geometry (matching X11 protocol) */
181 area_t internal;
182 } geometries;
183 /** Strut */
184 strut_t strut;
185 /** Ignore strut temporarily. */
186 bool ignore_strut;
187 /** Border width and pre-fullscreen border width */
188 int border, border_fs;
189 xcolor_t border_color;
190 /** True if the client is sticky */
191 bool issticky;
192 /** Has urgency hint */
193 bool isurgent;
194 /** True if the client is hidden */
195 bool ishidden;
196 /** True if the client is minimized */
197 bool isminimized;
198 /** True if the client is fullscreen */
199 bool isfullscreen;
200 /** True if the client is maximized horizontally */
201 bool ismaxhoriz;
202 /** True if the client is maximized vertically */
203 bool ismaxvert;
204 /** True if the client is above others */
205 bool isabove;
206 /** True if the client is below others */
207 bool isbelow;
208 /** True if the client is modal */
209 bool ismodal;
210 /** True if the client is on top */
211 bool isontop;
212 /** True if a client is banned to a position outside the viewport.
213 * Note that the geometry remains unchanged and that the window is still mapped.
215 bool isbanned;
216 /** true if the client must be skipped from task bar client list */
217 bool skiptb;
218 /** True if the client cannot have focus */
219 bool nofocus;
220 /** The window type */
221 window_type_t type;
222 /** Window of the client */
223 xcb_window_t win;
224 /** Window of the group leader */
225 xcb_window_t group_win;
226 /** Window holding command needed to start it (session management related) */
227 xcb_window_t leader_win;
228 /** Client logical screen */
229 int screen;
230 /** Client physical screen */
231 int phys_screen;
232 /** Titlebar */
233 wibox_t *titlebar;
234 /** Button bindings */
235 button_array_t buttons;
236 /** Key bindings */
237 keybindings_t keys;
238 /** Icon */
239 image_t *icon;
240 /** Size hints */
241 xcb_size_hints_t size_hints;
242 bool size_hints_honor;
243 /** Window it is transient for */
244 client_t *transient_for;
245 /** Next and previous clients */
246 client_t *prev, *next;
248 ARRAY_TYPE(client_t *, client)
250 /** Tag type */
251 struct tag
253 /** Ref count */
254 int refcount;
255 /** Tag name */
256 char *name;
257 /** Screen */
258 int screen;
259 /** true if selected */
260 bool selected;
261 /** clients in this tag */
262 client_array_t clients;
264 ARRAY_TYPE(tag_t *, tag)
266 typedef struct
268 /** Screen index */
269 int index;
270 /** Screen geometry */
271 area_t geometry;
272 /** true if we need to arrange() */
273 bool need_arrange;
274 /** Tag list */
275 tag_array_t tags;
276 /** Wiboxes */
277 wibox_array_t wiboxes;
278 /** Padding */
279 padding_t padding;
280 /** Window that contains the systray */
281 struct
283 xcb_window_t window;
284 /** Systray window parent */
285 xcb_window_t parent;
286 } systray;
287 /** Focused client */
288 client_t *client_focus;
289 } screen_t;
291 /** Main configuration structure */
292 struct awesome_t
294 /** Connection ref */
295 xcb_connection_t *connection;
296 /** Event and error handlers */
297 xcb_event_handlers_t evenths;
298 /** Property change handler */
299 xcb_property_handlers_t prophs;
300 /** Default screen number */
301 int default_screen;
302 /** Keys symbol table */
303 xcb_key_symbols_t *keysyms;
304 /** Logical screens */
305 screen_t *screens;
306 /** Number of screens */
307 int nscreen;
308 /** True if xinerama is active */
309 bool xinerama_is_active;
310 /** Root window key bindings */
311 keybindings_t keys;
312 /** Root window mouse bindings */
313 button_array_t buttons;
314 /** Numlock mask */
315 unsigned int numlockmask;
316 /** Numlock mask */
317 unsigned int shiftlockmask;
318 /** Numlock mask */
319 unsigned int capslockmask;
320 /** Check for XRandR extension */
321 bool have_randr;
322 /** Check for XTest extension */
323 bool have_xtest;
324 /** Clients list */
325 client_t *clients;
326 /** Embedded windows */
327 xembed_window_array_t embedded;
328 /** Path to config file */
329 char *conffile;
330 /** Stack client history */
331 client_node_t *stack;
332 /** Command line passed to awesome */
333 char *argv;
334 /** Lua VM state */
335 lua_State *L;
336 /** Default colors */
337 struct
339 xcolor_t fg, bg;
340 } colors;
341 /** Default font */
342 font_t *font;
343 struct
345 /** Command to execute when spawning a new client */
346 luaA_ref manage;
347 /** Command to execute when unmanaging client */
348 luaA_ref unmanage;
349 /** Command to execute when giving focus to a client */
350 luaA_ref focus;
351 /** Command to execute when removing focus to a client */
352 luaA_ref unfocus;
353 /** Command to run when mouse enter a client */
354 luaA_ref mouse_enter;
355 /** Command to run when mouse leave a client */
356 luaA_ref mouse_leave;
357 /** Command to run on arrange */
358 luaA_ref arrange;
359 /** Command to run when client list changes */
360 luaA_ref clients;
361 /** Command to run on numbers of tag changes */
362 luaA_ref tags;
363 /** Command to run when client gets (un)tagged */
364 luaA_ref tagged;
365 /** Command to run on property change */
366 luaA_ref property;
367 /** Command to run on time */
368 luaA_ref timer;
369 #ifdef WITH_DBUS
370 /** Command to run on dbus events */
371 luaA_ref dbus;
372 #endif
373 } hooks;
374 /** The event loop */
375 struct ev_loop *loop;
376 /** The timeout after which we need to stop select() */
377 struct ev_timer timer;
378 /** The key grabber function */
379 luaA_ref keygrabber;
380 /** The mouse pointer grabber function */
381 luaA_ref mousegrabber;
382 /** Focused screen */
383 screen_t *screen_focus;
384 /** Need to call client_stack_refresh() */
385 bool client_need_stack_refresh;
388 DO_ARRAY(const void *, void, DO_NOTHING)
390 extern awesome_t globalconf;
392 #endif
393 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80