[progressbar] check_settings should be static
[awesome.git] / structs.h
blob464117bc1780a6791024a8de3fbe597af611d403
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 /** Rules for floating rule */
32 typedef enum
34 No = False,
35 Yes = True,
36 Maybe
37 } Fuzzy;
39 /** Cursors */
40 enum
41 { CurNormal, CurResize, CurMove, CurLast };
43 typedef struct
45 SimpleWindow *sw;
46 Position position;
47 Position dposition;
48 Alignment align;
49 Alignment text_align;
50 int width, height;
51 /** Colors */
52 struct
54 style_t normal;
55 style_t focus;
56 style_t urgent;
57 } styles;
58 } Titlebar;
60 /** Rule type */
61 typedef struct Rule Rule;
62 struct Rule
64 char *icon;
65 char *xprop;
66 int screen;
67 Fuzzy isfloating;
68 Fuzzy ismaster;
69 Titlebar titlebar;
70 double opacity;
71 regex_t *prop_r;
72 regex_t *tags_r;
73 regex_t *xpropval_r;
74 /** Next and previous rules */
75 Rule *prev, *next;
78 /** Key bindings */
79 typedef struct Key Key;
80 struct Key
82 unsigned long mod;
83 KeyCode keycode;
84 Uicb *func;
85 char *arg;
86 /** Next and previous keys */
87 Key *prev, *next;
90 /** Mouse buttons bindings */
91 typedef struct Button Button;
92 struct Button
94 unsigned long mod;
95 unsigned int button;
96 Uicb *func;
97 char *arg;
98 /** Next and previous buttons */
99 Button *prev, *next;
102 /** Widget tell status code */
103 typedef enum
105 WIDGET_NOERROR = 0,
106 WIDGET_ERROR,
107 WIDGET_ERROR_NOVALUE,
108 WIDGET_ERROR_CUSTOM,
109 WIDGET_ERROR_FORMAT_BOOL,
110 WIDGET_ERROR_FORMAT_FONT,
111 WIDGET_ERROR_FORMAT_COLOR,
112 WIDGET_ERROR_FORMAT_SECTION
113 } widget_tell_status_t;
115 /** Widget */
116 typedef struct Widget Widget;
117 typedef struct Statusbar Statusbar;
118 struct Widget
120 /** Widget name */
121 char *name;
122 /** Draw function */
123 int (*draw)(Widget *, DrawCtx *, int, int);
124 /** Update function */
125 widget_tell_status_t (*tell)(Widget *, char *, char *);
126 /** ButtonPressedEvent handler */
127 void (*button_press)(Widget *, XButtonPressedEvent *);
128 /** Statusbar */
129 Statusbar *statusbar;
130 /** Alignement */
131 Alignment alignment;
132 /** Misc private data */
133 void *data;
134 /** True if user supplied coords */
135 Bool user_supplied_x;
136 Bool user_supplied_y;
137 /** area_t */
138 area_t area;
139 /** Buttons bindings */
140 Button *buttons;
141 /** Cache */
142 struct
144 Bool needs_update;
145 int flags;
146 } cache;
147 /** Next and previous widgets */
148 Widget *prev, *next;
151 /** Status bar */
152 struct Statusbar
154 /** Window */
155 SimpleWindow *sw;
156 /** Statusbar name */
157 char *name;
158 /** Bar width */
159 int width;
160 /** Bar height */
161 int height;
162 /** Default position */
163 Position dposition;
164 /** Bar position */
165 Position position;
166 /** Screen */
167 int screen;
168 /** Physical screen id */
169 int phys_screen;
170 /** Widget list */
171 Widget *widgets;
172 /** Draw context */
173 DrawCtx *ctx;
174 /** Next and previous statusbars */
175 Statusbar *prev, *next;
178 /** Client type */
179 typedef struct Client Client;
180 struct Client
182 /** Client name */
183 char name[256];
184 /** Window geometry */
185 area_t geometry;
186 /** Floating window geometry */
187 area_t f_geometry;
188 /** Max window geometry */
189 area_t m_geometry;
190 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
191 int minax, maxax, minay, maxay;
192 int border, oldborder;
193 /** Has urgency hint */
194 Bool isurgent;
195 /** Store previous floating state before maximizing */
196 Bool wasfloating;
197 /** True if the window is floating */
198 Bool isfloating;
199 /** True if the window is fixed */
200 Bool isfixed;
201 /** True if the window is maximized */
202 Bool ismax;
203 /** True if the client must be skipped from client list */
204 Bool skip;
205 /** True if the client is moving */
206 Bool ismoving;
207 /** True if the client must be skipped from task bar client list */
208 Bool skiptb;
209 /** Next and previous clients */
210 Client *prev, *next;
211 /** Window of the client */
212 Window win;
213 /** Client logical screen */
214 int screen;
215 /** Client physical screen */
216 int phys_screen;
217 /** True if the client is a new one */
218 Bool newcomer;
219 /** Titlebar */
220 Titlebar titlebar;
223 typedef struct client_node_t client_node_t;
224 struct client_node_t
226 Client *client;
227 /** Next and previous client_nodes */
228 client_node_t *prev, *next;
231 /** Tag type */
232 typedef struct Tag Tag;
233 struct Tag
235 /** Tag name */
236 char *name;
237 /** Screen */
238 int screen;
239 /** True if selected */
240 Bool selected;
241 /** True if was selected before selecting others tags */
242 Bool was_selected;
243 /** Current tag layout */
244 Layout *layout;
245 /** Master width factor */
246 double mwfact;
247 /** Number of master windows */
248 int nmaster;
249 /** Number of columns in tile layout */
250 int ncol;
251 /** Next and previous tags */
252 Tag *prev, *next;
255 /** tag_client_node type */
256 typedef struct tag_client_node_t tag_client_node_t;
257 struct tag_client_node_t
259 Tag *tag;
260 Client *client;
261 /** Next and previous tag_client_nodes */
262 tag_client_node_t *prev, *next;
265 /** Padding type */
266 typedef struct
268 /** Padding at top */
269 int top;
270 /** Padding at bottom */
271 int bottom;
272 /** Padding at left */
273 int left;
274 /** Padding at right */
275 int right;
276 } Padding;
278 typedef area_t (FloatingPlacement)(Client *);
279 typedef struct
281 /** Titlebar default parameters */
282 Titlebar titlebar_default;
283 /** Number of pixels to snap windows */
284 int snap;
285 /** Border size */
286 int borderpx;
287 /** Mwfact limits */
288 float mwfact_upper_limit, mwfact_lower_limit;
289 /** Floating window placement algo */
290 FloatingPlacement *floating_placement;
291 /** Respect resize hints */
292 Bool resize_hints;
293 /** Sloppy focus: focus follow mouse */
294 Bool sloppy_focus;
295 /** True if we should raise windows on focus */
296 Bool sloppy_focus_raise;
297 /** Focus new clients */
298 Bool new_get_focus;
299 /** True if new clients should become master */
300 Bool new_become_master;
301 /** True if we need to arrange() */
302 Bool need_arrange;
303 /** Colors */
304 struct
306 style_t normal;
307 style_t focus;
308 style_t urgent;
309 } styles;
310 /** Transparency of unfocused clients */
311 double opacity_unfocused;
312 /** Transparency of focused clients */
313 double opacity_focused;
314 /** Tag list */
315 Tag *tags;
316 /** Layout list */
317 Layout *layouts;
318 /** Status bar */
319 Statusbar *statusbar;
320 /** Padding */
321 Padding padding;
322 } VirtScreen;
324 /** Main configuration structure */
325 typedef struct AwesomeConf AwesomeConf;
326 struct AwesomeConf
328 /** Display ref */
329 Display *display;
330 /** Logical screens */
331 VirtScreen *screens;
332 /** Screens info */
333 ScreensInfo *screens_info;
334 /** Rules list */
335 Rule *rules;
336 /** Keys bindings list */
337 Key *keys;
338 /** Mouse bindings list */
339 struct
341 Button *root;
342 Button *client;
343 Button *titlebar;
344 } buttons;
345 /** Numlock mask */
346 unsigned int numlockmask;
347 /** Check for XShape extension */
348 Bool have_shape;
349 /** Check for XRandR extension */
350 Bool have_randr;
351 /** Cursors */
352 Cursor cursor[CurLast];
353 /** Clients list */
354 Client *clients;
355 /** Scratch client */
356 struct
358 Client *client;
359 Bool isvisible;
360 } scratch;
361 /** Path to config file */
362 char *configpath;
363 /** Selected clients history */
364 client_node_t *focus;
365 /** Link between tags and clients */
366 tag_client_node_t *tclink;
367 /** Command line passed to awesome */
368 char *argv;
369 /** Last XMotionEvent coords */
370 int pointer_x, pointer_y;
373 #endif
374 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80