diff -urN evilwm-cvs-20050113/Makefile evilwm-lrd-20050422/Makefile
--- evilwm-cvs-20050113/Makefile	2004-07-10 07:36:13.000000000 -0700
+++ evilwm-lrd-20050422/Makefile	2005-04-18 19:12:05.000000000 -0700
@@ -10,7 +10,10 @@
 LDPATH   = -L$(XROOT)/lib
 LIBS     = -lX11
 
-# Configure evilwm by editing the following DEFINES lines.
+DEFINES  = $(EXTRA_DEFINES)
+# Configure evilwm by editing the following DEFINES lines.  You can also
+# add options by setting EXTRA_DEFINES on the make(1) command line,
+# e.g., make EXTRA_DEFINES="-DDEBUG".
 
 # Uncomment to enable solid window drags.  This can be slow on old systems.
 DEFINES += -DSOLIDDRAG
@@ -45,10 +48,11 @@
 
 # Uncomment to compile in certain text messages like help.  You want this too
 # unless you *really* want to trim the bytes.
+# Note that snprintf(3) is always part of the build.
 DEFINES += -DSTDIO
 
 # You can save a few bytes if you know you won't need colour map support
-# (eg for 16 or more bit displays)
+# (e.g., for 16 or more bit displays)
 DEFINES += -DCOLOURMAP
 
 # Uncomment the following line if you want to use Ctrl+Alt+q to kill windows
@@ -63,7 +67,7 @@
 
 version = 0
 revision = 99
-subrev = 17
+subrev = pre18-lrd
 
 distdir = evilwm-$(version).$(revision).$(subrev).orig
 disttar = evilwm_$(version).$(revision).$(subrev).orig.tar.gz
@@ -71,9 +75,9 @@
 #DEFINES += -DXDEBUG	# show some X calls
 
 DEFINES += -DVERSION=\"$(version).$(revision).$(subrev)\" $(DEBIAN)
-CFLAGS  += $(INCLUDES) $(DEFINES) -Os -Wall
+CFLAGS  += $(INCLUDES) $(DEFINES) -Os -Wall -std=c99 -D_XOPEN_SOURCE
 #CFLAGS  += $(INCLUDES) $(DEFINES) -g -Wall
-CFLAGS  += -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Waggregate-return -Wnested-externs -Winline -Wwrite-strings -Wundef
+CFLAGS  += -W -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Waggregate-return -Wnested-externs -Winline -Wwrite-strings -Wundef -Wsign-compare -Wmissing-prototypes -Wredundant-decls
 LDFLAGS += $(LDPATH) $(LIBS)
 
 HEADERS  = evilwm.h
diff -urN evilwm-cvs-20050113/client.c evilwm-lrd-20050422/client.c
--- evilwm-cvs-20050113/client.c	2005-03-01 13:50:47.000000000 -0800
+++ evilwm-lrd-20050422/client.c	2005-04-16 11:13:15.000000000 -0700
@@ -4,10 +4,6 @@
 
 #include "evilwm.h"
 #include <stdlib.h>
-#include <stdio.h>
-#ifdef SHAPE
-#include <X11/extensions/shape.h>
-#endif
 #include "log.h"
 
 static int send_xmessage(Window w, Atom a, long x);
@@ -24,8 +20,11 @@
 }
 
 void set_wm_state(Client *c, int state) {
-	CARD32 data[2];
-	data[0] = (CARD32)state;
+	/* Using "long" for the type of "data" is possibly broken on 64-bit
+	 * machines, but this conforms to the XChangeProperty(3) man page.
+	 * After all, "all the world's a VAX". */
+	long data[2];
+	data[0] = state;
 	data[1] = None;
 	XChangeProperty(dpy, c->window, xa_wm_state, xa_wm_state, 32,
 			PropModeReplace, (unsigned char *)data, 2);
@@ -35,14 +34,14 @@
 	Atom actual_type;
 	int actual_format, state = WithdrawnState;
 	unsigned long nitems, bytes_after;
-	CARD32 *data;
+	union { unsigned char *cp; int *ip;} data;
 	if ((XGetWindowProperty(dpy, c->window, xa_wm_state, 0L, 1L, False,
 			AnyPropertyType, &actual_type, &actual_format, &nitems,
-			&bytes_after, (unsigned char **)&data) == Success)
+			&bytes_after, &(data.cp)) == Success)
 			&& nitems) {
-		if (data) {
-			state = (int)*data;
-			XFree(data);
+		if (data.ip) {
+			state = *(data.ip);
+			XFree(data.cp);
 		}
 	}
 	return state;
@@ -101,9 +100,9 @@
 	free(c);
 #ifdef DEBUG
 	{
-		Client *p;
+		Client *pp;
 		int i = 0;
-		for (p = head_client; p; p = p->next)
+		for (pp = head_client; pp; pp = pp->next)
 			i++;
 		LOG_DEBUG("\tremove_client() : free(), window count now %d\n", i);
 	}
@@ -163,27 +162,32 @@
 
 #ifdef SHAPE
 void set_shape(Client *c) {
-	int n, order;
-	XRectangle *rect;
+	Bool boundingShaped;
+	int i;  unsigned int u;  Bool b;  /* dummies */
 
 	if (!have_shape) return;
-	rect = XShapeGetRectangles(dpy, c->window, ShapeBounding, &n, &order);
-	if (n > 1) {
+	/* Logic to decide if we have a shaped window cribbed from fvwm-2.5.10.
+	 * Previous method (more than one rectangle returned from
+	 * XShapeGetRectangles) worked _most_ of the time. */
+	XShapeSelectInput(dpy, c->window, ShapeNotifyMask);
+	if (XShapeQueryExtents(dpy, c->window, &boundingShaped,
+			&i, &i, &u, &u, &b, &i, &i, &u, &u) && boundingShaped) {
 		XShapeCombineShape(dpy, c->parent, ShapeBounding, c->border,
 				c->border, c->window, ShapeBounding, ShapeSet);
 	}
-	XFree((void *)rect);
 }
 #endif
 
 void client_update_current(Client *c, Client *newcurrent) {
 	if (c) {
+		unsigned long bpixel;
 #ifdef VWM
 		if (c->vdesk == STICKY)
-			XSetWindowBackground(dpy, c->parent, c == newcurrent ? c->screen->fc.pixel : c->screen->bg.pixel);
+			bpixel = c == newcurrent ? c->screen->fc.pixel : c->screen->bg.pixel;
 		else
 #endif
-			XSetWindowBackground(dpy, c->parent, c == newcurrent ? c->screen->fg.pixel : c->screen->bg.pixel);
+			bpixel = c == newcurrent ? c->screen->fg.pixel : c->screen->bg.pixel;
+		XSetWindowBackground(dpy, c->parent, bpixel);
 		XClearWindow(dpy, c->parent);
 	}
 	current = newcurrent;
diff -urN evilwm-cvs-20050113/events.c evilwm-lrd-20050422/events.c
--- evilwm-cvs-20050113/events.c	2005-03-01 13:50:47.000000000 -0800
+++ evilwm-lrd-20050422/events.c	2005-04-16 22:15:56.000000000 -0700
@@ -5,10 +5,6 @@
 #include "evilwm.h"
 #include <stdlib.h>
 #include <X11/Xatom.h>
-#include <stdio.h>
-#ifdef SHAPE
-#include <X11/extensions/shape.h>
-#endif
 #include "log.h"
 
 void handle_key_event(XKeyEvent *e) {
@@ -209,7 +205,11 @@
 		/* If client vdesk doesn't match where we think we are, it's
 		 * probably moved somehow, so update our records.  */
 		if (c->vdesk != vdesk && c->vdesk != STICKY)
-			c->vdesk = vdesk;
+			/* CVS changed the action for this condition to
+			 * c->vdesk = vdesk;  That left me with very
+			 * mysterious disappearing windows.  2005-04-16 LRD
+			 */
+			return;
 #endif
 		select_client(c);
 #ifdef MOUSE
@@ -219,6 +219,7 @@
 }
 
 void handle_leave_event(XCrossingEvent *e) {
+	(void) e;  /* unused */
 }
 
 #ifdef SHAPE
diff -urN evilwm-cvs-20050113/evilwm.1 evilwm-lrd-20050422/evilwm.1
--- evilwm-cvs-20050113/evilwm.1	2005-01-13 04:40:15.000000000 -0800
+++ evilwm-lrd-20050422/evilwm.1	2005-04-18 19:21:16.000000000 -0700
@@ -100,7 +100,7 @@
 .IP "-altmod modifier[+modifier...]"
 override the alternate modifier combination (mod1) usually used for mouse
 actions and switching windows.  Valid modifiers are as above.
-.IP "-app name:class[:vdesk[:x[:y[:w[:h]]]]]"
+.IP "-app name:class[:vdesk[:X[xY[+w[+h]]]]]"
 set default virtual desktop, position and dimensions.  Use -1 for any argument
 to use window's default values.  Use 0 for vdesk to set window as sticky.
 Names and classes can be found using the
diff -urN evilwm-cvs-20050113/evilwm.h evilwm-lrd-20050422/evilwm.h
--- evilwm-cvs-20050113/evilwm.h	2005-03-01 13:50:47.000000000 -0800
+++ evilwm-lrd-20050422/evilwm.h	2005-04-19 17:11:21.000000000 -0700
@@ -16,6 +16,11 @@
 #endif
 #endif
 
+/* sanity on options */
+#if defined(INFOBANNER_MOVERESIZE) && !defined(INFOBANNER)
+#define INFOBANNER
+#endif
+
 /* default settings */
 
 #define DEF_FONT	"variable"
@@ -24,7 +29,7 @@
 #define DEF_BW		1
 #define DEF_FC		"blue"
 #define SPACE		3
-#define MINSIZE		15
+#define MINSIZE		14
 #ifdef DEBIAN
 #define DEF_TERM	"x-terminal-emulator"
 #else
@@ -32,9 +37,6 @@
 #endif
 
 /* readability stuff */
-#ifdef SHAPE
-#include <X11/extensions/shape.h>
-#endif
 
 #define STICKY 0	/* Desktop number for sticky clients */
 #define KEY_TO_VDESK( key ) ( ( key ) - XK_1 + 1 )
@@ -169,7 +171,7 @@
 extern const char	*opt_font;
 extern const char	*opt_fg;
 extern const char	*opt_bg;
-extern const char	**opt_term;
+extern const char	*opt_term[3];
 extern int		opt_bw;
 #ifdef VWM
 extern const char	*opt_fc;
@@ -230,6 +232,7 @@
 int ignore_xerror(Display *dsply, XErrorEvent *e);
 void spawn(const char *const cmd[]);
 void handle_signal(int signo);
+void handle_sigusr1(int signo);
 #ifdef DEBUG
 void show_event(XEvent e);
 #endif
diff -urN evilwm-cvs-20050113/log.h evilwm-lrd-20050422/log.h
--- evilwm-cvs-20050113/log.h	2004-07-10 06:26:02.000000000 -0700
+++ evilwm-lrd-20050422/log.h	2005-03-25 20:49:51.000000000 -0800
@@ -5,7 +5,9 @@
 #ifndef __LOG_H__
 #define __LOG_H__
 
-#include <stdio.h>
+#if defined(STDIO) || defined(DEBUG) || defined(XDEBUG)
+# include <stdio.h>
+#endif
 
 #ifdef STDIO
 # define LOG_INFO(...) fprintf(stderr, __VA_ARGS__);
diff -urN evilwm-cvs-20050113/main.c evilwm-lrd-20050422/main.c
--- evilwm-cvs-20050113/main.c	2005-01-13 04:34:45.000000000 -0800
+++ evilwm-lrd-20050422/main.c	2005-04-18 19:20:27.000000000 -0700
@@ -4,14 +4,11 @@
 
 #include "evilwm.h"
 #include <stdlib.h>
+#include <stdio.h>   /* snprintf, maybe printf */
 #include <string.h>
 #include <strings.h>
 #include <signal.h>
 #include <X11/cursorfont.h>
-#include <stdio.h>
-#ifdef SHAPE
-#include <X11/extensions/shape.h>
-#endif
 #include "log.h"
 
 Display		*dpy;
@@ -34,7 +31,7 @@
 const char	*opt_font = DEF_FONT;
 const char	*opt_fg = DEF_FG;
 const char	*opt_bg = DEF_BG;
-const char	**opt_term = NULL;
+const char	*opt_term[3] = { DEF_TERM, DEF_TERM, NULL};
 int		opt_bw = DEF_BW;
 #ifdef VWM
 const char	*opt_fc = DEF_FC;
@@ -68,6 +65,8 @@
 };
 
 static void setup_display(void);
+static unsigned int parse_grabmask(char *s);
+static void add_application(char *desc);
 static void *xmalloc(size_t size);
 
 int main(int argc, char *argv[]) {
@@ -92,70 +91,18 @@
 		else if (!strcmp(argv[i], "-bw") && i+1<argc)
 			opt_bw = atoi(argv[++i]);
 		else if (!strcmp(argv[i], "-term") && i+1<argc) {
-			opt_term = (const char **)xmalloc(3 * sizeof(const char *));
 			opt_term[0] = argv[++i];
 			opt_term[1] = opt_term[0];
-			opt_term[2] = NULL;
+#ifdef SNAP
 		} else if (!strcmp(argv[i], "-snap") && i+1<argc) {
 			opt_snap = atoi(argv[++i]);
+#endif
 		} else if (!strcmp(argv[i], "-mod") && i+1<argc) {
-			char *tmp = strtok(argv[++i], ",+");
-			int modi;
-			main_grabmask = 0;
-			do {
-				for (modi = 0; modi < 8; modi++) {
-					if (!strcmp(modifiers[modi].name, tmp))
-						main_grabmask |= modifiers[modi].mask;
-				}
-				tmp = strtok(NULL, ",+");
-			} while (tmp);
+			main_grabmask = parse_grabmask(argv[++i]);
 		} else if (!strcmp(argv[i], "-altmod") && i+1<argc) {
-			char *tmp = strtok(argv[++i], ",+");
-			int modi;
-			alt_grabmask = 0;
-			do {
-				for (modi = 0; modi < 8; modi++) {
-					if (!strcmp(modifiers[modi].name, tmp))
-						alt_grabmask |= modifiers[modi].mask;
-				}
-				tmp = strtok(NULL, ",+");
-			} while (tmp);
+			alt_grabmask = parse_grabmask(argv[++i]);
 		} else if (!strcmp(argv[i], "-app") && i+1<argc) {
-			Application *cur = (Application *)xmalloc(sizeof(Application));
-			char *tmp;
-			cur->vdesk = cur->x = cur->y = cur->w = cur->h = -1;
-			if ((tmp = strtok(argv[++i], ":"))) {
-				cur->res_name = (char *)xmalloc(strlen(tmp)+1);
-				strcpy(cur->res_name, tmp);
-				if ((tmp = strtok(NULL, ":"))) {
-					cur->res_class = (char *)xmalloc(strlen(tmp)+1);
-					strcpy(cur->res_class, tmp);
-					if ((tmp = strtok(NULL, ":"))) {
-						cur->vdesk = atoi(tmp);
-						if ((tmp = strtok(NULL, ":"))) {
-							cur->x = atoi(tmp);
-							if ((tmp = strtok(NULL, ":"))) {
-								cur->y = atoi(tmp);
-								if ((tmp = strtok(NULL, ":"))) {
-									cur->w = atoi(tmp);
-									if ((tmp = strtok(NULL, ":"))) {
-										cur->h = atoi(tmp);
-									}
-								}
-							}
-						}
-					}
-				}
-				if (!head_app) {
-					head_app = cur;
-				} else {
-					Application *a = head_app;
-					while (a->next) a = a->next;
-					a->next = cur;
-				}
-			} else {
-				free(cur);
-			}
+			add_application(argv[++i]);
 #ifdef STDIO
 		} else if (!strcmp(argv[i], "-V")) {
 			printf("evilwm version " VERSION "\n");
@@ -169,17 +116,11 @@
 			printf("[-fc fixedcolour] ");
 #endif
 			printf("[-bw borderwidth] [-snap num]\n");
-#endif
 			printf("\t[-app name:class[:vdesk[:x[:y[:w[:h]]]]] [-V]\n");
+#endif
 			exit(2);
 		}
 	}
-	if (!opt_term) {
-		opt_term = (const char **)xmalloc(3 * sizeof(const char *));
-		opt_term[0] = DEF_TERM;
-		opt_term[1] = opt_term[0];
-		opt_term[2] = NULL;
-	}
 
 	act.sa_handler = handle_signal;
 	sigemptyset(&act.sa_mask);
@@ -187,6 +128,8 @@
 	sigaction(SIGTERM, &act, NULL);
 	sigaction(SIGINT, &act, NULL);
 	sigaction(SIGHUP, &act, NULL);
+	act.sa_handler = handle_sigusr1;
+	sigaction(SIGUSR1, &act, NULL);
 
 	setup_display();
 
@@ -220,8 +163,8 @@
 				handle_property_change(&ev.xproperty); break;
 			case UnmapNotify:
 				handle_unmap_event(&ev.xunmap); break;
-			default:
 #ifdef SHAPE
+			default:
 				if (have_shape && ev.type == shape_event) {
 					handle_shape_event((XShapeEvent *)&ev);
 				}
@@ -234,12 +177,75 @@
 static void *xmalloc(size_t size) {
 	void *ptr = malloc(size);
 	if (!ptr) {
-		LOG_ERROR("out of memory, looking for %d bytes\n", (int)size);
+		/* C99 specific; see "portable printf format for size_t"
+		 * Jun 8 2002 thread in comp.lang.c.
+		 * One could also try the workarounds for pre-C99 suggested
+		 * in the "How to printf 1.000.000,-- $" Sep 1998 thread
+		 * in c.l.c */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+		LOG_ERROR("out of memory, looking for %zu bytes\n", size);
+#else
+		LOG_ERROR("out of memory, looking for %lu bytes\n", (unsigned long) size);
+#endif
 		exit(1);
 	}
 	return ptr;
 }
 
+static unsigned int parse_grabmask(char *s)
+{
+	char *tmp = strtok(s, ",+");
+	unsigned int mask=0;
+	int modi;
+	do {
+		for (modi = 0; modi < 8; modi++) {
+			if (!strcmp(modifiers[modi].name, tmp))
+				mask |= modifiers[modi].mask;
+		}
+		tmp = strtok(NULL, ",+");
+	} while (tmp);
+	return mask;
+}
+
+static void add_application(char *desc)
+{
+	Application *cur = xmalloc(sizeof(Application));
+	char *tmp;
+	cur->vdesk = cur->x = cur->y = cur->w = cur->h = -1;
+	if ((tmp = strtok(desc, ":"))) {
+		cur->res_name = xmalloc(strlen(tmp)+1);
+		strcpy(cur->res_name, tmp);
+		if ((tmp = strtok(NULL, ":"))) {
+			cur->res_class = xmalloc(strlen(tmp)+1);
+			strcpy(cur->res_class, tmp);
+			if ((tmp = strtok(NULL, ":"))) {
+				cur->vdesk = atoi(tmp);
+				if ((tmp = strtok(NULL, ":"))) {
+					cur->x = atoi(tmp);
+					if ((tmp = strtok(NULL, "x"))) {
+						cur->y = atoi(tmp);
+						if ((tmp = strtok(NULL, "+"))) {
+							cur->w = atoi(tmp);
+							if ((tmp = strtok(NULL, "+"))) {
+								cur->h = atoi(tmp);
+							}
+						}
+					}
+				}
+			}
+		}
+		if (!head_app) {
+			head_app = cur;
+		} else {
+			Application *a = head_app;
+			while (a->next) a = a->next;
+			a->next = cur;
+		}
+	} else {
+		free(cur);
+	}
+}
+
 static void setup_display(void) {
 	XGCValues gv;
 	XSetWindowAttributes attr;
@@ -290,7 +296,7 @@
 	 * every combination of modifiers we can think of */
 	modmap = XGetModifierMapping(dpy);
 	for (i = 0; i < 8; i++) {
-		for (j = 0; j < modmap->max_keypermod; j++) {
+		for (j = 0; j < (unsigned int) modmap->max_keypermod; j++) {
 			if (modmap->modifiermap[i*modmap->max_keypermod+j] == XKeysymToKeycode(dpy, XK_Num_Lock)) {
 				numlockmask = (1<<i);
 				LOG_DEBUG("setup_display() : XK_Num_Lock is (1<<0x%02x)\n", i);
@@ -322,8 +328,12 @@
 
 	/* now set up each screen in turn */
 	num_screens = ScreenCount(dpy);
+	if (num_screens < 0) {
+		LOG_ERROR("Can't count screens\n");
+		exit(1);
+	}
 	screens = (ScreenInfo *)xmalloc(num_screens * sizeof(ScreenInfo));
-	for (i = 0; i < num_screens; i++) {
+	for (i = 0; i < (unsigned) num_screens; i++) {
 		char *ds, *colon, *dot;
 		ds = DisplayString(dpy);
 		/* set up DISPLAY environment variable to use */
diff -urN evilwm-cvs-20050113/misc.c evilwm-lrd-20050422/misc.c
--- evilwm-cvs-20050113/misc.c	2004-07-10 06:26:02.000000000 -0700
+++ evilwm-lrd-20050422/misc.c	2005-04-18 19:46:14.000000000 -0700
@@ -9,7 +9,6 @@
 #include <signal.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <stdio.h>
 #include "log.h"
 
 /* Now do this by fork()ing twice so we don't have to worry about SIGCHLDs */
@@ -21,8 +20,15 @@
 	if (!(pid = fork())) {
 		setsid();
 		switch (fork()) {
-			/* explicitly hack around broken SUS execvp prototype */
-			case 0: execvp(cmd[0], (char *const *)&cmd[1]);
+			/* Expect compiler warnings because of half-broken SUS execvp prototype:
+			 * char *const argv[]   should have been   const char *const argv[],
+			 * but the committee favored legacy code over modern code, and modern
+			 * compilers bark at our extra const.  The only warning-free way to
+			 * call execvp is to take strings from malloc()ated memory.  That's too
+			 * stupid for our case, where all strings are fixed at compile time.
+			 * I have tried to use casts to sneak this past gcc-3.3.x, and failed.
+			 */
+			case 0: execvp(cmd[0], cmd+1);
 			default: _exit(0);
 		}
 	}
@@ -52,6 +58,7 @@
 #endif
 
 void handle_signal(int signo) {
+	(void) signo;  /* unused */
 	int i;
 	/* SIGCHLD check no longer necessary */
 	/* Quit Nicely */
@@ -68,8 +75,35 @@
 	exit(0);
 }
 
+void handle_sigusr1(int signo) {
+	(void) signo;  /* unused */
+#ifdef STDIO
+	Client *c;
+	XClassHint *class;
+	class = XAllocClassHint();
+	printf("evilwm version " VERSION "\n");
+	for (c = head_client; c; c = c->next) {
+		printf("client %p ", c);
+		if (class) {
+			XGetClassHint(dpy, c->window, class); /* XXX handle error */
+			printf("%s:%s:", class->res_name, class->res_class);
+			XFree(class->res_name);
+			XFree(class->res_class);
+		} else {
+			printf("::");
+		}
+#ifdef VWM
+		printf("%d", c->vdesk);
+#endif
+		printf(":%dx%d+%d+%d\n", c->width, c->height, c->x, c->y);
+	}
+	XFree(class);
+#endif
+}
+
 int handle_xerror(Display *dsply, XErrorEvent *e) {
 	Client *c = find_client(e->resourceid);
+	(void) dsply;  /* unused */
 
 	/* If this error actually occurred while setting up the new
 	 * window, best let make_new_client() know not to bother */
@@ -78,13 +112,14 @@
 		initialising = None;
 		return 0;
 	}
-	LOG_DEBUG("**ERK** handle_xerror() caught an XErrorEvent: %d\n", e->error_code);
+	LOG_DEBUG("**ERK** handle_xerror() caught an XErrorEvent: error_code=%d request_code=%d minor_code=%d\n",
+			e->error_code, e->request_code, e->minor_code);
 	/* if (e->error_code == BadAccess && e->resourceid == root) { */
 	if (e->error_code == BadAccess && e->request_code == X_ChangeWindowAttributes) {
 		LOG_ERROR("root window unavailable (maybe another wm is running?)\n");
 		exit(1);
 	}
-	LOG_XDEBUG("XError %x ", e->error_code);
+
 	/* Kludge around IE misbehaviour */
 	if (e->error_code == 0x8 && e->request_code == 0x0c && e->minor_code == 0x00) {
 		LOG_DEBUG("\thandle_xerror() : IE kludge - ignoring XError\n");
@@ -99,6 +134,8 @@
 }
 
 int ignore_xerror(Display *dsply, XErrorEvent *e) {
+	(void) dsply;  /* unused */
+	(void) e;  /* unused unless debugging */
 	LOG_DEBUG("ignore_xerror() caught an XErrorEvent: %d\n", e->error_code);
 	return 0;
 }
diff -urN evilwm-cvs-20050113/new.c evilwm-lrd-20050422/new.c
--- evilwm-cvs-20050113/new.c	2004-07-21 08:55:38.000000000 -0700
+++ evilwm-lrd-20050422/new.c	2005-04-22 07:17:18.000000000 -0700
@@ -5,15 +5,12 @@
 #include "evilwm.h"
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
-#ifdef SHAPE
-#include <X11/extensions/shape.h>
-#endif
 #include "log.h"
 
 #ifdef MWM_HINTS
 static PropMwmHints *get_mwm_hints(Window);
 #endif
+static void apply_hints(Client *c);
 static void init_position(Client *c);
 static void reparent(Client *c);
 
@@ -22,13 +19,7 @@
 	XWindowAttributes attr;
 	long dummy;
 	XWMHints *hints;
-	char *name;
-#ifdef VWM
 	XClassHint *class;
-#endif
-#ifdef MWM_HINTS
-	PropMwmHints *mhints;
-#endif
 
 	XGrabServer(dpy);
 
@@ -43,7 +34,6 @@
 	 * for it (sometimes they vanish too quickly or something, and lots
 	 * of pain ensues). */
 	initialising = w;
-	XFetchName(dpy, w, &name);
 	/* If 'initialising' is now set to None, that means doing the
 	 * XFetchName raised BadWindow - the window has been removed before
 	 * we got a chance to grab the server. */
@@ -83,28 +73,7 @@
 	c->height = attr.height;
 	c->border = opt_bw;
 	c->oldw = c->oldh = 0;
-
-#ifdef MWM_HINTS
-	if ((mhints = get_mwm_hints(c->window))) {
-		if (mhints->flags & MWM_HINTS_DECORATIONS
-				&& !(mhints->decorations & MWM_DECOR_ALL)) {
-			if (!(mhints->decorations & MWM_DECOR_BORDER)) {
-				c->border = 0;
-			}
-		}
-		XFree(mhints);
-	}
-#endif
-	/* If we don't have MWM_HINTS (ie, lesstif) for a client to tell us
-	 * it has no border, I include this *really blatant hack* to remove
-	 * the border from XMMS. */
-	if (name) {
-#ifndef MWM_HINTS
-		if (!strncmp("XMMS", name, 4))
-			c->border = 0;
-#endif
-		XFree(name);  /* But we want to free this anyway... */
-	}
+	apply_hints(c);
 
 #ifdef COLOURMAP
 	c->cmap = attr.colormap;
@@ -199,6 +168,33 @@
 #endif
 }
 
+static void apply_hints(Client *c)
+{
+#ifdef MWM_HINTS
+	PropMwmHints *mhints;
+	if ((mhints = get_mwm_hints(c->window))) {
+		if (mhints->flags & MWM_HINTS_DECORATIONS
+				&& !(mhints->decorations & MWM_DECOR_ALL)) {
+			if (!(mhints->decorations & MWM_DECOR_BORDER)) {
+				c->border = 0;
+			}
+		}
+		XFree(mhints);
+	}
+#else
+	/* If we don't have MWM_HINTS (i.e., lesstif) for a client to tell us
+	 * it has no border, I include this *really blatant hack* to remove
+	 * the border from XMMS. */
+	char *name;
+	XFetchName(dpy, c->window, &name);
+	if (name) {
+		if (!strncmp("XMMS", name, 4))
+			c->border = 0;
+		XFree(name);  /* But we want to free this anyway... */
+	}
+#endif
+}
+
 static void init_position(Client *c) {
 #ifdef MOUSE
 	int x, y;
@@ -215,9 +211,12 @@
 
 	if (c->width < MINSIZE) c->width = MINSIZE;
 	if (c->height < MINSIZE) c->height = MINSIZE;
+#ifdef BREAK_XPDF_FULLSCREEN
 	if (c->width > xmax) c->width = xmax;
 	if (c->height > ymax) c->height = ymax;
+#endif
 
+	LOG_DEBUG("init_position() : window %dx%d+%d+%d after size coersion\n", c->width, c->height, c->x, c->y);
 	if (c->size->flags & (/*PPosition | */USPosition)) {
 		c->x = c->size->x;
 		c->y = c->size->y;
@@ -237,6 +236,7 @@
 		c->x = -c->border;
 	if (c->y == 0 && c->height == ymax)
 		c->y = -c->border;
+	LOG_DEBUG("init_position() : window %dx%d+%d+%d final\n", c->width, c->height, c->x, c->y);
 }
 
 static void reparent(Client *c) {
@@ -263,12 +263,11 @@
 	Atom actual_type;
 	int actual_format;
 	unsigned long nitems, bytes_after;
-	PropMwmHints *data;
+	unsigned char *data;
 	if (XGetWindowProperty(dpy, w, mwm_hints, 0L,
 				(long)PROP_MWM_HINTS_ELEMENTS, False,
 				mwm_hints, &actual_type, &actual_format,
-				&nitems, &bytes_after,
-				(unsigned char **)&data)
+				&nitems, &bytes_after, &data)
 			== Success && nitems >= PROP_MWM_HINTS_ELEMENTS) {
 		return (PropMwmHints *)data;
 	}
diff -urN evilwm-cvs-20050113/options-permute evilwm-lrd-20050422/options-permute
--- evilwm-cvs-20050113/options-permute	1969-12-31 16:00:00.000000000 -0800
+++ evilwm-lrd-20050422/options-permute	2005-03-25 20:49:51.000000000 -0800
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+# Don't you just love fast computers?  :-)
+#
+# You probably still want to direct stdout and stderr to a file, and
+# study the output after it finishes rebuilding evilwm 4096 times.
+
+# useful things to do with the log file:
+#    grep -i error permute.log
+#    grep -i warning permute.log | sort | uniq
+
+@all=("SOLIDDRAG", "INFOBANNER", "INFOBANNER_MOVERESIZE", "MWM_HINTS", "VWM", "SHAPE", "MOUSE", "SNAP", "STDIO", "COLOURMAP", "DEBUG", "XDEBUG");
+
+# Simple, but less than ideal, because of overlap between INFOBANNER
+# and INFOBANNER_MOVERESIZE, and between DEBUG and XDEBUG.  Works as
+# expected if you include both or neither of each pair in @all.
+$regexp=join("|",@all);
+print "($regexp)\n";
+system("egrep -v \"$regexp\" Makefile >Makefile.stripped");
+
+$m=$#all+1;
+for ($i=0; $i<(2**$m); $i++) {
+	$opt="";
+	$h=$i;
+	for ($n=0; $n<$m; $n++) {
+		if ($h%2 == 1) { $opt .= " -D" . $all[$n];}
+		$h = int($h/2);
+	}
+	print "# options $opt\n";
+	system("make clean; make -f Makefile.stripped EXTRA_DEFINES=\"$opt\"");
+}
+
+system("rm -f Makefile.stripped");
diff -urN evilwm-cvs-20050113/screen.c evilwm-lrd-20050422/screen.c
--- evilwm-cvs-20050113/screen.c	2005-03-01 13:50:47.000000000 -0800
+++ evilwm-lrd-20050422/screen.c	2005-03-25 20:49:51.000000000 -0800
@@ -2,10 +2,10 @@
  * Copyright (C) 1999-2004 Ciaran Anscomb <evilwm@6809.org.uk>
  * see README for license and other details. */
 
-#include <stdio.h>
+#include "evilwm.h"
 #include <string.h>
 #include <stdlib.h>
-#include "evilwm.h"
+#include <stdio.h>   /* snprintf */
 #include "log.h"
 
 #ifdef VWM
@@ -74,6 +74,8 @@
 }
 #endif  /* INFOBANNER */
 
+/* Only used for some combinations of options; the optimizer can
+ * drop it otherwise, because of the static qualifier */
 static void draw_outline(Client *c) {
 #ifndef INFOBANNER_MOVERESIZE
 	char buf[24];
@@ -232,7 +234,11 @@
 	/* snap to other windows */
 	dx = dy = opt_snap;
 	for (ci = head_client; ci; ci = ci->next) {
-		if (ci != c && (ci->vdesk == vdesk || ci->vdesk == STICKY)) {
+		if (ci != c
+#ifdef VWM
+				&& (ci->vdesk == vdesk || ci->vdesk == STICKY)
+#endif
+				) {
 			if (ci->y - ci->border - c->border - c->height - c->y <= opt_snap && c->y - c->border - ci->border - ci->height - ci->y <= opt_snap) {
 				dx = absmin(dx, ci->x + ci->width - c->x + c->border + ci->border);
 				dx = absmin(dx, ci->x + ci->width - c->x - c->width);
