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