dwm.h (view raw)
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 */
17enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast };
18
19/********** CUSTOMIZE **********/
20
21typedef struct DC DC;
22typedef struct Client Client;
23typedef struct Fnt Fnt;
24typedef struct Key Key;
25
26/* atoms */
27enum { WMProtocols, WMDelete, WMLast };
28enum { NetSupported, NetWMName, NetLast };
29
30/* cursor */
31enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
32
33struct Fnt {
34 XFontStruct *xfont;
35 XFontSet set;
36 int ascent;
37 int descent;
38 int height;
39};
40
41struct 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
51struct 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
68struct Key {
69 unsigned long mod;
70 KeySym keysym;
71 void (*func)(void *aux);
72 void *aux;
73};
74
75extern Display *dpy;
76extern Window root;
77extern Atom wm_atom[WMLast], net_atom[NetLast];
78extern Cursor cursor[CurLast];
79extern Bool running, issel;
80extern void (*handler[LASTEvent]) (XEvent *);
81
82extern int tsel, screen, sx, sy, sw, sh, th;
83extern char stext[1024], *tags[TLast];
84
85extern DC dc;
86extern Client *clients, *stack;
87
88/* client.c */
89extern void manage(Window w, XWindowAttributes *wa);
90extern void unmanage(Client *c);
91extern Client *getclient(Window w);
92extern void focus(Client *c);
93extern void update_name(Client *c);
94extern void draw_client(Client *c);
95extern void resize(Client *c);
96extern void update_size(Client *c);
97extern Client *gettitle(Window w);
98extern void craise(Client *c);
99extern void lower(Client *c);
100extern void ckill(void *aux);
101extern void sel(void *aux);
102extern void max(void *aux);
103extern void floating(void *aux);
104extern void tiling(void *aux);
105extern void gravitate(Client *c, Bool invert);
106
107/* draw.c */
108extern void draw(Bool border, const char *text);
109extern unsigned long initcolor(const char *colstr);
110extern void initfont(const char *fontstr);
111extern unsigned int textnw(char *text, unsigned int len);
112extern unsigned int textw(char *text);
113extern unsigned int texth(void);
114
115/* event.c */
116extern void discard_events(long even_mask);
117
118/* dev.c */
119extern void update_keys(void);
120extern void keypress(XEvent *e);
121extern void mresize(Client *c);
122extern void mmove(Client *c);
123
124/* main.c */
125extern int error_handler(Display *dsply, XErrorEvent *e);
126extern void send_message(Window w, Atom a, long value);
127extern int win_proto(Window w);
128extern void quit(void *aux);
129
130/* util.c */
131extern void error(const char *errstr, ...);
132extern void *emallocz(unsigned int size);
133extern void *emalloc(unsigned int size);
134extern void *erealloc(void *ptr, unsigned int size);
135extern char *estrdup(const char *str);
136extern void spawn(char *argv[]);
137extern void swap(void **p1, void **p2);