awful.menu: add custom theme and fix various bugs
[awesome.git] / structs.h
blob21861fb567b03cf1faf5cbd066a092462bc52d5a
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 "luaa.h"
29 #include "layout.h"
30 #include "swindow.h"
31 #include "common/xutil.h"
32 #include "common/xembed.h"
33 #include "common/refcount.h"
35 /** Windows type */
36 typedef enum
38 WINDOW_TYPE_NORMAL = 0,
39 WINDOW_TYPE_DESKTOP,
40 WINDOW_TYPE_DOCK,
41 WINDOW_TYPE_SPLASH,
42 WINDOW_TYPE_DIALOG,
43 } window_type_t;
45 /** Wibox types */
46 typedef enum
48 WIBOX_TYPE_NORMAL = 0,
49 WIBOX_TYPE_TITLEBAR
50 } wibox_type_t;
52 /** Cursors */
53 enum
55 CurNormal, CurResize, CurResizeH, CurResizeV, CurMove,
56 CurTopLeft, CurTopRight, CurBotLeft, CurBotRight, CurLast
59 typedef struct button_t button_t;
60 typedef struct widget_t widget_t;
61 typedef struct widget_node_t widget_node_t;
62 typedef struct client_t client_t;
63 typedef struct client_node client_node_t;
64 typedef struct tag tag_t;
65 typedef struct tag_client_node_t tag_client_node_t;
66 typedef widget_t *(widget_constructor_t)(alignment_t);
67 typedef void (widget_destructor_t)(widget_t *);
68 typedef struct awesome_t awesome_t;
70 ARRAY_TYPE(widget_node_t, widget_node)
71 ARRAY_TYPE(button_t *, button)
73 /** Wibox type */
74 typedef struct
76 /** Ref count */
77 int refcount;
78 /** Ontop */
79 bool ontop;
80 /** Visible */
81 bool isvisible;
82 /** Position */
83 position_t position;
84 /** Wibox type */
85 wibox_type_t type;
86 /** Window */
87 simple_window_t sw;
88 /** Alignment */
89 alignment_t align;
90 /** Screen */
91 int screen;
92 /** Widget list */
93 widget_node_array_t widgets;
94 luaA_ref widgets_table;
95 /** Widget the mouse is over */
96 widget_t *mouse_over;
97 /** Need update */
98 bool need_update;
99 } wibox_t;
100 ARRAY_TYPE(wibox_t *, wibox)
102 /** Widget */
103 struct widget_t
105 /** Ref count */
106 int refcount;
107 /** widget_t name */
108 char *name;
109 /** Widget type is constructor */
110 widget_constructor_t *type;
111 /** Widget destructor */
112 widget_destructor_t *destructor;
113 /** Geometry function */
114 area_t (*geometry)(widget_t *, int, int, int);
115 /** Draw function */
116 void (*draw)(widget_t *, draw_context_t *, area_t, int, wibox_t *);
117 /** Index function */
118 int (*index)(lua_State *, awesome_token_t);
119 /** Newindex function */
120 int (*newindex)(lua_State *, awesome_token_t);
121 /** Button event handler */
122 void (*button)(widget_node_t *, xcb_button_press_event_t *, int, wibox_t *);
123 /** Mouse over event handler */
124 luaA_ref mouse_enter, mouse_leave;
125 /** Alignement */
126 alignment_t align;
127 /** Supported alignment */
128 alignment_t align_supported;
129 /** Misc private data */
130 void *data;
131 /** Button bindings */
132 button_array_t buttons;
133 /** Cache flags */
134 int cache_flags;
135 /** True if the widget is visible */
136 bool isvisible;
139 /* Strut */
140 typedef struct
142 uint16_t left, right, top, bottom;
143 uint16_t left_start_y, left_end_y;
144 uint16_t right_start_y, right_end_y;
145 uint16_t top_start_x, top_end_x;
146 uint16_t bottom_start_x, bottom_end_x;
147 } strut_t;
149 /** client_t type */
150 struct client_t
152 /** Ref counter */
153 int refcount;
154 /** Valid, or not ? */
155 bool invalid;
156 /** Client name */
157 char *name, *icon_name;
158 /** Window geometry */
159 area_t geometry;
160 /** Floating window geometry */
161 area_t f_geometry;
162 /** Max window geometry */
163 area_t m_geometry;
164 /* Size hints */
165 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
166 int minax, maxax, minay, maxay;
167 bool hassizehints;
168 /** Strut */
169 strut_t strut;
170 /** Respect resize hints */
171 bool honorsizehints;
172 int border, oldborder;
173 xcolor_t border_color;
174 /** True if the client is sticky */
175 bool issticky;
176 /** Has urgency hint */
177 bool isurgent;
178 /** true if the window is floating */
179 bool isfloating;
180 /** true if the client is moving */
181 bool ismoving;
182 /** True if the client is hidden */
183 bool ishidden;
184 /** True if the client is minimized */
185 bool isminimized;
186 /** True if the client is fullscreen */
187 bool isfullscreen;
188 /** True if the client is above others */
189 bool isabove;
190 /** True if the client is below others */
191 bool isbelow;
192 /** True if the client is modal */
193 bool ismodal;
194 /** True if the client is on top */
195 bool isontop;
196 /** true if the client must be skipped from task bar client list */
197 bool skiptb;
198 /** True if the client cannot have focus */
199 bool nofocus;
200 /** The window type */
201 window_type_t type;
202 /** Window of the client */
203 xcb_window_t win;
204 /** Client logical screen */
205 int screen;
206 /** Client physical screen */
207 int phys_screen;
208 /** Path to an icon */
209 char *icon_path;
210 /** Titlebar */
211 wibox_t *titlebar;
212 /** Button bindings */
213 button_array_t buttons;
214 /** Icon */
215 image_t *icon;
216 /** Size hints */
217 xcb_size_hints_t size_hints;
218 /** Window it is transient for */
219 client_t *transient_for;
220 /** Next and previous clients */
221 client_t *prev, *next;
223 ARRAY_TYPE(client_t *, client)
225 /** Tag type */
226 struct tag
228 /** Ref count */
229 int refcount;
230 /** Tag name */
231 char *name;
232 /** Screen */
233 int screen;
234 /** true if selected */
235 bool selected;
236 /** Current tag layout */
237 layout_t *layout;
238 /** Master width factor */
239 double mwfact;
240 /** Number of master windows */
241 int nmaster;
242 /** Number of columns in tile layout */
243 int ncol;
244 /** clients in this tag */
245 client_array_t clients;
247 ARRAY_TYPE(tag_t *, tag)
249 /** Padding type */
250 typedef struct
252 /** Padding at top */
253 int top;
254 /** Padding at bottom */
255 int bottom;
256 /** Padding at left */
257 int left;
258 /** Padding at right */
259 int right;
260 } padding_t;
262 typedef struct
264 /** Screen index */
265 int index;
266 /** Screen geometry */
267 area_t geometry;
268 /** true if we need to arrange() */
269 bool need_arrange;
270 /** Tag list */
271 tag_array_t tags;
272 /** Wiboxes */
273 wibox_array_t wiboxes;
274 /** Padding */
275 padding_t padding;
276 /** Window that contains the systray */
277 struct
279 xcb_window_t window;
280 /** Systray window parent */
281 xcb_window_t parent;
282 } systray;
283 /** Focused client */
284 client_t *client_focus;
285 } screen_t;
287 /** Main configuration structure */
288 struct awesome_t
290 /** Connection ref */
291 xcb_connection_t *connection;
292 /** Event and error handlers */
293 xcb_event_handlers_t evenths;
294 /** Property change handler */
295 xcb_property_handlers_t prophs;
296 /** Default screen number */
297 int default_screen;
298 /** Keys symbol table */
299 xcb_key_symbols_t *keysyms;
300 /** Logical screens */
301 screen_t *screens;
302 /** Number of screens */
303 int nscreen;
304 /** True if xinerama is active */
305 bool xinerama_is_active;
306 /** Mouse bindings list */
307 button_array_t buttons;
308 /** Numlock mask */
309 unsigned int numlockmask;
310 /** Numlock mask */
311 unsigned int shiftlockmask;
312 /** Numlock mask */
313 unsigned int capslockmask;
314 /** Check for XRandR extension */
315 bool have_randr;
316 /** Cursors */
317 xcb_cursor_t cursor[CurLast];
318 /** Clients list */
319 client_t *clients;
320 /** Embedded windows */
321 xembed_window_t *embedded;
322 /** Path to config file */
323 char *conffile;
324 /** Stack client history */
325 client_node_t *stack;
326 /** Command line passed to awesome */
327 char *argv;
328 /** Last XMotionEvent coords */
329 int pointer_x, pointer_y;
330 /** Lua VM state */
331 lua_State *L;
332 /** Default colors */
333 struct
335 xcolor_t fg, bg;
336 } colors;
337 /** Default font */
338 font_t *font;
339 struct
341 /** Command to execute when spawning a new client */
342 luaA_ref manage;
343 /** Command to execute when unmanaging client */
344 luaA_ref unmanage;
345 /** Command to execute when giving focus to a client */
346 luaA_ref focus;
347 /** Command to execute when removing focus to a client */
348 luaA_ref unfocus;
349 /** Command to run when mouse enter a client */
350 luaA_ref mouse_enter;
351 /** Command to run on arrange */
352 luaA_ref arrange;
353 /** Command to run when client list changes */
354 luaA_ref clients;
355 /** Command to run on numbers of tag changes */
356 luaA_ref tags;
357 /** Command to run when client gets (un)tagged */
358 luaA_ref tagged;
359 /** Command to run on property change */
360 luaA_ref property;
361 /** Command to run on time */
362 luaA_ref timer;
363 } hooks;
364 /** The event loop */
365 struct ev_loop *loop;
366 /** The timeout after which we need to stop select() */
367 struct ev_timer timer;
368 /** The key grabber function */
369 luaA_ref keygrabber;
370 /** Focused screen */
371 screen_t *screen_focus;
374 #endif
375 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80