-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathshod.h
805 lines (721 loc) · 29.1 KB
/
shod.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
#include <sys/queue.h>
#include "xutil.h"
#define TAB_FOREACH_BEGIN(c, tab) { \
struct Column *col; \
struct Row *row; \
TAILQ_FOREACH_REVERSE(col, &(c)->colq, ColumnQueue, entry) { \
TAILQ_FOREACH_REVERSE(row, &col->rowq, RowQueue, entry) { \
TAILQ_FOREACH_REVERSE(tab, &row->tabq, Queue, entry)
#define TAB_FOREACH_END } \
} \
}
#define RESOURCES \
/* CLASS NAME */\
X(RES_TYPE, "Type", "type" )\
X(RES_STATE, "State", "state" )\
X(RES_DESKTOP, "Desktop", "desktop" )\
X(RES_DOCK_POS, "Dockpos", "dockpos" )\
X(RES_FACE_NAME, "FaceName", "faceName" )\
X(RES_FOREGROUND, "Foreground", "foreground" )\
X(RES_DOCK_BACKGROUND, "DockBackground", "dockBackground" )\
X(RES_DOCK_BORDER, "DockBorder", "dockBorder" )\
X(RES_ACTIVE_BG, "ActiveBackground", "activeBackground" )\
X(RES_ACTIVE_TOP, "ActiveTopShadowColor", "activeTopShadowColor" )\
X(RES_ACTIVE_BOT, "ActiveBottomShadowColor", "activeBottomShadowColor" )\
X(RES_INACTIVE_BG, "InactiveBackground", "inactiveBackground" )\
X(RES_INACTIVE_TOP, "InactiveTopShadowColor", "inactiveTopShadowColor" )\
X(RES_INACTIVE_BOT, "InactiveBottomShadowColor", "inactiveBottomShadowColor" )\
X(RES_URGENT_BG, "UrgentBackground", "urgentBackground" )\
X(RES_URGENT_TOP, "UrgentTopShadowColor", "urgentTopShadowColor" )\
X(RES_URGENT_BOT, "UrgentBottomShadowColor", "urgentBottomShadowColor" )\
X(RES_BORDER_WIDTH, "BorderWidth", "borderWidth" )\
X(RES_SHADOW_WIDTH, "ShadowThickness", "shadowThickness" )\
X(RES_TITLE_WIDTH, "TitleWidth", "titleWidth" )\
X(RES_DOCK_WIDTH, "DockWidth", "dockWidth" )\
X(RES_DOCK_SPACE, "DockSpace", "dockSpace" )\
X(RES_DOCK_GRAVITY, "DockGravity", "dockGravity" )\
X(RES_NOTIFY_GAP, "NotifGap", "notifGap" )\
X(RES_NOTIFY_GRAVITY, "NotifGravity", "notifGravity" )\
X(RES_NDESKTOPS, "NumOfDesktops", "numOfDesktops" )\
X(RES_SNAP_PROXIMITY, "SnapProximity", "snapProximity" )\
X(RES_MOVE_TIME, "MoveTime", "moveTime" )\
X(RES_RESIZE_TIME, "ResizeTime", "resizeTime" )
enum Resource {
#define X(res, class, name) res,
RESOURCES
NRESOURCES
#undef X
};
enum border {
/* border array indices */
BORDER_N,
BORDER_S,
BORDER_W,
BORDER_E,
BORDER_NW,
BORDER_NE,
BORDER_SW,
BORDER_SE,
BORDER_LAST
};
enum {
/* cursor array indices */
CURSOR_NORMAL, /* regular cursor */
CURSOR_MOVE, /* arrow-cross cursor */
CURSOR_NW, /* north-west pointing cursor */
CURSOR_NE, /* north-east pointing cursor */
CURSOR_SW, /* south-west pointing cursor */
CURSOR_SE, /* south-east pointing cursor */
CURSOR_N, /* north pointing cursor */
CURSOR_S, /* south pointing cursor */
CURSOR_W, /* west pointing cursor */
CURSOR_E, /* east pointing cursor */
CURSOR_V, /* vertical arrow cursor */
CURSOR_H, /* horizontal arrow cursor */
CURSOR_HAND, /* hand cursor */
CURSOR_PIRATE, /* pirate-cross cursor */
CURSOR_LAST
};
enum {
/* color array indices */
COLOR_BG = 0,
COLOR_BORD = 1,
COLOR_FG = 2,
COLOR_MID = 0,
COLOR_LIGHT = 1,
COLOR_DARK = 2,
COLOR_LAST = 3
};
enum {
/* decoration style array indices */
FOCUSED = 0,
UNFOCUSED = 1,
URGENT = 2,
PRESSED = 3,
STYLE_LAST = 4,
/* XXX: TODO */
STYLE_OTHER = PRESSED,
};
enum {
/* window layer array indices */
LAYER_DESK,
LAYER_BELOW,
LAYER_NORMAL,
LAYER_ABOVE,
LAYER_MENU,
LAYER_DOCK,
LAYER_LAST
};
enum {
/* strut elements array indices */
STRUT_LEFT = 0,
STRUT_RIGHT = 1,
STRUT_TOP = 2,
STRUT_BOTTOM = 3,
STRUT_LEFT_START_Y = 4,
STRUT_LEFT_END_Y = 5,
STRUT_RIGHT_START_Y = 6,
STRUT_RIGHT_END_Y = 7,
STRUT_TOP_START_X = 8,
STRUT_TOP_END_X = 9,
STRUT_BOTTOM_START_X = 10,
STRUT_BOTTOM_END_X = 11,
STRUT_LAST = 12,
};
enum State {
/* container states bits*/
ABOVE = 0x001,
BELOW = 0x002,
FULLSCREEN = 0x004,
MAXIMIZED = 0x008,
MINIMIZED = 0x010,
SHADED = 0x020,
STICKY = 0x040,
USERPLACED = 0x080,
ATTENTION = 0x100,
STRETCHED = 0x200,
/* dockapp states bits */
EXTEND = 0x001,
SHRUNK = 0x002,
RESIZED = 0x004,
};
enum {
/* container state action */
REMOVE = 0,
ADD = 1,
TOGGLE = 2
};
enum Octant {
/* window eight sections (aka octants) */
C = 0,
N = (1 << 0),
S = (1 << 1),
W = (1 << 2),
E = (1 << 3),
NW = (1 << 0) | (1 << 2),
NE = (1 << 0) | (1 << 3),
SW = (1 << 1) | (1 << 2),
SE = (1 << 1) | (1 << 3),
};
TAILQ_HEAD(Queue, Object);
struct Object {
/*
* An object is any structure that can directly contain a
* window of an application. For example, an open Gimp
* application can have two menu windows (on its multi-window
* mode), a dialog window, and the main application window.
* For each window of that application we have one object:
* - The Menu struct for the menu windows.
* - The Dialog struct for the dialog window.
* - The Tab struct for the main window.
*
* The application's main window is contained inside a tab,
* which is contained inside a row, which is contained inside a
* column, which is contained inside a container. but only the
* tab is an object, in the sense that it directly contains a
* window of the application. The row, the column, and the
* container are not objects in this sense, because they do not
* directly contain an application window (they contain it
* indirectly).
*
* Each object structure begins with an Object struct, so they
* can be polymorphically manipulated as its actual type or as
* an Object. For example, we can cast a Dialog into an Object
* and vice-versa (if we know that the object is a type).
*
* The structs that can directly contain an application window
* are the following:
* - struct Tab;
* - struct Dialog;
* - struct Menu;
* - struct Bar;
* - struct Dockapp;
* - struct Splash;
* - struct Notification;
*/
TAILQ_ENTRY(Object) entry;
Window win;
struct Class *class;
};
TAILQ_HEAD(RowQueue, Row);
struct Row {
TAILQ_ENTRY(Row) entry;
struct Queue tabq; /* list of tabs */
/*
* Each columnt is split vertically into rows; and each row
* contains tabs. We maintain in a row its list of tabs, and
* a pointer to its parent column.
*/
struct Column *col; /* pointer to parent column */
struct Tab *seltab; /* pointer to selected tab */
int ntabs; /* number of tabs */
/* At the bottom of each column, except the bottomost one, ther
* is a divisor handle which can be dragged to resize the row.
* There are also other windows forming a row:
* - The divisor.
* - The frame below the tab windows.
* - The title bar where the tabs are drawn.
* - The left (row maximize) button.
* - The right (close) button.
*/
Window div; /* horizontal division between rows */
Window frame; /* where tab frames are */
Window bar; /* title bar frame */
Window bl; /* left button */
Window br; /* right button */
/*
* We only keep the vertical geometry of a row (ie', its y
* position and its height), because, since a row horizontally
* spans its parent column width, its horizontal geometry is
* equal to the geometry of its parent column.
*/
double fact; /* factor of height relative to container */
int y, h; /* row geometry */
/*
* Whether the frame is unmapped
*/
int isunmapped;
};
TAILQ_HEAD(ColumnQueue, Column);
struct Column {
TAILQ_ENTRY(Column) entry;
struct RowQueue rowq; /* list of rows */
/*
* Each container is split horizontally into columns; and each
* column is split vertically into rows. We maintain in a
* column its list of rows, and a pointer to its parent
* container.
*/
struct Container *c; /* pointer to parent container */
struct Row *selrow; /* pointer to selected row */
/*
* At the right of each column, except the rightmost one, there
* is a divisor handle which can be dragged to resize the
* columns.
*/
Window div; /* vertical division between columns */
/*
* We only keep the horizontal geometry of a column (ie', its x
* position and its width), because, since a column vertically
* spans its parent container height, its vertical geometry is
* equal to the geometry of its parent container.
*/
double fact; /* factor of width relative to container */
int nrows; /* number of rows */
int x, w; /* column geometry */
};
TAILQ_HEAD(ContainerQueue, Container);
struct Container {
/*
* The container is the main entity the user interact with, and
* the windows of most applications are mapped into a container.
*
* A container is an element of two queues:
* - The focus queue is a list of containers in the focus order.
* There is only one focus queue.
* - A raise queue is a list of containers in the Z-axis order.
* There are one raise queue for each layer of containers
* (fullscreen, above, middle and below).
*/
TAILQ_ENTRY(Container) entry; /* entry for the focus queue */
TAILQ_ENTRY(Container) raiseentry; /* entry for a raise queue */
/*
* A container contains a list of columns.
* A column contains a list of rows.
* A row contains a list of tabs.
* A tab contains an application window and a list of menus and
* a list of dialogs.
*
* A container with no column is a dummy container, used as
* placeholders on the Z-axis list.
*/
struct ColumnQueue colq; /* list of columns in container */
struct Column *selcol; /* pointer to selected container */
int ncols; /* number of columns */
/*
* A container appears on a certain desktop of a certain monitor.
*/
struct Monitor *mon; /* monitor container is on */
int desk; /* desktop container is on */
/*
* A container is composed of a frame window, mapped below all
* the columns/rows/tabs/etc. Inside the frame window, there
* are mapped the cursor windows, one for each border and corner
* of the container's frame. Each cursor window is associated
* to a pointer cursor (that's why hovering the pointer over the
* bottom right corner of the frame turns the cursor into an
* arrow.
*/
Window frame; /* window to reparent the contents of the container */
Window curswin[BORDER_LAST]; /* dummy window used for change cursor while hovering borders */
/*
* A container has three geometries (position and size): one for
* when it is maximized, one for when it is fullscreen, and one
* for when it is floating. The maximized and fullscreen
* geometry of a container is obvious (they can be inferred from
* the monitor size). We then save the non-maximized geometry.
* We also save the current geometry (which can be one of those
* three).
*/
int x, y, w, h, b; /* current geometry */
int nx, ny, nw, nh; /* non-maximized geometry */
/*
* Container state bitmask.
*/
enum State state;
Bool ishidden; /* whether container is hidden */
Bool isobscured; /* whether container is obscured */
};
TAILQ_HEAD(MonitorQueue, Monitor);
struct Monitor {
/*
* Each monitor has a focused desktop (a value between 0 and
* config.ndesktops - 1). A monitor also has two geometries:
* its full actual geometry (a rectangle spanning the entire
* monitor), and the window area (a rectangle spanning only
* the area without any dock, bar, panel, etc (that is, the
* area where containers can be maximized into).
*/
TAILQ_ENTRY(Monitor) entry;
int seldesk; /* focused desktop on that monitor */
int mx, my, mw, mh; /* monitor size */
int wx, wy, ww, wh; /* window area */
};
struct Class {
enum Type {
TYPE_UNKNOWN,
TYPE_NORMAL,
TYPE_DESKTOP,
TYPE_BAR,
TYPE_DOCK,
TYPE_MENU,
TYPE_DIALOG,
TYPE_NOTIFICATION,
TYPE_PROMPT,
TYPE_SPLASH,
TYPE_DOCKAPP,
TYPE_POPUP,
TYPE_LAST
} type;
/* class' methods */
void (*setstate)(struct Object *, enum State, int);
void (*manage)(struct Tab *, struct Monitor *, int, Window, Window, XRectangle, enum State);
void (*unmanage)(struct Object *);
};
struct Tab {
struct Object obj;
/*
* Additionally to the application window (in .obj), a tab
* contains a list of swallowed dialogs (unless -d is given) and
* a list of detached menus. A tab also contains a pointer to
* its parent row.
*/
struct Queue dialq; /* queue of dialogs */
struct Row *row; /* pointer to parent row */
/*
* The application whose windows the tab maintains can be
* grouped under a leader window (which is not necessarily
* mapped on the screen).
*/
Window leader; /* the group leader of the window */
/*
* Visually, a tab is composed of a title bar (aka tab); and a
* frame window which the application window and swallowed
* dialog windows are child of.
*/
Window title; /* title bar (tab) */
Window frame; /* window to reparent the client window */
/*
* First we draw into pixmaps, and then copy their contents
* into the frame and title windows themselves whenever they
* are damaged. It is necessary to redraw on the pixmaps only
* when the titlebar or frame resizes; so we save the geometry
* of hte pixmaps to compare with the size of their windows.
*/
Pixmap pix; /* pixmap to draw the background of the frame */
Pixmap pixtitle; /* pixmap to draw the background of the title window */
int ptw; /* pixmap width for the title window */
int pw, ph; /* pixmap size of the frame */
/*
* Geometry of the title bar (aka tab).
*/
int x, w; /* title bar geometry */
unsigned int pid;
/*
* Name of the tab's application window, its size and urgency.
*/
int winw, winh; /* window geometry */
Bool isurgent; /* whether tab is urgent */
char *name; /* client name */
};
struct Dialog {
struct Object obj;
struct Tab *tab; /* pointer to parent tab */
/*
* Frames, pixmaps, saved pixmap geometry, etc
*/
Window frame; /* window to reparent the client window */
Pixmap pix; /* pixmap to draw the frame */
int pw, ph; /* pixmap size */
/*
* Dialog geometry, which can be resized as the user resizes the
* container. The dialog can grow up to a maximum width and
* height.
*/
int x, y, w, h; /* geometry of the dialog inside the tab frame */
int maxw, maxh; /* maximum size of the dialog */
int ignoreunmap; /* number of unmapnotifys to ignore */
};
struct Menu {
struct Object obj;
struct Monitor *mon;
Window leader;
/*
* Frames, pixmaps, saved pixmap geometry, etc
*/
Window titlebar; /* close button */
Window button; /* close button */
Window frame; /* frame window */
Pixmap pixtitlebar; /* pixmap to draw the titlebar */
int pw, ph; /* pixmap size */
int tw; /* titlebar pixmap size */
int x, y, w, h; /* geometry of the menu window + the frame */
int ignoreunmap; /* number of unmapnotifys to ignore */
char *name; /* client name */
};
struct Bar {
struct Object obj;
struct Monitor *mon;
int strut[STRUT_LAST]; /* strut values */
Bool ispartial; /* whether strut has 12 elements rather than 4 */
enum State state;
};
struct Dockapp {
struct Object obj;
int x, y, w, h; /* dockapp position and size */
int ignoreunmap; /* number of unmap requests to ignore */
int dockpos; /* position of the dockapp in the dock */
int state; /* dockapp state */
int slotsize; /* size of the slot the dockapp is in */
};
struct Splash {
struct Object obj;
struct Monitor *mon;
int desk;
int x, y, w, h;
};
struct Notification {
struct Object obj;
Window frame; /* window to reparent the actual client window */
Pixmap pix; /* pixmap to draw the frame */
int w, h; /* geometry of the entire thing (content + decoration) */
int pw, ph; /* pixmap width and height */
};
struct WM {
Bool running;
/*
* The window manager maintains a list of monitors and several
* window-holding entities such as containers and bars.
*/
struct MonitorQueue monq; /* queue of monitors */
struct Queue barq; /* queue of bars */
struct Queue splashq; /* queue of splash screen windows */
struct Queue notifq; /* queue of notifications */
struct Queue menuq; /* queue of menus */
struct ContainerQueue focusq; /* queue of containers ordered by focus history */
int nclients; /* total number of container windows */
/*
* Resources
*/
struct {
XrmClass class;
XrmName name;
} application, resources[NRESOURCES];
XrmQuark anyresource;
/*
* Xrandr information.
*/
int xrandr; /* whether Xrandr is being used */
int xrandrev; /* event base for Xrandr */
/*
* Containers are listed by the focusq queue; they are also
* listed under the stackq list, ordered by its position on
* the Z-axis.
*
* Since there are 4 layers on the Z-axis and we often need
* to move a container to the top of its layer, we have four
* "dummy" containers used as placeholder as the top of each
* layer on the stackq list.
*
* There is also a dummy window to place the dock.
*/
struct ContainerQueue stackq;
struct Container layers[LAYER_LAST];
Window docklayer; /* dummy window used to set dock layer */
/*
* We maintain a pointer to the focused container and the
* previously focused one. And also a pointer to the focused
* monitor which will receive new containers.
*/
struct Container *focused; /* pointer to focused container */
struct Container *prevfocused; /* pointer to previously focused container */
struct Monitor *selmon; /* pointer to selected monitor */
/*
* Dummy windows
*/
Window checkwin; /* carries _NET_SUPPORTING_WM_CHECK */
Window focuswin; /* gets focus when no container is visible */
Window dragwin; /* follows mouse while dragging */
Window restackwin; /* reordered in Z axis to save a position */
Cursor cursors[CURSOR_LAST]; /* cursors for the mouse pointer */
int showingdesk; /* whether the desktop is being shown */
int minsize; /* minimum size of a container */
/*
* Whenever a function adds or removes a client, this value is
* set. At the end of each main loop iteration, it is checked
* and the list of clients is changed accordingly.
*/
Bool setclientlist;
Window presswin;
struct {
Pixmap btn_left;
Pixmap btn_right;
Pixmap bar_vert;
Pixmap bar_horz;
Pixmap corner_nw;
Pixmap corner_ne;
Pixmap corner_sw;
Pixmap corner_se;
} decorations[STYLE_LAST];
};
struct Dock {
struct Object obj;
struct Queue dappq;
Pixmap pix; /* dock pixmap */
int x, y, w, h; /* dock geometry */
int pw, ph; /* dock pixmap size */
enum State state;
};
struct Config {
/* default configuration, set at `config.c` */
KeySym altkeysym; /* key to trigger alt-tab */
KeySym tabkeysym; /* key to cycle alt-tab */
int disablehidden; /* whether -h is passed */
int disablealttab; /* whether -t is passed */
int floatdialog; /* whether -d is passed */
int honorconfig; /* whether -c is passed */
int sloppyfocus; /* whether -s is passed */
int sloppytiles; /* whether -S is passed */
int ndesktops; /* number of desktops */
int notifgap; /* gap between notifications */
int dockwidth, dockspace; /* dock geometry */
int snap; /* snap proximity */
int borderwidth; /* width of the border frame */
int titlewidth; /* height of the title bar */
int shadowthickness; /* thickness of the 3D shadows */
int movetime; /* time (ms) to redraw containers during moving */
int resizetime; /* time (ms) to redraw containers during resizing */
char *menucmd; /* command to spawn when clicking the menu button */
/* gravities (N for north, NE for northeast, etc) */
const char *notifgravity;
const char *dockgravity;
/* font and color names */
const char *font;
const char *colors[STYLE_LAST][COLOR_LAST];
/* hardcoded rules */
struct Rule {
/* matching class, instance and role */
const char *class;
const char *instance;
const char *role;
/* type, state, etc to apply on matching windows */
int type;
int state;
int desktop;
} *rules;
/* the values below are computed from the values above */
KeyCode altkeycode; /* keycode of the altkeysym */
KeyCode tabkeycode; /* keycode of the tabkeysym */
unsigned int modifier; /* modifier of the altkeycode */
int corner; /* = .borderwidth + .titlewidth */
int divwidth; /* = .borderwidth */
};
/* container routines */
struct Container *getnextfocused(struct Monitor *mon, int desk);
struct Container *containerraisetemp(struct Container *prevc, int backward);
void containernewwithtab(struct Tab *tab, struct Monitor *mon, int desk, XRectangle rect, enum State state);
void containerbacktoplace(struct Container *c, int restack);
void containerdel(struct Container *c);
void containermoveresize(struct Container *c, int checkstack);
void containerdecorate(struct Container *c);
void containercalccols(struct Container *c);
void containermove(struct Container *c, int x, int y, int relative);
void containerraise(struct Container *c, enum State state);
void containerconfigure(struct Container *c, unsigned int valuemask, XWindowChanges *wc);
void containersendtodeskandfocus(struct Container *c, struct Monitor *mon, unsigned long desk);
void containerplace(struct Container *c, struct Monitor *mon, int desk, int userplaced);
void containerdelrow(struct Row *row);
void containerhide(struct Container *c, int hide);
void tabdetach(struct Tab *tab, int x, int y);
void tabfocus(struct Tab *tab, int gotodesk);
void tabdecorate(struct Tab *t, int pressed);
void tabupdateurgency(struct Tab *t, int isurgent);
void rowstretch(struct Column *col, struct Row *row);
void dialogconfigure(struct Dialog *d, unsigned int valuemask, XWindowChanges *wc);
void dialogmoveresize(struct Dialog *dial);
int tabattach(struct Container *c, struct Tab *t, int x, int y);
int containerisshaded(struct Container *c);
int containerisvisible(struct Container *c, struct Monitor *mon, int desk);
int columncontentheight(struct Column *col);
int containercontentwidth(struct Container *c);
/* menu */
void menufocus(struct Menu *menu);
void menuincrmove(struct Menu *menu, int x, int y);
void menuconfigure(struct Menu *menu, unsigned int valuemask, XWindowChanges *wc);
void menumoveresize(struct Menu *menu);
void menudecorate(struct Menu *menu);
void menufocusraise(struct Menu *menu);
void menuraise(struct Menu *menu);
void menuplace(struct Monitor *mon, struct Menu *menu);
void menuupdate(void);
int istabformenu(struct Tab *tab, struct Menu *menu);
/* other object routines */
void dockappconfigure(struct Dockapp *dapp, unsigned int valuemask, XWindowChanges *wc);
void barstrut(struct Bar *bar);
void barstack(struct Bar *bar);
void notifplace(void);
void notifdecorate(struct Notification *n);
void splashplace(struct Monitor *mon, struct Splash *splash);
void splashhide(struct Splash *splash, int hide);
void splashrise(struct Splash *splash);
void dockupdate(void);
void dockdecorate(void);
void dockreset(void);
void dockstack(void);
/* monitor routines */
struct Monitor *getmon(int x, int y);
void mondel(struct Monitor *mon);
void monupdate(void);
void monupdatearea(void);
void fitmonitor(struct Monitor *mon, int *x, int *y, int *w, int *h, float factor);
void moninit(void);
void monevent(XEvent *e);
/* wm hints and messages routines */
void icccmdeletestate(Window win);
void icccmwmstate(Window win, int state);
void ewmhinit(const char *wmname);
void ewmhsetdesktop(Window win, long d);
void ewmhsetframeextents(Window win, int b, int t);
void ewmhsetclients(void);
void ewmhsetstate(struct Container *c);
void ewmhsetwmdesktop(struct Container *c);
void ewmhsetactivewindow(Window w);
void ewmhsetcurrentdesktop(unsigned long n);
void ewmhsetshowingdesktop(int n);
void shoddocks(void);
void shodgrouptab(struct Container *c);
void shodgroupcontainer(struct Container *c);
void winupdatetitle(Window win, char **name);
void winnotify(Window win, int x, int y, int w, int h);
void winclose(Window win);
void unmapwin(Window win);
void mapwin(Window win);
/* decoration routines */
Window createframe(XRectangle geom);
Window createdecoration(Window frame, XRectangle geom, Cursor curs, int gravity);
void updatepixmap(Pixmap *pix, int *pixw, int *pixh, int w, int h);
void drawcommit(Pixmap pix, Window win);
void backgroundcommit(Window, int style);
void drawborders(Pixmap pix, int w, int h, int style);
void drawbackground(Pixmap pix, int x, int y, int w, int h, int style);
void drawframe(Pixmap pix, int isshaded, int w, int h, enum Octant o, int style);
void drawshadow(Pixmap pix, int x, int y, int w, int h, int style, int pressed, int thickness);
void drawtitle(Drawable pix, const char *text, int w, int drawlines, int style, int pressed, int ismenu);
void drawprompt(Pixmap pix, int w, int h);
void redecorate(Window win, int border, int style, Bool pressed);
void cleantheme(void);
void setresources(char *xrm);
void initdepth(void);
void inittheme(void);
/* window management routines */
void setmod(void);
void scan(void);
void deskupdate(struct Monitor *mon, int desk);
int getwintype(Window win, Window *leader, struct Tab **tab, int *state, XRectangle *rect, int *desk);
struct Class *getwinclass(Window win, Window *leader, struct Tab **tab,
enum State *state, XRectangle *rect, int *desk);
/* extern variables */
extern void (*xevents[LASTEvent])(XEvent *);
extern struct Config config;
extern struct WM wm;
extern struct Dock dock;
/* object classes */
extern struct Class *bar_class;
extern struct Class *dialog_class;
extern struct Class *dock_class;
extern struct Class *dockapp_class;
extern struct Class *menu_class;
extern struct Class *notif_class;
extern struct Class *prompt_class;
extern struct Class *splash_class;
extern struct Class *tab_class;