switch KeySym to KeyCode
[awesome.git] / structs.h
blobea1550cb64c35dd843c997fd79a49ad11194149e
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 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 /** Transparency of unfocused clients */
274 int opacity_unfocused;
275 /** Tag list */
276 Tag *tags;
277 /** Layout list */
278 Layout *layouts;
279 /** Status bar */
280 Statusbar *statusbar;
281 /** Padding */
282 Padding padding;
283 /** Font */
284 XftFont *font;
285 } VirtScreen;
287 /** Main configuration structure */
288 typedef struct AwesomeConf AwesomeConf;
289 struct AwesomeConf
291 /** Display ref */
292 Display *display;
293 /** Logical screens */
294 VirtScreen *screens;
295 /** Number of logical screens */
296 int nscreen;
297 /** Rules list */
298 Rule *rules;
299 /** Keys bindings list */
300 Key *keys;
301 /** Mouse bindings list */
302 struct
304 Button *root;
305 Button *client;
306 } buttons;
307 /** Numlock mask */
308 unsigned int numlockmask;
309 /** Check for XShape extension */
310 Bool have_shape;
311 /** Check for XRandR extension */
312 Bool have_randr;
313 /** Cursors */
314 Cursor cursor[CurLast];
315 /** Clients list */
316 Client *clients;
317 /** Scratch client */
318 struct
320 Client *client;
321 Bool isvisible;
322 } scratch;
323 /** Path to config file */
324 char *configpath;
325 /** Selected clients history */
326 client_node_t *focus;
327 /** Link between tags and clients */
328 tag_client_node_t *tclink;
329 /** Command line passed to awesome */
330 char *argv;
331 /** EventMask to drop before each XEvent treatement */
332 long drop_events;
335 #endif
336 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80