just making dwm.h saner 206eb344
arg@suckless.org · 2007-10-17 11:19 3 file(s) · +63 −65
config.mk +2 −2
17 17
# flags
18 18
CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
19 19
LDFLAGS = -s ${LIBS}
20 -
#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
21 -
#LDFLAGS = -g ${LIBS}
20 +
CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
21 +
LDFLAGS = -g ${LIBS}
22 22
23 23
# Solaris
24 24
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
dwm.c +3 −62
25 25
 *
26 26
 * To understand everything else, start reading main().
27 27
 */
28 -
#include "dwm.h"
29 -
30 28
#include <errno.h>
31 29
#include <locale.h>
32 30
#include <stdarg.h>
41 39
#include <X11/cursorfont.h>
42 40
#include <X11/keysym.h>
43 41
#include <X11/Xatom.h>
42 +
#include <X11/Xlib.h>
44 43
#include <X11/Xproto.h>
45 44
#include <X11/Xutil.h>
45 +
46 +
#include "dwm.h"
46 47
47 48
/* macros */
48 49
#define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
49 50
#define CLEANMASK(mask)		(mask & ~(numlockmask | LockMask))
50 51
#define MOUSEMASK		(BUTTONMASK | PointerMotionMask)
51 52
52 -
/* local typedefs */
53 -
typedef struct {
54 -
	const char *prop;
55 -
	const char *tags;
56 -
	Bool isfloating;
57 -
} Rule;
58 -
59 -
typedef struct {
60 -
	regex_t *propregex;
61 -
	regex_t *tagregex;
62 -
} Regs;
63 -
64 -
/* variables */
65 -
char stext[256];
66 -
double mwfact;
67 -
int screen, sx, sy, sw, sh, wax, way, waw, wah;
68 -
int (*xerrorxlib)(Display *, XErrorEvent *);
69 -
unsigned int bh, bpos;
70 -
unsigned int blw = 0;
71 -
unsigned int ltidx = 0; /* default */
72 -
unsigned int nlayouts = 0;
73 -
unsigned int nrules = 0;
74 -
unsigned int numlockmask = 0;
75 -
void (*handler[LASTEvent]) (XEvent *) = {
76 -
	[ButtonPress] = buttonpress,
77 -
	[ConfigureRequest] = configurerequest,
78 -
	[ConfigureNotify] = configurenotify,
79 -
	[DestroyNotify] = destroynotify,
80 -
	[EnterNotify] = enternotify,
81 -
	[LeaveNotify] = leavenotify,
82 -
	[Expose] = expose,
83 -
	[KeyPress] = keypress,
84 -
	[MappingNotify] = mappingnotify,
85 -
	[MapRequest] = maprequest,
86 -
	[PropertyNotify] = propertynotify,
87 -
	[UnmapNotify] = unmapnotify
88 -
};
89 -
Atom wmatom[WMLast], netatom[NetLast];
90 -
Bool otherwm, readin;
91 -
Bool running = True;
92 -
Bool selscreen = True;
93 -
Client *clients = NULL;
94 -
Client *sel = NULL;
95 -
Client *stack = NULL;
96 -
Cursor cursor[CurLast];
97 -
Display *dpy;
98 -
DC dc = {0};
99 -
Window barwin, root;
100 -
Regs *regs = NULL;
101 -
102 -
/* configuration, allows nested code to access above variables */
103 -
#include "config.h"
104 -
105 -
/* Statically define the number of tags. */
106 -
unsigned int ntags = sizeof tags / sizeof tags[0];
107 -
Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True};
108 -
Bool prevtags[sizeof tags / sizeof tags[0]] = {[0] = True};
109 -
110 -
/* functions*/
111 53
void
112 54
applyrules(Client *c) {
113 55
	static char buf[512];
1032 974
1033 975
void
1034 976
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
1035 -
	double dx, dy, max, min, ratio;
1036 977
	XWindowChanges wc;
1037 978
1038 979
	if(sizehints) {
dwm.h +58 −1
1 1
/* See LICENSE file for copyright and license details. */
2 -
#include <X11/Xlib.h>
3 2
4 3
/* enums */
5 4
enum { BarTop, BarBot, BarOff };			/* bar position */
52 51
	const char *symbol;
53 52
	void (*arrange)(void);
54 53
} Layout;
54 +
55 +
typedef struct {
56 +
	const char *prop;
57 +
	const char *tags;
58 +
	Bool isfloating;
59 +
} Rule;
60 +
61 +
typedef struct {
62 +
	regex_t *propregex;
63 +
	regex_t *tagregex;
64 +
} Regs;
55 65
56 66
/* functions */
57 67
void applyrules(Client *c);
132 142
int xerrordummy(Display *dsply, XErrorEvent *ee);
133 143
int xerrorstart(Display *dsply, XErrorEvent *ee);
134 144
void zoom(const char *arg);
145 +
146 +
/* variables */
147 +
char stext[256];
148 +
double mwfact;
149 +
int screen, sx, sy, sw, sh, wax, way, waw, wah;
150 +
int (*xerrorxlib)(Display *, XErrorEvent *);
151 +
unsigned int bh, bpos;
152 +
unsigned int blw = 0;
153 +
unsigned int ltidx = 0; /* default */
154 +
unsigned int nlayouts = 0;
155 +
unsigned int nrules = 0;
156 +
unsigned int numlockmask = 0;
157 +
void (*handler[LASTEvent]) (XEvent *) = {
158 +
	[ButtonPress] = buttonpress,
159 +
	[ConfigureRequest] = configurerequest,
160 +
	[ConfigureNotify] = configurenotify,
161 +
	[DestroyNotify] = destroynotify,
162 +
	[EnterNotify] = enternotify,
163 +
	[LeaveNotify] = leavenotify,
164 +
	[Expose] = expose,
165 +
	[KeyPress] = keypress,
166 +
	[MappingNotify] = mappingnotify,
167 +
	[MapRequest] = maprequest,
168 +
	[PropertyNotify] = propertynotify,
169 +
	[UnmapNotify] = unmapnotify
170 +
};
171 +
Atom wmatom[WMLast], netatom[NetLast];
172 +
Bool otherwm, readin;
173 +
Bool running = True;
174 +
Bool selscreen = True;
175 +
Client *clients = NULL;
176 +
Client *sel = NULL;
177 +
Client *stack = NULL;
178 +
Cursor cursor[CurLast];
179 +
Display *dpy;
180 +
DC dc = {0};
181 +
Window barwin, root;
182 +
Regs *regs = NULL;
183 +
184 +
/* configuration, allows nested code to access above variables */
185 +
#include "config.h"
186 +
187 +
/* Statically define the number of tags. */
188 +
unsigned int ntags = sizeof tags / sizeof tags[0];
189 +
Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True};
190 +
Bool prevtags[sizeof tags / sizeof tags[0]] = {[0] = True};
191 +