JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied Sanders max_and_focus.patch
[dwm.git] / dwm.h
1 /*
2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3  * See LICENSE file for license details.
4  */
5
6 #include "config.h"
7 #include <X11/Xlib.h>
8
9 /* mask shorthands, used in event.c and client.c */
10 #define BUTTONMASK              (ButtonPressMask | ButtonReleaseMask)
11 #define MOUSEMASK               (BUTTONMASK | PointerMotionMask)
12 #define PROTODELWIN             1
13
14 typedef union {
15         const char *cmd;
16         int i;
17 } Arg;
18
19 /* atoms */
20 enum { NetSupported, NetWMName, NetLast };
21 enum { WMProtocols, WMDelete, WMLast };
22
23 /* cursor */
24 enum { CurNormal, CurResize, CurMove, CurLast };
25
26 /* color */
27 enum { ColFG, ColBG, ColLast };
28
29 /* window corners */
30 typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
31
32 typedef struct {
33         int ascent;
34         int descent;
35         int height;
36         XFontSet set;
37         XFontStruct *xfont;
38 } Fnt;
39
40 typedef struct { /* draw context */
41         int x, y, w, h;
42         unsigned long norm[ColLast];
43         unsigned long sel[ColLast];
44         unsigned long status[ColLast];
45         Drawable drawable;
46         Fnt font;
47         GC gc;
48 } DC;
49
50 typedef struct Client Client;
51 struct Client {
52         char name[256];
53         int proto;
54         int x, y, w, h;
55         int tx, ty, tw, th; /* title */
56         int basew, baseh, incw, inch, maxw, maxh, minw, minh;
57         int grav;
58         long flags; 
59         unsigned int border, weight;
60         Bool isfloat;
61         Bool *tags;
62         Client *next;
63         Client *prev;
64         Window win;
65         Window twin;
66 };
67
68 extern const char *tags[];
69 extern char stext[1024];
70 extern int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh;
71 extern unsigned int ntags, numlockmask;
72 extern void (*handler[LASTEvent])(XEvent *);
73 extern void (*arrange)(Arg *);
74 extern Atom wmatom[WMLast], netatom[NetLast];
75 extern Bool running, issel, maximized, *seltag;
76 extern Client *clients, *sel;
77 extern Cursor cursor[CurLast];
78 extern DC dc;
79 extern Display *dpy;
80 extern Window root, barwin;
81
82 /* client.c */
83 extern void ban(Client *c);
84 extern void focus(Client *c);
85 extern Client *getclient(Window w);
86 extern Client *getctitle(Window w);
87 extern void gravitate(Client *c, Bool invert);
88 extern void killclient(Arg *arg);
89 extern void manage(Window w, XWindowAttributes *wa);
90 extern void resize(Client *c, Bool sizehints, Corner sticky);
91 extern void setsize(Client *c);
92 extern void settitle(Client *c);
93 extern void togglemax(Arg *arg);
94 extern void unmanage(Client *c);
95
96 /* draw.c */
97 extern void drawall();
98 extern void drawstatus();
99 extern void drawtitle(Client *c);
100 extern unsigned long getcolor(const char *colstr);
101 extern void setfont(const char *fontstr);
102 extern unsigned int textw(const char *text);
103
104 /* event.c */
105 extern void grabkeys();
106 extern void procevent();
107
108 /* main.c */
109 extern int getproto(Window w);
110 extern void quit(Arg *arg);
111 extern void sendevent(Window w, Atom a, long value);
112 extern int xerror(Display *dsply, XErrorEvent *ee);
113
114 /* tag.c */
115 extern void initrregs();
116 extern Client *getnext(Client *c);
117 extern Client *getprev(Client *c);
118 extern void settags(Client *c);
119 extern void tag(Arg *arg);
120 extern void toggletag(Arg *arg);
121
122 /* util.c */
123 extern void *emallocz(unsigned int size);
124 extern void eprint(const char *errstr, ...);
125 extern void *erealloc(void *ptr, unsigned int size);
126 extern void spawn(Arg *arg);
127
128 /* view.c */
129 extern void detach(Client *c);
130 extern void dofloat(Arg *arg);
131 extern void dotile(Arg *arg);
132 extern void focusnext(Arg *arg);
133 extern void focusprev(Arg *arg);
134 extern Bool isvisible(Client *c);
135 extern void restack();
136 extern void togglemode(Arg *arg);
137 extern void toggleview(Arg *arg);
138 extern void view(Arg *arg);
139 extern void viewall(Arg *arg);
140 extern void zoom(Arg *arg);