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 toggle(void *aux);
104extern void gravitate(Client *c, Bool invert);
105
106/* draw.c */
107extern void draw(Bool border, const char *text);
108extern unsigned long initcolor(const char *colstr);
109extern void initfont(const char *fontstr);
110extern unsigned int textnw(char *text, unsigned int len);
111extern unsigned int textw(char *text);
112extern unsigned int texth(void);
113
114/* event.c */
115extern void discard_events(long even_mask);
116
117/* dev.c */
118extern void update_keys(void);
119extern void keypress(XEvent *e);
120extern void mresize(Client *c);
121extern void mmove(Client *c);
122
123/* main.c */
124extern int error_handler(Display *dsply, XErrorEvent *e);
125extern void send_message(Window w, Atom a, long value);
126extern int win_proto(Window w);
127extern void quit(void *aux);
128
129/* util.c */
130extern void error(const char *errstr, ...);
131extern void *emallocz(unsigned int size);
132extern void *emalloc(unsigned int size);
133extern void *erealloc(void *ptr, unsigned int size);
134extern char *estrdup(const char *str);
135extern void spawn(char *argv[]);
136extern void swap(void **p1, void **p2);