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