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"
38 /** Stacking layout layers */
55 WINDOW_TYPE_NORMAL
= 0,
65 WIBOX_TYPE_NORMAL
= 0,
72 CurNormal
, CurResize
, CurResizeH
, CurResizeV
, CurMove
,
73 CurTopLeft
, CurTopRight
, CurBotLeft
, CurBotRight
, CurLast
76 typedef struct button_t button_t
;
77 typedef struct widget_t widget_t
;
78 typedef struct widget_node_t widget_node_t
;
79 typedef struct client_t client_t
;
80 typedef struct client_node_t client_node_t
;
81 typedef struct _tag_t tag_t
;
82 typedef struct tag_client_node_t tag_client_node_t
;
83 typedef widget_t
*(widget_constructor_t
)(alignment_t
);
84 typedef void (widget_destructor_t
)(widget_t
*);
85 typedef struct awesome_t awesome_t
;
107 widget_node_t
*widgets
;
108 /** Widget the mouse is over */
109 widget_node_t
*mouse_over
;
113 ARRAY_TYPE(wibox_t
*, wibox
)
115 /** Mouse buttons bindings */
122 /** Mouse button number */
124 /** Lua function to execute on press. */
126 /** Lua function to execute on release. */
130 DO_RCNT(button_t
, button
, p_delete
)
131 DO_ARRAY(button_t
*, button
, button_unref
)
140 /** Widget type is constructor */
141 widget_constructor_t
*type
;
142 /** Widget destructor */
143 widget_destructor_t
*destructor
;
144 /** Widget detach function */
145 void (*detach
)(widget_t
*, wibox_t
*);
147 int (*draw
)(draw_context_t
*, int, widget_node_t
*, int, int, wibox_t
*);
148 /** Index function */
149 int (*index
)(lua_State
*, awesome_token_t
);
150 /** Newindex function */
151 int (*newindex
)(lua_State
*, awesome_token_t
);
152 /** Button event handler */
153 void (*button
)(widget_node_t
*, xcb_button_press_event_t
*, int, wibox_t
*);
154 /** Mouse over event handler */
155 luaA_ref mouse_enter
, mouse_leave
;
158 /** Misc private data */
160 /** Button bindings */
161 button_array_t buttons
;
164 /** True if the widget is visible */
168 /** Delete a widget structure.
169 * \param widget The widget to destroy.
172 widget_delete(widget_t
**widget
)
174 if((*widget
)->destructor
)
175 (*widget
)->destructor(*widget
);
176 button_array_wipe(&(*widget
)->buttons
);
177 p_delete(&(*widget
)->name
);
181 DO_RCNT(widget_t
, widget
, widget_delete
)
187 /** The area where the widget was drawn */
189 /** Next and previous widget in the list */
190 widget_node_t
*prev
, *next
;
193 /** Delete a widget node structure.
194 * \param node The node to destroy.
197 widget_node_delete(widget_node_t
**node
)
199 widget_unref(&(*node
)->widget
);
203 DO_SLIST(widget_node_t
, widget_node
, widget_node_delete
)
208 uint16_t left
, right
, top
, bottom
;
209 uint16_t left_start_y
, left_end_y
;
210 uint16_t right_start_y
, right_end_y
;
211 uint16_t top_start_x
, top_end_x
;
212 uint16_t bottom_start_x
, bottom_end_x
;
220 /** Valid, or not ? */
224 /** Window geometry */
226 /** Floating window geometry */
228 /** Max window geometry */
231 int basew
, baseh
, incw
, inch
, maxw
, maxh
, minw
, minh
;
232 int minax
, maxax
, minay
, maxay
;
236 /** Respect resize hints */
238 int border
, oldborder
;
239 xcolor_t border_color
;
240 /** True if the client is sticky */
242 /** Has urgency hint */
244 /** true if the window is floating */
246 /** true if the client is moving */
248 /** True if the client is hidden */
250 /** True if the client is minimized */
252 /** True if the client is fullscreen */
254 /** True if the client is above others */
256 /** True if the client is below others */
258 /** True if the client is modal */
260 /** True if the client is on top */
262 /** true if the client must be skipped from task bar client list */
264 /** True if the client cannot have focus */
266 /** The window type */
268 /** Window of the client */
270 /** Client logical screen */
272 /** Client physical screen */
274 /** Path to an icon */
278 /** Button bindings */
279 button_array_t buttons
;
283 xcb_size_hints_t size_hints
;
284 /** Window it is transient for */
285 client_t
*transient_for
;
286 /** Next and previous clients */
287 client_t
*prev
, *next
;
291 client_delete(client_t
**c
)
293 button_array_wipe(&(*c
)->buttons
);
294 p_delete(&(*c
)->icon_path
);
295 p_delete(&(*c
)->name
);
299 DO_ARRAY(client_t
*, client
, DO_NOTHING
)
300 DO_RCNT(client_t
, client
, client_delete
)
306 /** Next and previous client_nodes */
307 client_node_t
*prev
, *next
;
319 /** true if selected */
321 /** Current tag layout */
323 /** Master width factor */
325 /** Number of master windows */
327 /** Number of columns in tile layout */
329 /** clients in this tag */
330 client_array_t clients
;
332 ARRAY_TYPE(tag_t
*, tag
)
337 /** Padding at top */
339 /** Padding at bottom */
341 /** Padding at left */
343 /** Padding at right */
351 /** Screen geometry */
353 /** true if we need to arrange() */
358 wibox_array_t wiboxes
;
361 /** Window that contains the systray */
365 /** Systray window parent */
368 /** Focused client */
369 client_t
*client_focus
;
372 /** Main configuration structure */
375 /** Connection ref */
376 xcb_connection_t
*connection
;
377 /** Event and error handlers */
378 xcb_event_handlers_t evenths
;
379 /** Property change handler */
380 xcb_property_handlers_t prophs
;
381 /** Default screen number */
383 /** Keys symbol table */
384 xcb_key_symbols_t
*keysyms
;
385 /** Logical screens */
387 /** Number of screens */
389 /** True if xinerama is active */
390 bool xinerama_is_active
;
391 /** Mouse bindings list */
392 button_array_t buttons
;
394 unsigned int numlockmask
;
396 unsigned int shiftlockmask
;
398 unsigned int capslockmask
;
399 /** Check for XRandR extension */
402 xcb_cursor_t cursor
[CurLast
];
405 /** Embedded windows */
406 xembed_window_t
*embedded
;
407 /** Path to config file */
409 /** Stack client history */
410 client_node_t
*stack
;
411 /** Command line passed to awesome */
413 /** Last XMotionEvent coords */
414 int pointer_x
, pointer_y
;
417 /** Default colors */
426 /** Command to execute when spawning a new client */
428 /** Command to execute when unmanaging client */
430 /** Command to execute when giving focus to a client */
432 /** Command to execute when removing focus to a client */
434 /** Command to run when mouse enter a client */
435 luaA_ref mouse_enter
;
436 /** Command to run on arrange */
438 /** Command to run on property change */
440 /** Command to run on time */
443 /** The event loop */
444 struct ev_loop
*loop
;
445 /** The timeout after which we need to stop select() */
446 struct ev_timer timer
;
447 /** The key grabber function */
449 /** Focused screen */
450 screen_t
*screen_focus
;
454 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80