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>
34 #include "common/xutil.h"
35 #include "common/xembed.h"
36 #include "common/refcount.h"
41 WINDOW_TYPE_NORMAL
= 0,
51 WIBOX_TYPE_NORMAL
= 0,
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
)
95 widget_node_array_t widgets
;
96 luaA_ref widgets_table
;
97 /** Widget the mouse is over */
102 ARRAY_TYPE(wibox_t
*, wibox
)
104 /** Mouse buttons bindings */
111 /** Mouse button number */
113 /** Lua function to execute on press. */
115 /** Lua function to execute on release. */
118 DO_RCNT(button_t
, button
, p_delete
)
119 DO_ARRAY(button_t
*, button
, button_unref
)
128 /** Widget type is constructor */
129 widget_constructor_t
*type
;
130 /** Widget destructor */
131 widget_destructor_t
*destructor
;
133 int (*draw
)(draw_context_t
*, int, widget_node_t
*, int, int, wibox_t
*);
134 /** Index function */
135 int (*index
)(lua_State
*, awesome_token_t
);
136 /** Newindex function */
137 int (*newindex
)(lua_State
*, awesome_token_t
);
138 /** Button event handler */
139 void (*button
)(widget_node_t
*, xcb_button_press_event_t
*, int, wibox_t
*);
140 /** Mouse over event handler */
141 luaA_ref mouse_enter
, mouse_leave
;
144 /** Misc private data */
146 /** Button bindings */
147 button_array_t buttons
;
150 /** True if the widget is visible */
157 uint16_t left
, right
, top
, bottom
;
158 uint16_t left_start_y
, left_end_y
;
159 uint16_t right_start_y
, right_end_y
;
160 uint16_t top_start_x
, top_end_x
;
161 uint16_t bottom_start_x
, bottom_end_x
;
169 /** Valid, or not ? */
172 char *name
, *icon_name
;
173 /** Window geometry */
175 /** Floating window geometry */
177 /** Max window geometry */
180 int basew
, baseh
, incw
, inch
, maxw
, maxh
, minw
, minh
;
181 int minax
, maxax
, minay
, maxay
;
185 /** Respect resize hints */
187 int border
, oldborder
;
188 xcolor_t border_color
;
189 /** True if the client is sticky */
191 /** Has urgency hint */
193 /** true if the window is floating */
195 /** true if the client is moving */
197 /** True if the client is hidden */
199 /** True if the client is minimized */
201 /** True if the client is fullscreen */
203 /** True if the client is above others */
205 /** True if the client is below others */
207 /** True if the client is modal */
209 /** True if the client is on top */
211 /** true if the client must be skipped from task bar client list */
213 /** True if the client cannot have focus */
215 /** The window type */
217 /** Window of the client */
219 /** Client logical screen */
221 /** Client physical screen */
223 /** Path to an icon */
227 /** Button bindings */
228 button_array_t buttons
;
232 xcb_size_hints_t size_hints
;
233 /** Window it is transient for */
234 client_t
*transient_for
;
235 /** Next and previous clients */
236 client_t
*prev
, *next
;
238 ARRAY_TYPE(client_t
*, client
)
244 /** Next and previous client_nodes */
245 client_node_t
*prev
, *next
;
257 /** true if selected */
259 /** Current tag layout */
261 /** Master width factor */
263 /** Number of master windows */
265 /** Number of columns in tile layout */
267 /** clients in this tag */
268 client_array_t clients
;
270 ARRAY_TYPE(tag_t
*, tag
)
275 /** Padding at top */
277 /** Padding at bottom */
279 /** Padding at left */
281 /** Padding at right */
289 /** Screen geometry */
291 /** true if we need to arrange() */
296 wibox_array_t wiboxes
;
299 /** Window that contains the systray */
303 /** Systray window parent */
306 /** Focused client */
307 client_t
*client_focus
;
310 /** Main configuration structure */
313 /** Connection ref */
314 xcb_connection_t
*connection
;
315 /** Event and error handlers */
316 xcb_event_handlers_t evenths
;
317 /** Property change handler */
318 xcb_property_handlers_t prophs
;
319 /** Default screen number */
321 /** Keys symbol table */
322 xcb_key_symbols_t
*keysyms
;
323 /** Logical screens */
325 /** Number of screens */
327 /** True if xinerama is active */
328 bool xinerama_is_active
;
329 /** Mouse bindings list */
330 button_array_t buttons
;
332 unsigned int numlockmask
;
334 unsigned int shiftlockmask
;
336 unsigned int capslockmask
;
337 /** Check for XRandR extension */
340 xcb_cursor_t cursor
[CurLast
];
343 /** Embedded windows */
344 xembed_window_t
*embedded
;
345 /** Path to config file */
347 /** Stack client history */
348 client_node_t
*stack
;
349 /** Command line passed to awesome */
351 /** Last XMotionEvent coords */
352 int pointer_x
, pointer_y
;
355 /** Default colors */
364 /** Command to execute when spawning a new client */
366 /** Command to execute when unmanaging client */
368 /** Command to execute when giving focus to a client */
370 /** Command to execute when removing focus to a client */
372 /** Command to run when mouse enter a client */
373 luaA_ref mouse_enter
;
374 /** Command to run on arrange */
376 /** Command to run when client list changes */
378 /** Command to run on numbers of tag changes */
380 /** Command to run when client gets (un)tagged */
382 /** Command to run on property change */
384 /** Command to run on time */
387 /** The event loop */
388 struct ev_loop
*loop
;
389 /** The timeout after which we need to stop select() */
390 struct ev_timer timer
;
391 /** The key grabber function */
393 /** Focused screen */
394 screen_t
*screen_focus
;
398 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80