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>
30 #include "common/xutil.h"
31 #include "common/draw.h"
32 #include "common/swindow.h"
33 #include "common/xscreen.h"
34 #include "common/xembed.h"
35 #include "common/refcount.h"
37 /** Stacking layout layers */
53 CurNormal
, CurResize
, CurResizeH
, CurResizeV
, CurMove
,
54 CurTopLeft
, CurTopRight
, CurBotLeft
, CurBotRight
, CurLast
57 typedef struct button_t button_t
;
58 typedef struct widget_t widget_t
;
59 typedef struct widget_node_t widget_node_t
;
60 typedef struct statusbar_t statusbar_t
;
61 typedef struct client_t client_t
;
62 typedef struct titlebar_t titlebar_t
;
63 typedef struct client_node_t client_node_t
;
64 typedef struct _tag_t tag_t
;
65 typedef struct tag_client_node_t tag_client_node_t
;
66 typedef area_t (floating_placement_t
)(client_t
*);
67 typedef widget_t
*(widget_constructor_t
)(alignment_t
);
68 typedef void (widget_destructor_t
)(widget_t
*);
69 typedef struct awesome_t awesome_t
;
71 /** Mouse buttons bindings */
78 /** Mouse button number */
80 /** Lua function to execute. */
82 /** Next and previous buttons */
83 button_t
*prev
, *next
;
86 DO_SLIST(button_t
, button
, p_delete
)
87 DO_RCNT(button_t
, button
, p_delete
)
96 /** Widget type is constructor */
97 widget_constructor_t
*type
;
98 /** Widget destructor */
99 widget_destructor_t
*destructor
;
100 /** Widget detach function */
101 void (*detach
)(widget_t
*, void *);
103 int (*draw
)(draw_context_t
*, int, widget_node_t
*, int, int, void *, awesome_type_t
);
104 /** Index function */
105 int (*index
)(lua_State
*, awesome_token_t
);
106 /** Newindex function */
107 int (*newindex
)(lua_State
*, awesome_token_t
);
108 /** ButtonPressedEvent handler */
109 void (*button_press
)(widget_node_t
*, xcb_button_press_event_t
*, int, void *, awesome_type_t
);
112 /** Misc private data */
114 /** Button bindings */
118 /** True if the widget is visible */
122 /** Delete a widget structure.
123 * \param widget The widget to destroy.
126 widget_delete(widget_t
**widget
)
128 if((*widget
)->destructor
)
129 (*widget
)->destructor(*widget
);
130 button_list_wipe(&(*widget
)->buttons
);
131 p_delete(&(*widget
)->name
);
135 DO_RCNT(widget_t
, widget
, widget_delete
)
141 /** The area where the widget was drawn */
143 /** Next and previous widget in the list */
144 widget_node_t
*prev
, *next
;
147 /** Delete a widget node structure.
148 * \param node The node to destroy.
151 widget_node_delete(widget_node_t
**node
)
153 widget_unref(&(*node
)->widget
);
157 DO_SLIST(widget_node_t
, widget_node
, widget_node_delete
)
159 /** Titlebar template structure */
165 position_t position
, oldposition
;
166 /** Alignment on window */
169 widget_node_t
*widgets
;
170 /** Width and height */
172 /** Titlebar window */
174 /** Default colors */
189 /** Delete a titlebar structure.
190 * \param t The titlebar to destroy.
193 titlebar_delete(titlebar_t
**t
)
195 widget_node_list_wipe(&(*t
)->widgets
);
199 DO_RCNT(titlebar_t
, titlebar
, titlebar_delete
)
208 /** statusbar_t name */
214 /** True if user specified width */
222 /** Physical screen id */
225 widget_node_t
*widgets
;
230 /** Default colors */
235 /** Next and previous statusbars */
236 statusbar_t
*prev
, *next
;
244 unsigned char *image
;
252 /** Valid, or not ? */
256 /** Window geometry */
258 /** Floating window geometry */
260 /** Max window geometry */
263 int basew
, baseh
, incw
, inch
, maxw
, maxh
, minw
, minh
;
264 int minax
, maxax
, minay
, maxay
;
266 /** Respect resize hints */
268 int border
, oldborder
;
269 xcolor_t border_color
;
270 /** True if the client does not want any border */
272 /** Has urgency hint */
274 /** Store previous floating state before maximizing */
276 /** true if the window is floating */
278 /** true if the window is fixed */
280 /** true if the window is maximized */
282 /** true if the client must be skipped from client list */
284 /** true if the client is moving */
286 /** True if the client is hidden */
288 /** true if the client must be skipped from task bar client list */
290 /** Window of the client */
292 /** Client logical screen */
294 /** Client physical screen */
296 /** Layer in the stacking order */
297 layer_t layer
, oldlayer
;
298 /** Path to an icon */
301 titlebar_t
*titlebar
;
302 /** Button bindings */
304 /** Floating window placement algo */
305 floating_placement_t
*floating_placement
;
308 /** Next and previous clients */
309 client_t
*prev
, *next
;
313 client_delete(client_t
**c
)
315 button_list_wipe(&(*c
)->buttons
);
316 p_delete(&(*c
)->icon_path
);
317 p_delete(&(*c
)->name
);
321 DO_ARRAY(client_t
*, client
, DO_NOTHING
)
322 DO_RCNT(client_t
, client
, client_delete
)
328 /** Next and previous client_nodes */
329 client_node_t
*prev
, *next
;
341 /** true if selected */
343 /** Current tag layout */
345 /** Master width factor */
347 /** Number of master windows */
349 /** Number of columns in tile layout */
351 /** clients in this tag */
352 client_array_t clients
;
354 ARRAY_TYPE(tag_t
*, tag
)
359 /** Padding at top */
361 /** Padding at bottom */
363 /** Padding at left */
365 /** Padding at right */
373 /** Screen geometry */
375 /** true if we need to arrange() */
380 statusbar_t
*statusbar
;
383 /** Window that contains the systray */
388 /** Focused client */
389 client_t
*client_focus
;
392 /** Main configuration structure */
395 /** Connection ref */
396 xcb_connection_t
*connection
;
397 /** Event and error handlers */
398 xcb_event_handlers_t
*evenths
;
399 /** Default screen number */
401 /** Keys symbol table */
402 xcb_key_symbols_t
*keysyms
;
403 /** Logical screens */
406 screens_info_t
*screens_info
;
407 /** Mouse bindings list */
413 unsigned int numlockmask
;
415 unsigned int shiftlockmask
;
417 unsigned int capslockmask
;
418 /** Check for XRandR extension */
421 xcb_cursor_t cursor
[CurLast
];
424 /** Embedded windows */
425 xembed_window_t
*embedded
;
426 /** Path to config file */
428 /** Stack client history */
429 client_node_t
*stack
;
430 /** Command line passed to awesome */
432 /** Last XMotionEvent coords */
433 int pointer_x
, pointer_y
;
436 /** Default colors */
445 /** Command to execute when spawning a new client */
447 /** Command to execute when unmanaging client */
449 /** Command to execute when giving focus to a client */
451 /** Command to execute when removing focus to a client */
453 /** Command to run when mouse is over */
455 /** Command to run on arrange */
457 /** Command to run on title change */
458 luaA_ref titleupdate
;
459 /** Command to run on urgent flag */
461 /** Command to run on time */
464 /** The event loop */
465 struct ev_loop
*loop
;
466 /** The timeout after which we need to stop select() */
467 struct ev_timer timer
;
468 /** The key grabber function */
470 /** Focused screen */
471 screen_t
*screen_focus
;
475 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80