JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
1d672fdcd60b7493ea5ed59dfd9013413afb0441
[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 <X11/Xlib.h>
7
8 /********** CUSTOMIZE **********/
9
10 #define FONT            "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
11 #define BGCOLOR         "DarkSlateGrey"
12 #define FGCOLOR         "LightSteelBlue"
13 #define BORDERCOLOR     "SlateGray"
14 #define WM_PROTOCOL_DELWIN 1
15
16 /* tags */
17 enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast };
18
19 /********** CUSTOMIZE **********/
20
21 typedef struct DC DC;
22 typedef struct Client Client;
23 typedef struct Fnt Fnt;
24 typedef struct Key Key;
25
26 /* atoms */
27 enum { WMProtocols, WMDelete, WMLast };
28 enum { NetSupported, NetWMName, NetLast };
29
30 /* cursor */
31 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
32
33 struct Fnt {
34         XFontStruct *xfont;
35         XFontSet set;
36         int ascent;
37         int descent;
38         int height;
39 };
40
41 struct DC { /* draw context */
42         GC gc;
43         Drawable drawable;
44         int x, y, w, h;
45         Fnt font;
46         unsigned long bg;
47         unsigned long fg;
48         unsigned long border;
49 };
50
51 struct Client {
52         char name[256];
53         char *tags[TLast];
54         int proto;
55         int x, y, w, h;
56         int tx, ty, tw, th;
57         int basew, baseh, incw, inch, maxw, maxh, minw, minh;
58         int grav;
59         unsigned int border;
60         long flags; 
61         Window win;
62         Window trans;
63         Window title;
64         Client *next;
65         Client *snext;
66 };
67
68 struct Key {
69         unsigned long mod;
70         KeySym keysym;
71         void (*func)(void *aux);
72         void *aux;
73 };
74
75 extern Display *dpy;
76 extern Window root;
77 extern Atom wm_atom[WMLast], net_atom[NetLast];
78 extern Cursor cursor[CurLast];
79 extern Bool running, issel;
80 extern void (*handler[LASTEvent]) (XEvent *);
81
82 extern int tsel, screen, sx, sy, sw, sh, th;
83 extern char stext[1024], *tags[TLast];
84
85 extern DC dc;
86 extern Client *clients, *stack;
87
88 /* client.c */
89 extern void manage(Window w, XWindowAttributes *wa);
90 extern void unmanage(Client *c);
91 extern Client *getclient(Window w);
92 extern void focus(Client *c);
93 extern void update_name(Client *c);
94 extern void draw_client(Client *c);
95 extern void resize(Client *c);
96 extern void update_size(Client *c);
97 extern Client *gettitle(Window w);
98 extern void craise(Client *c);
99 extern void lower(Client *c);
100 extern void ckill(void *aux);
101 extern void sel(void *aux);
102 extern void max(void *aux);
103 extern void floating(void *aux);
104 extern void tiling(void *aux);
105 extern void gravitate(Client *c, Bool invert);
106
107 /* draw.c */
108 extern void draw(Bool border, const char *text);
109 extern unsigned long initcolor(const char *colstr);
110 extern void initfont(const char *fontstr);
111 extern unsigned int textnw(char *text, unsigned int len);
112 extern unsigned int textw(char *text);
113 extern unsigned int texth(void);
114
115 /* event.c */
116 extern void discard_events(long even_mask);
117
118 /* dev.c */
119 extern void update_keys(void);
120 extern void keypress(XEvent *e);
121 extern void mresize(Client *c);
122 extern void mmove(Client *c);
123
124 /* main.c */
125 extern int error_handler(Display *dsply, XErrorEvent *e);
126 extern void send_message(Window w, Atom a, long value);
127 extern int win_proto(Window w);
128 extern void quit(void *aux);
129
130 /* util.c */
131 extern void error(const char *errstr, ...);
132 extern void *emallocz(unsigned int size);
133 extern void *emalloc(unsigned int size);
134 extern void *erealloc(void *ptr, unsigned int size);
135 extern char *estrdup(const char *str);
136 extern void spawn(char *argv[]);
137 extern void swap(void **p1, void **p2);