Mercurial > dwm-meillo
annotate dwm.h @ 50:148f25ed0ad7
several other additions/fixes, dwm is quite usable already
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 18:21:38 +0200 |
parents | 466591c2f967 |
children | 035617ee18d1 |
rev | line source |
---|---|
0 | 1 /* |
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | |
3 * See LICENSE file for license details. | |
4 */ | |
5 | |
32 | 6 #include <X11/Xlib.h> |
7 | |
8 /********** CUSTOMIZE **********/ | |
2 | 9 |
32 | 10 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" |
43 | 11 #define BGCOLOR "DarkSlateGrey" |
12 #define FGCOLOR "LightSteelBlue" | |
13 #define BORDERCOLOR "SlateGray" | |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
14 #define WM_PROTOCOL_DELWIN 1 |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
15 |
32 | 16 /* tags */ |
17 enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast }; | |
18 | |
19 /********** CUSTOMIZE **********/ | |
20 | |
34 | 21 typedef struct DC DC; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
22 typedef struct Client Client; |
32 | 23 typedef struct Fnt Fnt; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
24 typedef struct Key Key; |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
25 typedef union Arg Arg; |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
26 |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
27 union Arg { |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
28 const char **argv; |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
29 int i; |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
30 }; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
31 |
5 | 32 /* atoms */ |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
33 enum { WMProtocols, WMDelete, WMLast }; |
0 | 34 enum { NetSupported, NetWMName, NetLast }; |
35 | |
5 | 36 /* cursor */ |
0 | 37 enum { CurNormal, CurResize, CurMove, CurInput, CurLast }; |
38 | |
32 | 39 struct Fnt { |
40 XFontStruct *xfont; | |
41 XFontSet set; | |
42 int ascent; | |
43 int descent; | |
44 int height; | |
45 }; | |
46 | |
34 | 47 struct DC { /* draw context */ |
32 | 48 GC gc; |
49 Drawable drawable; | |
50 int x, y, w, h; | |
51 Fnt font; | |
52 unsigned long bg; | |
53 unsigned long fg; | |
54 unsigned long border; | |
55 }; | |
56 | |
0 | 57 struct Client { |
31 | 58 char name[256]; |
59 char *tags[TLast]; | |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
60 int proto; |
20 | 61 int x, y, w, h; |
22
bd3a44353916
fixed several other stuff, coming closer to something useful
Anselm R. Garbe <garbeam@wmii.de>
parents:
20
diff
changeset
|
62 int tx, ty, tw, th; |
20 | 63 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
29 | 64 int grav; |
65 unsigned int border; | |
20 | 66 long flags; |
0 | 67 Window win; |
68 Window trans; | |
69 Window title; | |
70 Client *next; | |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
71 Client *revert; |
0 | 72 }; |
73 | |
8 | 74 struct Key { |
75 unsigned long mod; | |
76 KeySym keysym; | |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
77 void (*func)(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
78 Arg arg; |
8 | 79 }; |
80 | |
0 | 81 extern Display *dpy; |
32 | 82 extern Window root; |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
83 extern Atom wm_atom[WMLast], net_atom[NetLast]; |
0 | 84 extern Cursor cursor[CurLast]; |
31 | 85 extern Bool running, issel; |
5 | 86 extern void (*handler[LASTEvent]) (XEvent *); |
0 | 87 |
32 | 88 extern int tsel, screen, sx, sy, sw, sh, th; |
31 | 89 extern char stext[1024], *tags[TLast]; |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
90 |
34 | 91 extern DC dc; |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
92 extern Client *clients, *sel; |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
93 |
5 | 94 /* client.c */ |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
95 extern void manage(Window w, XWindowAttributes *wa); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
96 extern void unmanage(Client *c); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
97 extern Client *getclient(Window w); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
98 extern void focus(Client *c); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
99 extern void update_name(Client *c); |
16
359b6e563b95
several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
14
diff
changeset
|
100 extern void draw_client(Client *c); |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
101 extern void resize(Client *c); |
20 | 102 extern void update_size(Client *c); |
23 | 103 extern Client *gettitle(Window w); |
32 | 104 extern void craise(Client *c); |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
105 extern void lower(Client *c); |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
106 extern void ckill(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
107 extern void nextc(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
108 extern void prevc(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
109 extern void max(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
110 extern void floating(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
111 extern void tiling(Arg *arg); |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
112 extern void tag(Arg *arg); |
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
113 extern void view(Arg *arg); |
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
114 extern void zoom(Arg *arg); |
29 | 115 extern void gravitate(Client *c, Bool invert); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
116 |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
117 /* draw.c */ |
34 | 118 extern void draw(Bool border, const char *text); |
43 | 119 extern unsigned long initcolor(const char *colstr); |
120 extern void initfont(const char *fontstr); | |
121 extern unsigned int textnw(char *text, unsigned int len); | |
122 extern unsigned int textw(char *text); | |
123 extern unsigned int texth(void); | |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
124 |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
125 /* event.c */ |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
126 extern void discard_events(long even_mask); |
5 | 127 |
42
040a7074d23c
added dev.c instead of kb.c
Anselm R. Garbe <garbeam@wmii.de>
parents:
34
diff
changeset
|
128 /* dev.c */ |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
129 extern void update_keys(void); |
9
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
130 extern void keypress(XEvent *e); |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
131 extern void mresize(Client *c); |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
132 extern void mmove(Client *c); |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
133 |
43 | 134 /* main.c */ |
135 extern int error_handler(Display *dsply, XErrorEvent *e); | |
136 extern void send_message(Window w, Atom a, long value); | |
137 extern int win_proto(Window w); | |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
138 extern void quit(Arg *arg); |
43 | 139 |
32 | 140 /* util.c */ |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
141 extern void error(const char *errstr, ...); |
32 | 142 extern void *emallocz(unsigned int size); |
143 extern void *emalloc(unsigned int size); | |
144 extern void *erealloc(void *ptr, unsigned int size); | |
145 extern char *estrdup(const char *str); | |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
146 extern void spawn(Arg *arg); |
32 | 147 extern void swap(void **p1, void **p2); |