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