Mercurial > dwm-meillo
annotate dwm.h @ 65:4f7b232bd72d
if stdin writer stops working, dwm consumed much IO load because it still tried to select on this fd, fixed
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 17:30:37 +0200 |
parents | f14858218641 |
children | 50450aa24a46 |
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 |
51 | 10 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" |
11 #define BGCOLOR "#666699" | |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
12 #define FGCOLOR "#eeeeee" |
51 | 13 #define BORDERCOLOR "#9999CC" |
14 #define MASTERW 52 /* percent */ | |
15 #define WM_PROTOCOL_DELWIN 1 | |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
16 |
32 | 17 /* tags */ |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
18 enum { Tscratch, Tdev, Twww, Twork, TLast }; |
32 | 19 |
20 /********** CUSTOMIZE **********/ | |
21 | |
51 | 22 typedef union Arg Arg; |
34 | 23 typedef struct DC DC; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
24 typedef struct Client Client; |
32 | 25 typedef struct Fnt Fnt; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
26 typedef struct Key Key; |
51 | 27 typedef struct Rule Rule; |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
28 |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
29 union Arg { |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
30 const char **argv; |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
31 int i; |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
32 }; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
33 |
5 | 34 /* atoms */ |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
35 enum { WMProtocols, WMDelete, WMLast }; |
0 | 36 enum { NetSupported, NetWMName, NetLast }; |
37 | |
5 | 38 /* cursor */ |
0 | 39 enum { CurNormal, CurResize, CurMove, CurInput, CurLast }; |
40 | |
32 | 41 struct Fnt { |
42 XFontStruct *xfont; | |
43 XFontSet set; | |
44 int ascent; | |
45 int descent; | |
46 int height; | |
47 }; | |
48 | |
34 | 49 struct DC { /* draw context */ |
32 | 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 | |
0 | 59 struct Client { |
31 | 60 char name[256]; |
61 char *tags[TLast]; | |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
62 int proto; |
20 | 63 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
|
64 int tx, ty, tw, th; |
20 | 65 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
29 | 66 int grav; |
67 unsigned int border; | |
20 | 68 long flags; |
53 | 69 Bool floating; |
0 | 70 Window win; |
71 Window title; | |
72 Client *next; | |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
73 Client *revert; |
0 | 74 }; |
75 | |
51 | 76 struct Rule { |
77 const char *class; | |
78 const char *instance; | |
79 char *tags[TLast]; | |
53 | 80 Bool floating; |
51 | 81 }; |
82 | |
8 | 83 struct Key { |
84 unsigned long mod; | |
85 KeySym keysym; | |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
86 void (*func)(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
87 Arg arg; |
8 | 88 }; |
89 | |
0 | 90 extern Display *dpy; |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
91 extern Window root, barwin; |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
92 extern Atom wm_atom[WMLast], net_atom[NetLast]; |
0 | 93 extern Cursor cursor[CurLast]; |
31 | 94 extern Bool running, issel; |
53 | 95 extern void (*handler[LASTEvent])(XEvent *); |
96 extern void (*arrange)(Arg *); | |
0 | 97 |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
98 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
99 extern char *tags[TLast], stext[1024]; |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
100 |
34 | 101 extern DC dc; |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
102 extern Client *clients, *sel; |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
103 |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
104 /* bar.c */ |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
105 extern void draw_bar(); |
58
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
106 extern void barclick(XButtonPressedEvent *e); |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
107 |
5 | 108 /* client.c */ |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
109 extern void manage(Window w, XWindowAttributes *wa); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
110 extern void unmanage(Client *c); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
111 extern Client *getclient(Window w); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
112 extern void focus(Client *c); |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
113 extern void update_name(Client *c); |
16
359b6e563b95
several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
14
diff
changeset
|
114 extern void draw_client(Client *c); |
52
d18f6dd0cf23
fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents:
51
diff
changeset
|
115 extern void resize(Client *c, Bool inc); |
20 | 116 extern void update_size(Client *c); |
23 | 117 extern Client *gettitle(Window w); |
32 | 118 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
|
119 extern void lower(Client *c); |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
120 extern void ckill(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
121 extern void nextc(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
122 extern void prevc(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
123 extern void max(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
124 extern void floating(Arg *arg); |
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
125 extern void tiling(Arg *arg); |
53 | 126 extern void ttrunc(Arg *arg); |
127 extern void tappend(Arg *arg); | |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
128 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
|
129 extern void zoom(Arg *arg); |
29 | 130 extern void gravitate(Client *c, Bool invert); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
131 |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
132 /* draw.c */ |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
53
diff
changeset
|
133 extern void drawtext(const char *text, Bool border); |
43 | 134 extern unsigned long initcolor(const char *colstr); |
135 extern void initfont(const char *fontstr); | |
136 extern unsigned int textnw(char *text, unsigned int len); | |
137 extern unsigned int textw(char *text); | |
138 extern unsigned int texth(void); | |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
139 |
42
040a7074d23c
added dev.c instead of kb.c
Anselm R. Garbe <garbeam@wmii.de>
parents:
34
diff
changeset
|
140 /* dev.c */ |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
141 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
|
142 extern void keypress(XEvent *e); |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
143 extern void mresize(Client *c); |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
144 extern void mmove(Client *c); |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
145 |
43 | 146 /* main.c */ |
147 extern int error_handler(Display *dsply, XErrorEvent *e); | |
148 extern void send_message(Window w, Atom a, long value); | |
149 extern int win_proto(Window w); | |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
150 extern void quit(Arg *arg); |
43 | 151 |
32 | 152 /* util.c */ |
33
e90449e03167
new stuff (some warning elimination)
Anselm R. Garbe <garbeam@wmii.de>
parents:
32
diff
changeset
|
153 extern void error(const char *errstr, ...); |
32 | 154 extern void *emallocz(unsigned int size); |
49
466591c2f967
implemented tagging a client
Anselm R. Garbe <garbeam@wmii.de>
parents:
46
diff
changeset
|
155 extern void spawn(Arg *arg); |
32 | 156 extern void swap(void **p1, void **p2); |