Add support for Bottom titlebar
[awesome.git] / structs.h
blob6ceba009018ec2bf25bb1a2b4d36665d73226eca
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 must be skipped from task bar client list */
194 Bool skiptb;
195 /** Next and previous clients */
196 Client *prev, *next;
197 /** Window of the client */
198 Window win;
199 /** Client logical screen */
200 int screen;
201 /** True if the client is a new one */
202 Bool newcomer;
203 /** Titlebar */
204 Titlebar titlebar;
207 typedef struct client_node_t client_node_t;
208 struct client_node_t
210 Client *client;
211 /** Next and previous client_nodes */
212 client_node_t *prev, *next;
215 /** Tag type */
216 typedef struct Tag Tag;
217 struct Tag
219 /** Tag name */
220 char *name;
221 /** Screen */
222 int screen;
223 /** True if selected */
224 Bool selected;
225 /** True if was selected before selecting others tags */
226 Bool was_selected;
227 /** Current tag layout */
228 Layout *layout;
229 /** Master width factor */
230 double mwfact;
231 /** Number of master windows */
232 int nmaster;
233 /** Number of columns in tile layout */
234 int ncol;
235 /** Next and previous tags */
236 Tag *prev, *next;
239 /** tag_client_node type */
240 typedef struct tag_client_node_t tag_client_node_t;
241 struct tag_client_node_t
243 Tag *tag;
244 Client *client;
245 /** Next and previous tag_client_nodes */
246 tag_client_node_t *prev, *next;
249 /** Padding type */
250 typedef struct
252 /** Padding at top */
253 int top;
254 /** Padding at bottom */
255 int bottom;
256 /** Padding at left */
257 int left;
258 /** Padding at right */
259 int right;
260 } Padding;
262 typedef area_t (FloatingPlacement)(area_t, int, int);
263 typedef struct
265 /** Titlebar default parameters */
266 Titlebar titlebar_default;
267 /** Number of pixels to snap windows */
268 int snap;
269 /** Border size */
270 int borderpx;
271 /** Mwfact limits */
272 float mwfact_upper_limit, mwfact_lower_limit;
273 /** Floating window placement algo */
274 FloatingPlacement *floating_placement;
275 /** Respect resize hints */
276 Bool resize_hints;
277 /** Sloppy focus: focus follow mouse */
278 Bool sloppy_focus;
279 /** True if we should raise windows on focus */
280 Bool sloppy_focus_raise;
281 /** Focus new clients */
282 Bool new_get_focus;
283 /** True if new clients should become master */
284 Bool new_become_master;
285 /** True if we need to arrange() */
286 Bool need_arrange;
287 /** Colors */
288 struct
290 style_t normal;
291 style_t focus;
292 style_t urgent;
293 } styles;
294 /** Transparency of unfocused clients */
295 int opacity_unfocused;
296 /** Tag list */
297 Tag *tags;
298 /** Layout list */
299 Layout *layouts;
300 /** Status bar */
301 Statusbar *statusbar;
302 /** Padding */
303 Padding padding;
304 } VirtScreen;
306 /** Main configuration structure */
307 typedef struct AwesomeConf AwesomeConf;
308 struct AwesomeConf
310 /** Display ref */
311 Display *display;
312 /** Logical screens */
313 VirtScreen *screens;
314 /** Screens info */
315 ScreensInfo *screens_info;
316 /** Rules list */
317 Rule *rules;
318 /** Keys bindings list */
319 Key *keys;
320 /** Mouse bindings list */
321 struct
323 Button *root;
324 Button *client;
325 } buttons;
326 /** Numlock mask */
327 unsigned int numlockmask;
328 /** Check for XShape extension */
329 Bool have_shape;
330 /** Check for XRandR extension */
331 Bool have_randr;
332 /** Cursors */
333 Cursor cursor[CurLast];
334 /** Clients list */
335 Client *clients;
336 /** Scratch client */
337 struct
339 Client *client;
340 Bool isvisible;
341 } scratch;
342 /** Path to config file */
343 char *configpath;
344 /** Selected clients history */
345 client_node_t *focus;
346 /** Link between tags and clients */
347 tag_client_node_t *tclink;
348 /** Command line passed to awesome */
349 char *argv;
350 /** Last XMotionEvent coords */
351 int pointer_x, pointer_y;
354 #endif
355 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80