Make awesome-{menu,message} Xinerama aware
[awesome.git] / structs.h
blob8d084a5a121ffbce006856c09869ece66361af5a
1 /*
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 <regex.h>
26 #include "layout.h"
27 #include "common/draw.h"
28 #include "common/swindow.h"
29 #include "common/xscreen.h"
31 /** Bar possible position */
32 typedef enum
34 Top,
35 Bottom,
36 Left,
37 Right,
38 Off
39 } Position;
41 /** Rules for floating rule */
42 typedef enum
44 No = False,
45 Yes = True,
46 Auto
47 } Fuzzy;
49 /** Cursors */
50 enum
51 { CurNormal, CurResize, CurMove, CurLast };
53 /** Rule type */
54 typedef struct Rule Rule;
55 struct Rule
57 char *icon;
58 char *xprop;
59 int screen;
60 Fuzzy isfloating;
61 Fuzzy ismaster;
62 double opacity;
63 regex_t *prop_r;
64 regex_t *tags_r;
65 regex_t *xpropval_r;
66 /** Next and previous rules */
67 Rule *prev, *next;
70 /** Key bindings */
71 typedef struct Key Key;
72 struct Key
74 unsigned long mod;
75 KeyCode keycode;
76 Uicb *func;
77 char *arg;
78 /** Next and previous keys */
79 Key *prev, *next;
82 /** Mouse buttons bindings */
83 typedef struct Button Button;
84 struct Button
86 unsigned long mod;
87 unsigned int button;
88 Uicb *func;
89 char *arg;
90 /** Next and previous buttons */
91 Button *prev, *next;
94 /** Widget tell status code */
95 typedef enum
97 WIDGET_NOERROR = 0,
98 WIDGET_ERROR,
99 WIDGET_ERROR_NOVALUE,
100 WIDGET_ERROR_CUSTOM,
101 WIDGET_ERROR_FORMAT_BOOL,
102 WIDGET_ERROR_FORMAT_FONT,
103 WIDGET_ERROR_FORMAT_COLOR,
104 WIDGET_ERROR_FORMAT_SECTION
105 } widget_tell_status_t;
107 /** Widget */
108 typedef struct Widget Widget;
109 typedef struct Statusbar Statusbar;
110 struct Widget
112 /** Widget name */
113 char *name;
114 /** Draw function */
115 int (*draw)(Widget *, DrawCtx *, int, int);
116 /** Update function */
117 widget_tell_status_t (*tell)(Widget *, char *, char *);
118 /** ButtonPressedEvent handler */
119 void (*button_press)(Widget *, XButtonPressedEvent *);
120 /** Statusbar */
121 Statusbar *statusbar;
122 /** Alignement */
123 Alignment alignment;
124 /** Misc private data */
125 void *data;
126 /** True if user supplied coords */
127 Bool user_supplied_x;
128 Bool user_supplied_y;
129 /** Area */
130 Area area;
131 /** Buttons bindings */
132 Button *buttons;
133 /** Cache */
134 struct
136 Bool needs_update;
137 int flags;
138 } cache;
139 /** Next and previous widgets */
140 Widget *prev, *next;
143 /** Status bar */
144 struct Statusbar
146 /** Window */
147 SimpleWindow *sw;
148 /** Statusbar name */
149 char *name;
150 /** Bar width */
151 int width;
152 /** Bar height */
153 int height;
154 /** Default position */
155 Position dposition;
156 /** Bar position */
157 Position position;
158 /** Screen */
159 int screen;
160 /** Widget list */
161 Widget *widgets;
162 /** Next and previous statusbars */
163 Statusbar *prev, *next;
166 /** Client type */
167 typedef struct Client Client;
168 struct Client
170 /** Client name */
171 char name[256];
172 /** Window geometry */
173 Area geometry;
174 /** Floating window geometry */
175 Area f_geometry;
176 /** Max window geometry */
177 Area m_geometry;
178 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
179 int minax, maxax, minay, maxay;
180 int border, oldborder;
181 /** Has urgency hint */
182 Bool isurgent;
183 /** Store previous floating state before maximizing */
184 Bool wasfloating;
185 /** True if the window is floating */
186 Bool isfloating;
187 /** True if the window is fixed */
188 Bool isfixed;
189 /** True if the window is maximized */
190 Bool ismax;
191 /** True if the client must be skipped from client list */
192 Bool skip;
193 /** True if the client must be skipped from task bar client list */
194 Bool skiptb;
195 /** Next and previous clients */
196 Client *prev, *next;
197 /** Window of the client */
198 Window win;
199 /** Client logical screen */
200 int screen;
201 /** True if the client is a new one */
202 Bool newcomer;
205 typedef struct client_node_t client_node_t;
206 struct client_node_t
208 Client *client;
209 /** Next and previous client_nodes */
210 client_node_t *prev, *next;
213 /** Tag type */
214 typedef struct Tag Tag;
215 struct Tag
217 /** Tag name */
218 char *name;
219 /** Screen */
220 int screen;
221 /** True if selected */
222 Bool selected;
223 /** True if was selected before selecting others tags */
224 Bool was_selected;
225 /** Current tag layout */
226 Layout *layout;
227 /** Master width factor */
228 double mwfact;
229 /** Number of master windows */
230 int nmaster;
231 /** Number of columns in tile layout */
232 int ncol;
233 /** Next and previous tags */
234 Tag *prev, *next;
237 /** tag_client_node type */
238 typedef struct tag_client_node_t tag_client_node_t;
239 struct tag_client_node_t
241 Tag *tag;
242 Client *client;
243 /** Next and previous tag_client_nodes */
244 tag_client_node_t *prev, *next;
247 /** Padding type */
248 typedef struct
250 /** Padding at top */
251 int top;
252 /** Padding at bottom */
253 int bottom;
254 /** Padding at left */
255 int left;
256 /** Padding at right */
257 int right;
258 } Padding;
260 typedef Area (FloatingPlacement)(Area, int, int);
261 typedef struct
263 /** Number of pixels to snap windows */
264 int snap;
265 /** Border size */
266 int borderpx;
267 /** Mwfact limits */
268 float mwfact_upper_limit, mwfact_lower_limit;
269 /** Floating window placement algo */
270 FloatingPlacement *floating_placement;
271 /** Respect resize hints */
272 Bool resize_hints;
273 /** Sloppy focus: focus follow mouse */
274 Bool sloppy_focus;
275 /** True if we should raise windows on focus */
276 Bool sloppy_focus_raise;
277 /** Focus new clients */
278 Bool new_get_focus;
279 /** True if new clients should become master */
280 Bool new_become_master;
281 /** True if we need to arrange() */
282 Bool need_arrange;
283 /** Colors */
284 struct
286 style_t normal;
287 style_t focus;
288 style_t urgent;
289 } styles;
290 /** Transparency of unfocused clients */
291 int opacity_unfocused;
292 /** Tag list */
293 Tag *tags;
294 /** Layout list */
295 Layout *layouts;
296 /** Status bar */
297 Statusbar *statusbar;
298 /** Padding */
299 Padding padding;
300 } VirtScreen;
302 /** Main configuration structure */
303 typedef struct AwesomeConf AwesomeConf;
304 struct AwesomeConf
306 /** Display ref */
307 Display *display;
308 /** Logical screens */
309 VirtScreen *screens;
310 /** Screens info */
311 ScreensInfo *screens_info;
312 /** Rules list */
313 Rule *rules;
314 /** Keys bindings list */
315 Key *keys;
316 /** Mouse bindings list */
317 struct
319 Button *root;
320 Button *client;
321 } buttons;
322 /** Numlock mask */
323 unsigned int numlockmask;
324 /** Check for XShape extension */
325 Bool have_shape;
326 /** Check for XRandR extension */
327 Bool have_randr;
328 /** Cursors */
329 Cursor cursor[CurLast];
330 /** Clients list */
331 Client *clients;
332 /** Scratch client */
333 struct
335 Client *client;
336 Bool isvisible;
337 } scratch;
338 /** Path to config file */
339 char *configpath;
340 /** Selected clients history */
341 client_node_t *focus;
342 /** Link between tags and clients */
343 tag_client_node_t *tclink;
344 /** Command line passed to awesome */
345 char *argv;
346 /** Last XMotionEvent coords */
347 int pointer_x, pointer_y;
350 #endif
351 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80