add area_match_coords() and area_match_area()
[awesome.git] / structs.h
blobf83c30939dcc750f2a54c5ef97bc8117d9934b1c
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"
30 /** Bar possible position */
31 typedef enum
33 Top,
34 Bottom,
35 Left,
36 Right,
37 Off
38 } Position;
40 /** Rules for floating rule */
41 typedef enum
43 Float,
44 Tile,
45 Auto,
46 } RuleFloat;
48 /** Common colors */
49 enum
50 { ColBorder, ColFG, ColBG, ColLast };
52 /** Cursors */
53 enum
54 { CurNormal, CurResize, CurMove, CurLast };
56 /** Rule type */
57 typedef struct Rule Rule;
58 struct Rule
60 char *icon;
61 char *xprop;
62 int screen;
63 RuleFloat isfloating;
64 Bool not_master;
65 double opacity;
66 regex_t *prop_r;
67 regex_t *tags_r;
68 regex_t *xpropval_r;
69 Rule *next;
72 /** Key bindings */
73 typedef struct Key Key;
74 struct Key
76 unsigned long mod;
77 KeySym keysym;
78 Uicb *func;
79 char *arg;
80 Key *next;
83 /** Mouse buttons bindings */
84 typedef struct Button Button;
85 struct Button
87 unsigned long mod;
88 unsigned int button;
89 Uicb *func;
90 char *arg;
91 Button *next;
94 /** Widget */
95 typedef struct Widget Widget;
96 typedef struct Statusbar Statusbar;
97 struct Widget
99 /** Widget name */
100 char *name;
101 /** Draw function */
102 int (*draw)(Widget *, DrawCtx *, int, int);
103 /** Update function */
104 void (*tell)(Widget *, char *);
105 /** ButtonPressedEvent handler */
106 void (*button_press)(Widget *, XButtonPressedEvent *);
107 /** Statusbar */
108 Statusbar *statusbar;
109 /** Alignement */
110 Alignment alignment;
111 /** Misc private data */
112 void *data;
113 /** True if user supplied coords */
114 Bool user_supplied_x;
115 Bool user_supplied_y;
116 /** Area */
117 Area area;
118 /** Buttons bindings */
119 Button *buttons;
120 /** Font */
121 XftFont *font;
122 /** Cache */
123 struct
125 Bool needs_update;
126 int flags;
127 } cache;
128 /** Next widget */
129 Widget *next;
132 /** Status bar */
133 struct Statusbar
135 /** Window */
136 SimpleWindow *sw;
137 /** Statusbar name */
138 char *name;
139 /** Bar width */
140 int width;
141 /** Bar height */
142 int height;
143 /** Default position */
144 Position dposition;
145 /** Bar position */
146 Position position;
147 /** Screen */
148 int screen;
149 /** Widget list */
150 Widget *widgets;
151 /** Next statusbar */
152 Statusbar *next;
155 /** Client type */
156 typedef struct Client Client;
157 struct Client
159 /** Client name */
160 char name[256];
161 /** Window geometry */
162 Area geometry;
163 /** Floating window geometry */
164 Area f_geometry;
165 /** Max window geometry */
166 Area m_geometry;
167 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
168 int minax, maxax, minay, maxay;
169 int border, oldborder;
170 /** Has urgency hint */
171 Bool isurgent;
172 /** Store previous floating state before maximizing */
173 Bool wasfloating;
174 /** True if the window is floating */
175 Bool isfloating;
176 /** True if the window is fixed */
177 Bool isfixed;
178 /** True if the window is maximized */
179 Bool ismax;
180 /** True if the client must be skipped from client list */
181 Bool skip;
182 /** True if the client must be skipped from task bar client list */
183 Bool skiptb;
184 /** Next client */
185 Client *next;
186 /** Window of the client */
187 Window win;
188 /** Client logical screen */
189 int screen;
190 /** True if the client is a new one */
191 Bool newcomer;
194 typedef struct client_node_t client_node_t;
195 struct client_node_t
197 Client *client;
198 client_node_t *next;
201 /** Tag type */
202 typedef struct Tag Tag;
203 struct Tag
205 /** Tag name */
206 char *name;
207 /** Screen */
208 int screen;
209 /** True if selected */
210 Bool selected;
211 /** True if was selected before selecting others tags */
212 Bool was_selected;
213 /** Current tag layout */
214 Layout *layout;
215 /** Master width factor */
216 double mwfact;
217 /** Number of master windows */
218 int nmaster;
219 /** Number of columns in tile layout */
220 int ncol;
221 /** Next tag */
222 Tag *next;
225 /** tag_client_node type */
226 typedef struct tag_client_node_t tag_client_node_t;
227 struct tag_client_node_t
229 Tag *tag;
230 Client *client;
231 tag_client_node_t *next;
234 /** Padding type */
235 typedef struct
237 /** Padding at top */
238 int top;
239 /** Padding at bottom */
240 int bottom;
241 /** Padding at left */
242 int left;
243 /** Padding at right */
244 int right;
245 } Padding;
247 typedef struct
249 /** Screen geometry */
250 Area geometry;
251 /** Number of pixels to snap windows */
252 int snap;
253 /** Border size */
254 int borderpx;
255 /** Respect resize hints */
256 Bool resize_hints;
257 /** Sloppy focus: focus follow mouse */
258 Bool sloppy_focus;
259 /** True if we should raise windows on focus */
260 Bool sloppy_focus_raise;
261 /** Focus new clients */
262 Bool new_get_focus;
263 /** True if new clients should become master */
264 Bool new_become_master;
265 /** True if we need to arrange() */
266 Bool need_arrange;
267 /** Normal colors */
268 XColor colors_normal[ColLast];
269 /** Selected colors */
270 XColor colors_selected[ColLast];
271 /** Urgency colors */
272 XColor colors_urgent[ColLast];
273 /** Tag list */
274 Tag *tags;
275 /** Layout list */
276 Layout *layouts;
277 /** Status bar */
278 Statusbar *statusbar;
279 /** Padding */
280 Padding padding;
281 /** Font */
282 XftFont *font;
283 } VirtScreen;
285 /** Main configuration structure */
286 typedef struct AwesomeConf AwesomeConf;
287 struct AwesomeConf
289 /** Display ref */
290 Display *display;
291 /** Logical screens */
292 VirtScreen *screens;
293 /** Number of logical screens */
294 int nscreen;
295 /** Rules list */
296 Rule *rules;
297 /** Keys bindings list */
298 Key *keys;
299 /** Mouse bindings list */
300 struct
302 Button *root;
303 Button *client;
304 } buttons;
305 /** Numlock mask */
306 unsigned int numlockmask;
307 /** Check for XShape extension */
308 Bool have_shape;
309 /** Check for XRandR extension */
310 Bool have_randr;
311 /** Cursors */
312 Cursor cursor[CurLast];
313 /** Clients list */
314 Client *clients;
315 /** Path to config file */
316 char *configpath;
317 /** Selected clients history */
318 client_node_t *focus;
319 /** Link between tags and clients */
320 tag_client_node_t *tclink;
321 /** Command line passed to awesome */
322 char *argv;
323 /** EventMask to drop before each XEvent treatement */
324 long drop_events;
327 #endif
328 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80