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
;
132 /** Geometry function */
133 area_t (*geometry
)(widget_t
*, int, int, int);
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
;
146 /** Misc private data */
148 /** Button bindings */
149 button_array_t buttons
;
152 /** True if the widget is visible */
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
;
171 /** Valid, or not ? */
174 char *name
, *icon_name
;
175 /** Window geometry */
177 /** Floating window geometry */
179 /** Max window geometry */
182 int basew
, baseh
, incw
, inch
, maxw
, maxh
, minw
, minh
;
183 int minax
, maxax
, minay
, maxay
;
187 /** Respect resize hints */
189 int border
, oldborder
;
190 xcolor_t border_color
;
191 /** True if the client is sticky */
193 /** Has urgency hint */
195 /** true if the window is floating */
197 /** true if the client is moving */
199 /** True if the client is hidden */
201 /** True if the client is minimized */
203 /** True if the client is fullscreen */
205 /** True if the client is above others */
207 /** True if the client is below others */
209 /** True if the client is modal */
211 /** True if the client is on top */
213 /** true if the client must be skipped from task bar client list */
215 /** True if the client cannot have focus */
217 /** The window type */
219 /** Window of the client */
221 /** Client logical screen */
223 /** Client physical screen */
225 /** Path to an icon */
229 /** Button bindings */
230 button_array_t buttons
;
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
)
246 /** Next and previous client_nodes */
247 client_node_t
*prev
, *next
;
259 /** true if selected */
261 /** Current tag layout */
263 /** Master width factor */
265 /** Number of master windows */
267 /** Number of columns in tile layout */
269 /** clients in this tag */
270 client_array_t clients
;
272 ARRAY_TYPE(tag_t
*, tag
)
277 /** Padding at top */
279 /** Padding at bottom */
281 /** Padding at left */
283 /** Padding at right */
291 /** Screen geometry */
293 /** true if we need to arrange() */
298 wibox_array_t wiboxes
;
301 /** Window that contains the systray */
305 /** Systray window parent */
308 /** Focused client */
309 client_t
*client_focus
;
312 /** Main configuration structure */
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 */
323 /** Keys symbol table */
324 xcb_key_symbols_t
*keysyms
;
325 /** Logical screens */
327 /** Number of screens */
329 /** True if xinerama is active */
330 bool xinerama_is_active
;
331 /** Mouse bindings list */
332 button_array_t buttons
;
334 unsigned int numlockmask
;
336 unsigned int shiftlockmask
;
338 unsigned int capslockmask
;
339 /** Check for XRandR extension */
342 xcb_cursor_t cursor
[CurLast
];
345 /** Embedded windows */
346 xembed_window_t
*embedded
;
347 /** Path to config file */
349 /** Stack client history */
350 client_node_t
*stack
;
351 /** Command line passed to awesome */
353 /** Last XMotionEvent coords */
354 int pointer_x
, pointer_y
;
357 /** Default colors */
366 /** Command to execute when spawning a new client */
368 /** Command to execute when unmanaging client */
370 /** Command to execute when giving focus to a client */
372 /** Command to execute when removing focus to a client */
374 /** Command to run when mouse enter a client */
375 luaA_ref mouse_enter
;
376 /** Command to run on arrange */
378 /** Command to run when client list changes */
380 /** Command to run on numbers of tag changes */
382 /** Command to run when client gets (un)tagged */
384 /** Command to run on property change */
386 /** Command to run on time */
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 */
395 /** Focused screen */
396 screen_t
*screen_focus
;
400 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80