dwm-meillo
view wm.h @ 36:d969b6807162
last change to dwm.html
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 10:02:28 +0200 |
parents | e90449e03167 |
children | 040a7074d23c |
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include <X11/Xlib.h>
8 /********** CUSTOMIZE **********/
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
17 /* tags */
18 enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast };
20 /********** CUSTOMIZE **********/
22 typedef struct DC DC;
23 typedef struct Client Client;
24 typedef struct Fnt Fnt;
25 typedef struct Key Key;
27 /* atoms */
28 enum { WMProtocols, WMDelete, WMLast };
29 enum { NetSupported, NetWMName, NetLast };
31 /* cursor */
32 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
34 struct Fnt {
35 XFontStruct *xfont;
36 XFontSet set;
37 int ascent;
38 int descent;
39 int height;
40 };
42 struct DC { /* draw context */
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 };
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 };
69 struct Key {
70 unsigned long mod;
71 KeySym keysym;
72 void (*func)(void *aux);
73 void *aux;
74 };
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 *);
83 extern int tsel, screen, sx, sy, sw, sh, th;
84 extern char stext[1024], *tags[TLast];
86 extern DC dc;
87 extern Client *clients, *stack;
89 /* client.c */
90 extern void manage(Window w, XWindowAttributes *wa);
91 extern void unmanage(Client *c);
92 extern Client *getclient(Window w);
93 extern void focus(Client *c);
94 extern void update_name(Client *c);
95 extern void draw_client(Client *c);
96 extern void resize(Client *c);
97 extern void update_size(Client *c);
98 extern Client *gettitle(Window w);
99 extern void craise(Client *c);
100 extern void lower(Client *c);
101 extern void ckill(void *aux);
102 extern void sel(void *aux);
103 extern void max(void *aux);
104 extern void toggle(void *aux);
105 extern void gravitate(Client *c, Bool invert);
107 /* draw.c */
108 extern void draw(Bool border, const char *text);
109 extern void initcolors(const char *bg, const char *fg, const char *bo);
110 extern void initfont(Fnt *font, const char *fontstr);
111 extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
112 extern unsigned int textw(Fnt *font, char *text);
113 extern unsigned int texth(Fnt *font);
115 /* event.c */
116 extern void discard_events(long even_mask);
118 /* kb.c */
119 extern void update_keys(void);
120 extern void keypress(XEvent *e);
122 /* mouse.c */
123 extern void mresize(Client *c);
124 extern void mmove(Client *c);
126 /* util.c */
127 extern void error(const char *errstr, ...);
128 extern void *emallocz(unsigned int size);
129 extern void *emalloc(unsigned int size);
130 extern void *erealloc(void *ptr, unsigned int size);
131 extern char *estrdup(const char *str);
132 extern void spawn(char *argv[]);
133 extern void swap(void **p1, void **p2);
135 /* wm.c */
136 extern int error_handler(Display *dsply, XErrorEvent *e);
137 extern void send_message(Window w, Atom a, long value);
138 extern int win_proto(Window w);
139 extern void quit(void *aux);