ordered variables in structs and source files alphabetically bf357945
Anselm R. Garbe · 2006-07-17 09:12 7 file(s) · +70 −77
draw.c +2 −2
8 8
#include <string.h>
9 9
#include <X11/Xlocale.h>
10 10
11 -
/* static functions */
11 +
/* static */
12 12
13 13
static void
14 14
drawborder(void)
90 90
	}
91 91
}
92 92
93 -
/* extern functions */
93 +
/* extern */
94 94
95 95
void
96 96
drawall()
dwm.h +18 −20
37 37
};
38 38
39 39
/* atoms */
40 -
enum { WMProtocols, WMDelete, WMLast };
41 40
enum { NetSupported, NetWMName, NetLast };
41 +
enum { WMProtocols, WMDelete, WMLast };
42 42
43 43
/* cursor */
44 -
enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
44 +
enum { CurNormal, CurResize, CurMove, CurLast };
45 45
46 46
struct Fnt {
47 -
	XFontStruct *xfont;
48 -
	XFontSet set;
49 47
	int ascent;
50 48
	int descent;
51 49
	int height;
50 +
	XFontSet set;
51 +
	XFontStruct *xfont;
52 52
};
53 53
54 54
struct DC { /* draw context */
55 -
	GC gc;
56 -
	Drawable drawable;
57 55
	int x, y, w, h;
58 -
	Fnt font;
59 56
	unsigned long bg;
60 57
	unsigned long fg;
61 58
	unsigned long border;
59 +
	Drawable drawable;
60 +
	Fnt font;
61 +
	GC gc;
62 62
};
63 63
64 64
struct Client {
72 72
	unsigned int border;
73 73
	long flags; 
74 74
	Bool isfloat;
75 +
	Client *next;
76 +
	Client *revert;
75 77
	Window win;
76 78
	Window title;
77 -
	Client *next;
78 -
	Client *revert;
79 79
};
80 80
81 81
struct Rule {
92 92
	Arg arg;
93 93
};
94 94
95 -
extern Display *dpy;
96 -
extern Window root, barwin;
95 +
extern char *tags[TLast], stext[1024];
96 +
extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
97 +
extern void (*handler[LASTEvent])(XEvent *);
98 +
extern void (*arrange)(Arg *);
97 99
extern Atom wmatom[WMLast], netatom[NetLast];
100 +
extern Bool running, issel;
101 +
extern Client *clients, *sel;
98 102
extern Cursor cursor[CurLast];
99 -
extern Bool running, issel;
100 -
extern void (*handler[LASTEvent])(XEvent *);
101 -
extern void (*arrange)(Arg *);
103 +
extern DC dc;
104 +
extern Display *dpy;
102 105
extern Key key[];
103 -
104 -
extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
105 -
extern char *tags[TLast], stext[1024];
106 -
107 -
extern DC dc;
108 -
extern Client *clients, *sel;
106 +
extern Window root, barwin;
109 107
110 108
/* client.c */
111 109
extern void ban(Client *c);
dwm.html +3 −4
39 39
		</p>
40 40
		<ul>
41 41
			<li>
42 -
			dwm has no 9P support, no menu, no editable tagbars,
43 -
			no shell-based configuration and remote control and comes without
44 -
			any additional tools like printing the selection or warping the
45 -
			mouse.
42 +
			dwm has no 9P support, no editable tagbars, no shell-based
43 +
			configuration and remote control and comes without any additional
44 +
			tools like printing the selection or warping the mouse.
46 45
			</li>
47 46
			<li>
48 47
			dwm is only a single binary, it's source code is intended to never
event.c +17 −18
11 11
#define ButtonMask      (ButtonPressMask | ButtonReleaseMask)
12 12
#define MouseMask       (ButtonMask | PointerMotionMask)
13 13
14 -
/********** CUSTOMIZE **********/
15 -
14 +
/* CUSTOMIZE */
15 +
const char *browse[] = { "firefox", NULL };
16 +
const char *gimp[] = { "gimp", NULL };
16 17
const char *term[] = { 
17 18
	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
18 19
	"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
19 20
};
20 -
const char *browse[] = { "firefox", NULL };
21 21
const char *xlock[] = { "xlock", NULL };
22 22
23 23
Key key[] = {
24 24
	/* modifier				key			function	arguments */
25 -
	{ Mod1Mask,				XK_Return,	zoom,		{ 0 } },
26 -
	{ Mod1Mask,				XK_k,		focusprev,		{ 0 } },
27 -
	{ Mod1Mask,				XK_j,		focusnext,		{ 0 } }, 
28 -
	{ Mod1Mask,				XK_m,		maximize,		{ 0 } }, 
25 +
	{ ControlMask,			XK_0,		appendtag,	{ .i = Tscratch } }, 
26 +
	{ ControlMask,			XK_1,		appendtag,	{ .i = Tdev } }, 
27 +
	{ ControlMask,			XK_2,		appendtag,	{ .i = Twww } }, 
28 +
	{ ControlMask,			XK_3,		appendtag,	{ .i = Twork } }, 
29 29
	{ Mod1Mask,				XK_0,		view,		{ .i = Tscratch } }, 
30 30
	{ Mod1Mask,				XK_1,		view,		{ .i = Tdev } }, 
31 31
	{ Mod1Mask,				XK_2,		view,		{ .i = Twww } }, 
32 32
	{ Mod1Mask,				XK_3,		view,		{ .i = Twork } }, 
33 +
	{ Mod1Mask,				XK_j,		focusnext,		{ 0 } }, 
34 +
	{ Mod1Mask,				XK_k,		focusprev,		{ 0 } },
35 +
	{ Mod1Mask,				XK_m,		maximize,		{ 0 } }, 
33 36
	{ Mod1Mask,				XK_space,	dotile,		{ 0 } }, 
34 -
	{ Mod1Mask|ShiftMask,	XK_space,	dofloat,	{ 0 } }, 
37 +
	{ Mod1Mask,				XK_Return,	zoom,		{ 0 } },
35 38
	{ Mod1Mask|ShiftMask,	XK_0,		replacetag,		{ .i = Tscratch } }, 
36 39
	{ Mod1Mask|ShiftMask,	XK_1,		replacetag,		{ .i = Tdev } }, 
37 40
	{ Mod1Mask|ShiftMask,	XK_2,		replacetag,		{ .i = Twww } }, 
38 41
	{ Mod1Mask|ShiftMask,	XK_3,		replacetag,		{ .i = Twork } }, 
39 42
	{ Mod1Mask|ShiftMask,	XK_c,		killclient,		{ 0 } }, 
43 +
	{ Mod1Mask|ShiftMask,	XK_g,		spawn,		{ .argv = gimp } },
44 +
	{ Mod1Mask|ShiftMask,	XK_l,		spawn,		{ .argv = xlock } },
40 45
	{ Mod1Mask|ShiftMask,	XK_q,		quit,		{ 0 } },
41 -
	{ Mod1Mask|ShiftMask,	XK_Return,	spawn,		{ .argv = term } },
46 +
	{ Mod1Mask|ShiftMask,	XK_space,	dofloat,	{ 0 } }, 
42 47
	{ Mod1Mask|ShiftMask,	XK_w,		spawn,		{ .argv = browse } },
43 -
	{ Mod1Mask|ShiftMask,	XK_l,		spawn,		{ .argv = xlock } },
44 -
	{ ControlMask,			XK_0,		appendtag,	{ .i = Tscratch } }, 
45 -
	{ ControlMask,			XK_1,		appendtag,	{ .i = Tdev } }, 
46 -
	{ ControlMask,			XK_2,		appendtag,	{ .i = Twww } }, 
47 -
	{ ControlMask,			XK_3,		appendtag,	{ .i = Twork } }, 
48 +
	{ Mod1Mask|ShiftMask,	XK_Return,	spawn,		{ .argv = term } },
48 49
};
49 50
50 -
/********** CUSTOMIZE **********/
51 -
52 -
/* static functions */
51 +
/* static */
53 52
54 53
static void
55 54
movemouse(Client *c)
337 336
		unmanage(c);
338 337
}
339 338
340 -
/* extern functions */
339 +
/* extern */
341 340
342 341
void (*handler[LASTEvent]) (XEvent *) = {
343 342
	[ButtonPress] = buttonpress,
main.c +18 −20
14 14
#include <X11/Xatom.h>
15 15
#include <X11/Xproto.h>
16 16
17 -
Display *dpy;
18 -
Window root, barwin;
19 -
Atom wmatom[WMLast], netatom[NetLast];
20 -
Cursor cursor[CurLast];
21 -
Bool running = True;
22 -
Bool issel = True;
23 17
24 -
int tsel = Tdev; /* default tag */
25 -
int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
26 -
char stext[1024];
27 -
28 -
DC dc = {0};
29 -
Client *clients = NULL;
30 -
Client *sel = NULL;
18 +
/* static */
31 19
32 20
static Bool otherwm;
33 21
static int (*xerrorxlib)(Display *, XErrorEvent *);
34 -
35 -
/* static functions */
36 22
37 23
static void
38 24
cleanup()
97 83
	return -1;
98 84
}
99 85
100 -
/* extern functions */
86 +
/* extern */
87 +
88 +
char stext[1024];
89 +
int tsel = Tdev; /* default tag */
90 +
int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
91 +
Atom wmatom[WMLast], netatom[NetLast];
92 +
Bool running = True;
93 +
Bool issel = True;
94 +
Client *clients = NULL;
95 +
Client *sel = NULL;
96 +
Cursor cursor[CurLast];
97 +
Display *dpy;
98 +
DC dc = {0};
99 +
Window root, barwin;
101 100
102 101
int
103 102
getproto(Window w)
141 140
}
142 141
143 142
/*
144 -
 * There's no way to check accesses to destroyed windows, thus
145 -
 * those cases are ignored (especially on UnmapNotify's).
146 -
 * Other types of errors call Xlib's default error handler, which
147 -
 * calls exit().
143 +
 * There's no way to check accesses to destroyed windows, thus those cases are
144 +
 * ignored (especially on UnmapNotify's).  Other types of errors call Xlibs
145 +
 * default error handler, which calls exit().
148 146
 */
149 147
int
150 148
xerror(Display *dpy, XErrorEvent *ee)
tag.c +10 −11
7 7
#include <string.h>
8 8
#include <X11/Xutil.h>
9 9
10 -
/********** CUSTOMIZE **********/
10 +
/* static */
11 +
12 +
/* CUSTOMIZE */ 
13 +
static Rule rule[] = {
14 +
	/* class			instance	tags						isfloat */
15 +
	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
16 +
};
17 +
18 +
/* extern */
11 19
20 +
/* CUSTOMIZE */
12 21
char *tags[TLast] = {
13 22
	[Tscratch] = "scratch",
14 23
	[Tdev] = "dev",
15 24
	[Twww] = "www",
16 25
	[Twork] = "work",
17 26
};
18 -
19 -
static Rule rule[] = {
20 -
	/* class			instance	tags						isfloat */
21 -
	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
22 -
};
23 -
24 -
/********** CUSTOMIZE **********/
25 -
26 -
/* extern functions */
27 -
28 27
void (*arrange)(Arg *) = dotile;
29 28
30 29
void
util.c +2 −2
10 10
#include <sys/wait.h>
11 11
#include <unistd.h>
12 12
13 -
/* static functions */
13 +
/* static */
14 14
15 15
static void
16 16
bad_malloc(unsigned int size)
20 20
	exit(1);
21 21
}
22 22
23 -
/* extern functions */
23 +
/* extern */
24 24
25 25
void *
26 26
emallocz(unsigned int size)