fix awesome-version-internal define
[awesome.git] / structs.h
blobf08c85d5d8241b798c7f95fce6f65541020b34a2
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 No = False,
44 Yes = True,
45 Auto
46 } Fuzzy;
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 Fuzzy isfloating;
64 Fuzzy ismaster;
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 KeyCode keycode;
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 Area (FloatingPlacement)(Area, int, int);
248 typedef struct
250 /** Screen geometry */
251 Area geometry;
252 /** Number of pixels to snap windows */
253 int snap;
254 /** Border size */
255 int borderpx;
256 /** Floating window placement algo */
257 FloatingPlacement *floating_placement;
258 /** Respect resize hints */
259 Bool resize_hints;
260 /** Sloppy focus: focus follow mouse */
261 Bool sloppy_focus;
262 /** True if we should raise windows on focus */
263 Bool sloppy_focus_raise;
264 /** Focus new clients */
265 Bool new_get_focus;
266 /** True if new clients should become master */
267 Bool new_become_master;
268 /** True if we need to arrange() */
269 Bool need_arrange;
270 /** Normal colors */
271 XColor colors_normal[ColLast];
272 /** Selected colors */
273 XColor colors_selected[ColLast];
274 /** Urgency colors */
275 XColor colors_urgent[ColLast];
276 /** Transparency of unfocused clients */
277 int opacity_unfocused;
278 /** Tag list */
279 Tag *tags;
280 /** Layout list */
281 Layout *layouts;
282 /** Status bar */
283 Statusbar *statusbar;
284 /** Padding */
285 Padding padding;
286 /** Font */
287 XftFont *font;
288 } VirtScreen;
290 /** Main configuration structure */
291 typedef struct AwesomeConf AwesomeConf;
292 struct AwesomeConf
294 /** Display ref */
295 Display *display;
296 /** Logical screens */
297 VirtScreen *screens;
298 /** Number of logical screens */
299 int nscreen;
300 /** Rules list */
301 Rule *rules;
302 /** Keys bindings list */
303 Key *keys;
304 /** Mouse bindings list */
305 struct
307 Button *root;
308 Button *client;
309 } buttons;
310 /** Numlock mask */
311 unsigned int numlockmask;
312 /** Check for XShape extension */
313 Bool have_shape;
314 /** Check for XRandR extension */
315 Bool have_randr;
316 /** Cursors */
317 Cursor cursor[CurLast];
318 /** Clients list */
319 Client *clients;
320 /** Scratch client */
321 struct
323 Client *client;
324 Bool isvisible;
325 } scratch;
326 /** Path to config file */
327 char *configpath;
328 /** Selected clients history */
329 client_node_t *focus;
330 /** Link between tags and clients */
331 tag_client_node_t *tclink;
332 /** Command line passed to awesome */
333 char *argv;
334 /** EventMask to drop before each XEvent treatement */
335 long drop_events;
338 #endif
339 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80