dwm-meillo
view dwm.h @ 52:d18f6dd0cf23
fixed several things, nearly feature complete
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 20:28:19 +0200 |
parents | 035617ee18d1 |
children | 529901e6a227 |
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 MASTERW 52 /* percent */
15 #define WM_PROTOCOL_DELWIN 1
17 /* tags */
18 enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast };
20 /********** CUSTOMIZE **********/
22 typedef union Arg Arg;
23 typedef struct DC DC;
24 typedef struct Client Client;
25 typedef struct Fnt Fnt;
26 typedef struct Key Key;
27 typedef struct Rule Rule;
29 union Arg {
30 const char **argv;
31 int i;
32 };
34 /* atoms */
35 enum { WMProtocols, WMDelete, WMLast };
36 enum { NetSupported, NetWMName, NetLast };
38 /* cursor */
39 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
41 struct Fnt {
42 XFontStruct *xfont;
43 XFontSet set;
44 int ascent;
45 int descent;
46 int height;
47 };
49 struct 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 };
59 struct 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 Window win;
70 Window trans;
71 Window title;
72 Client *next;
73 Client *revert;
74 };
76 struct Rule {
77 const char *class;
78 const char *instance;
79 char *tags[TLast];
80 };
82 struct Key {
83 unsigned long mod;
84 KeySym keysym;
85 void (*func)(Arg *arg);
86 Arg arg;
87 };
89 extern Display *dpy;
90 extern Window root;
91 extern Atom wm_atom[WMLast], net_atom[NetLast];
92 extern Cursor cursor[CurLast];
93 extern Bool running, issel;
94 extern void (*handler[LASTEvent]) (XEvent *);
96 extern int tsel, screen, sx, sy, sw, sh, mw, th;
97 extern char *tags[TLast];
99 extern DC dc;
100 extern Client *clients, *sel;
102 /* client.c */
103 extern void manage(Window w, XWindowAttributes *wa);
104 extern void unmanage(Client *c);
105 extern Client *getclient(Window w);
106 extern void focus(Client *c);
107 extern void update_name(Client *c);
108 extern void draw_client(Client *c);
109 extern void resize(Client *c, Bool inc);
110 extern void update_size(Client *c);
111 extern Client *gettitle(Window w);
112 extern void craise(Client *c);
113 extern void lower(Client *c);
114 extern void ckill(Arg *arg);
115 extern void nextc(Arg *arg);
116 extern void prevc(Arg *arg);
117 extern void max(Arg *arg);
118 extern void floating(Arg *arg);
119 extern void tiling(Arg *arg);
120 extern void tag(Arg *arg);
121 extern void view(Arg *arg);
122 extern void zoom(Arg *arg);
123 extern void gravitate(Client *c, Bool invert);
125 /* draw.c */
126 extern void draw(Bool border, const char *text);
127 extern unsigned long initcolor(const char *colstr);
128 extern void initfont(const char *fontstr);
129 extern unsigned int textnw(char *text, unsigned int len);
130 extern unsigned int textw(char *text);
131 extern unsigned int texth(void);
133 /* event.c */
134 extern void discard_events(long even_mask);
136 /* dev.c */
137 extern void update_keys(void);
138 extern void keypress(XEvent *e);
139 extern void mresize(Client *c);
140 extern void mmove(Client *c);
142 /* main.c */
143 extern int error_handler(Display *dsply, XErrorEvent *e);
144 extern void send_message(Window w, Atom a, long value);
145 extern int win_proto(Window w);
146 extern void quit(Arg *arg);
148 /* util.c */
149 extern void error(const char *errstr, ...);
150 extern void *emallocz(unsigned int size);
151 extern void *emalloc(unsigned int size);
152 extern void *erealloc(void *ptr, unsigned int size);
153 extern char *estrdup(const char *str);
154 extern void spawn(Arg *arg);
155 extern void swap(void **p1, void **p2);