macros which have been defined in config.h can only be used at function level, however you can nest code into config.h now for implementing a different layout (just for example), eg. #include "supertile.c" a026617c
Anselm R. Garbe · 2007-09-16 10:23 1 file(s) · +10 −6
dwm.c +10 −6
194 194
static int xerrorstart(Display *dsply, XErrorEvent *ee);
195 195
static void zoom(const char *arg);
196 196
197 -
#include "config.h"
198 -
199 197
/* variables */
200 198
static char stext[256];
201 -
static double mwfact = MWFACT;
199 +
static double mwfact;
202 200
static int screen, sx, sy, sw, sh, wax, way, waw, wah;
203 201
static int (*xerrorxlib)(Display *, XErrorEvent *);
204 -
static unsigned int bh;
202 +
static unsigned int bh, bpos, ntags;
205 203
static unsigned int blw = 0;
206 -
static unsigned int bpos = BARPOS;
207 204
static unsigned int ltidx = 0; /* default */
208 205
static unsigned int nlayouts = 0;
209 206
static unsigned int nrules = 0;
210 -
static unsigned int ntags;
211 207
static unsigned int numlockmask = 0;
212 208
static void (*handler[LASTEvent]) (XEvent *) = {
213 209
	[ButtonPress] = buttonpress,
236 232
static DC dc = {0};
237 233
static Window barwin, root;
238 234
static Regs *regs = NULL;
235 +
236 +
/* configuration, allows nested code to work on above variables */
237 +
#include "config.h"
239 238
240 239
static void
241 240
eprint(const char *errstr, ...) {
1806 1805
		eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n");
1807 1806
	else if(argc != 1)
1808 1807
		eprint("usage: dwm [-v]\n");
1808 +
1809 +
	/* macros from config.h can be used beginning within main() */
1810 +
	mwfact = MWFACT;
1811 +
	bpos = BARPOS;
1812 +
1809 1813
	setlocale(LC_CTYPE, "");
1810 1814
	if(!(dpy = XOpenDisplay(0)))
1811 1815
		eprint("dwm: cannot open display\n");