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