JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added viewall to mainstream (only Ross Mohns version, not the toggle)
[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 ismax;
62         Bool *tags;
63         Client *next;
64         Client *prev;
65         Window win;
66         Window twin;
67 };
68
69 extern const char *tags[];
70 extern char stext[1024];
71 extern int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh;
72 extern unsigned int ntags, numlockmask;
73 extern void (*handler[LASTEvent])(XEvent *);
74 extern void (*arrange)(Arg *);
75 extern Atom wmatom[WMLast], netatom[NetLast];
76 extern Bool running, issel, *seltag;
77 extern Client *clients, *sel;
78 extern Cursor cursor[CurLast];
79 extern DC dc;
80 extern Display *dpy;
81 extern Window root, barwin;
82
83 /* client.c */
84 extern void ban(Client *c);
85 extern void focus(Client *c);
86 extern Client *getclient(Window w);
87 extern Client *getctitle(Window w);
88 extern void gravitate(Client *c, Bool invert);
89 extern void killclient(Arg *arg);
90 extern void manage(Window w, XWindowAttributes *wa);
91 extern void resize(Client *c, Bool sizehints, Corner sticky);
92 extern void setsize(Client *c);
93 extern void settitle(Client *c);
94 extern void togglemax(Arg *arg);
95 extern void unmanage(Client *c);
96
97 /* draw.c */
98 extern void drawall();
99 extern void drawstatus();
100 extern void drawtitle(Client *c);
101 extern unsigned long getcolor(const char *colstr);
102 extern void setfont(const char *fontstr);
103 extern unsigned int textw(const char *text);
104
105 /* event.c */
106 extern void grabkeys();
107 extern void procevent();
108
109 /* main.c */
110 extern int getproto(Window w);
111 extern void quit(Arg *arg);
112 extern void sendevent(Window w, Atom a, long value);
113 extern int xerror(Display *dsply, XErrorEvent *ee);
114
115 /* tag.c */
116 extern void initrregs();
117 extern Client *getnext(Client *c);
118 extern Client *getprev(Client *c);
119 extern void settags(Client *c);
120 extern void tag(Arg *arg);
121 extern void toggletag(Arg *arg);
122
123 /* util.c */
124 extern void *emallocz(unsigned int size);
125 extern void eprint(const char *errstr, ...);
126 extern void *erealloc(void *ptr, unsigned int size);
127 extern void spawn(Arg *arg);
128
129 /* view.c */
130 extern void detach(Client *c);
131 extern void dofloat(Arg *arg);
132 extern void dotile(Arg *arg);
133 extern void focusnext(Arg *arg);
134 extern void focusprev(Arg *arg);
135 extern Bool isvisible(Client *c);
136 extern void restack();
137 extern void togglemode(Arg *arg);
138 extern void toggleview(Arg *arg);
139 extern void view(Arg *arg);
140 extern void viewall(Arg *arg);
141 extern void zoom(Arg *arg);