all repos — dwm @ 72655f0ce7abe85853aca98a051df2aab07116f9

fork of suckless dynamic window manager

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