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>
32 #include "common/xutil.h"
33 #include "common/xembed.h"
34 #include "common/refcount.h"
35 #include "common/tokenize.h"
40 WINDOW_TYPE_NORMAL
= 0,
45 /* The ones below may have TRANSIENT_FOR, but are not plain dialogs.
46 * They were purposefully placed below DIALOG.
56 WIBOX_TYPE_NORMAL
= 0,
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
)
94 widget_node_array_t widgets
;
95 luaA_ref widgets_table
;
96 /** Widget the mouse is over */
102 /** Button bindings */
103 button_array_t buttons
;
105 ARRAY_TYPE(wibox_t
*, wibox
)
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);
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
;
128 /** Supported alignment */
129 alignment_t align_supported
;
130 /** Misc private data */
132 /** Button bindings */
133 button_array_t buttons
;
134 /** True if the widget is visible */
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
;
153 /** Valid, or not ? */
156 char *name
, *icon_name
;
157 /** Window geometry */
161 /** Client geometry when (un)fullscreen */
163 /** Client geometry when (un)-max */
165 /** Internal geometry (matching X11 protocol) */
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 */
175 /** Has urgency hint */
177 /** True if the client is hidden */
179 /** True if the client is minimized */
181 /** True if the client is fullscreen */
183 /** True if the client is maximized horizontally */
185 /** True if the client is maximized vertically */
187 /** True if the client is above others */
189 /** True if the client is below others */
191 /** True if the client is modal */
193 /** True if the client is on top */
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.
199 /** true if the client must be skipped from task bar client list */
201 /** True if the client cannot have focus */
203 /** The window type */
205 /** Window of the client */
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 */
213 /** Client physical screen */
215 /** Path to an icon */
219 /** Button bindings */
220 button_array_t buttons
;
224 xcb_size_hints_t size_hints
;
225 bool size_hints_honor
;
226 /** Window it is transient for */
227 client_t
*transient_for
;
228 /** Next and previous clients */
229 client_t
*prev
, *next
;
231 ARRAY_TYPE(client_t
*, client
)
242 /** true if selected */
244 /** clients in this tag */
245 client_array_t clients
;
247 ARRAY_TYPE(tag_t
*, tag
)
253 /** Screen geometry */
255 /** true if we need to arrange() */
260 wibox_array_t wiboxes
;
263 /** Window that contains the systray */
267 /** Systray window parent */
270 /** Focused client */
271 client_t
*client_focus
;
274 /** Main configuration structure */
277 /** Connection ref */
278 xcb_connection_t
*connection
;
279 /** Event and error handlers */
280 xcb_event_handlers_t evenths
;
281 /** Property change handler */
282 xcb_property_handlers_t prophs
;
283 /** Default screen number */
285 /** Keys symbol table */
286 xcb_key_symbols_t
*keysyms
;
287 /** Logical screens */
289 /** Number of screens */
291 /** True if xinerama is active */
292 bool xinerama_is_active
;
299 /** Mouse bindings list */
300 button_array_t buttons
;
302 unsigned int numlockmask
;
304 unsigned int shiftlockmask
;
306 unsigned int capslockmask
;
307 /** Check for XRandR extension */
309 /** Check for XTest extension */
313 /** Embedded windows */
314 xembed_window_array_t embedded
;
315 /** Path to config file */
317 /** Stack client history */
318 client_node_t
*stack
;
319 /** Command line passed to awesome */
321 /** Last XMotionEvent coords */
322 int pointer_x
, pointer_y
;
325 /** Default colors */
334 /** Command to execute when spawning a new client */
336 /** Command to execute when unmanaging client */
338 /** Command to execute when giving focus to a client */
340 /** Command to execute when removing focus to a client */
342 /** Command to run when mouse enter a client */
343 luaA_ref mouse_enter
;
344 /** Command to run when mouse leave a client */
345 luaA_ref mouse_leave
;
346 /** Command to run on arrange */
348 /** Command to run when client list changes */
350 /** Command to run on numbers of tag changes */
352 /** Command to run when client gets (un)tagged */
354 /** Command to run on property change */
356 /** Command to run on time */
359 /** Command to run on dbus events */
363 /** The event loop */
364 struct ev_loop
*loop
;
365 /** The timeout after which we need to stop select() */
366 struct ev_timer timer
;
367 /** The key grabber function */
369 /** The mouse pointer grabber function */
370 luaA_ref mousegrabber
;
371 /** Focused screen */
372 screen_t
*screen_focus
;
376 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80