diff -urN evilwm-0.99.18.orig/Makefile evilwm-0.99.18/Makefile
--- evilwm-0.99.18.orig/Makefile	Thu Jun  2 19:22:49 2005
+++ evilwm-0.99.18/Makefile	Sat Sep 10 22:52:26 2005
@@ -8,7 +8,7 @@
 XROOT    = /usr/X11R6
 INCLUDES = -I$(XROOT)/include
 LDPATH   = -L$(XROOT)/lib
-LIBS     = -lX11
+LIBS     = -lX11 -lXinerama
 
 DEFINES  = $(EXTRA_DEFINES)
 # Configure evilwm by editing the following DEFINES lines.  You can also
diff -urN evilwm-0.99.18.orig/events.c evilwm-0.99.18/events.c
--- evilwm-0.99.18.orig/events.c	Tue Apr 26 21:55:19 2005
+++ evilwm-0.99.18/events.c	Sun Sep 11 15:20:32 2005
@@ -10,6 +10,7 @@
 static void handle_key_event(XKeyEvent *e) {
 	Client *c = find_client(e->window);
 	KeySym key = XKeycodeToKeysym(dpy,e->keycode,0);
+	XineramaScreenInfo *xinerama_screen;
 
 	if (!c)
 		c = current;
@@ -26,13 +27,37 @@
 		case KEY_RIGHT:
 			c->x += 16; if (0)
 		case KEY_TOPLEFT:
-			{ c->x = c->border; c->y = c->border; } if (0)
+			{ if (have_xinerama) {
+				xinerama_screen = xinerama_find_current_screen(c->parent);
+				c->x = xinerama_screen->x_org+c->border; c->y = xinerama_screen->y_org+c->border;
+			  } else {
+				c->x = c->border; c->y = c->border;
+			  }
+			} if (0)
 		case KEY_TOPRIGHT:
-			{ c->x = DisplayWidth(dpy, c->screen->screen)-c->width-c->border; c->y = c->border; } if (0)
+			{ if (have_xinerama) {
+				xinerama_screen = xinerama_find_current_screen(c->parent);
+				c->x = xinerama_screen->x_org+xinerama_screen->width-c->width-c->border; c->y = xinerama_screen->y_org+c->border;
+			  } else {
+				c->x = DisplayWidth(dpy, c->screen->screen)-c->width-c->border; c->y = c->border;
+			  }
+			} if (0)
 		case KEY_BOTTOMLEFT:
-			{ c->x = c->border; c->y = DisplayHeight(dpy, c->screen->screen)-c->height-c->border; } if (0)
+			{ if (have_xinerama) {
+				xinerama_screen = xinerama_find_current_screen(c->parent);
+				c->x = xinerama_screen->x_org+c->border; c->y = xinerama_screen->y_org+xinerama_screen->height-c->height-c->border;
+			  } else {
+				c->x = c->border; c->y = DisplayHeight(dpy, c->screen->screen)-c->height-c->border;
+			  }
+			} if (0)
 		case KEY_BOTTOMRIGHT:
-			{ c->x = DisplayWidth(dpy, c->screen->screen)-c->width-c->border; c->y = DisplayHeight(dpy, c->screen->screen)-c->height-c->border; }
+			{ if (have_xinerama) {
+				xinerama_screen = xinerama_find_current_screen(c->parent);
+				c->x = xinerama_screen->x_org+xinerama_screen->width-c->width-c->border; c->y = xinerama_screen->y_org+xinerama_screen->height-c->height-c->border;
+			  } else {
+				c->x = DisplayWidth(dpy, c->screen->screen)-c->width-c->border; c->y = DisplayHeight(dpy, c->screen->screen)-c->height-c->border;
+			  }
+			}
 			moveresize(c);
 			setmouse(c->window, c->width + c->border - 1,
 					c->height + c->border - 1);
diff -urN evilwm-0.99.18.orig/evilwm.h evilwm-0.99.18/evilwm.h
--- evilwm-0.99.18.orig/evilwm.h	Tue Apr 26 22:28:58 2005
+++ evilwm-0.99.18/evilwm.h	Sun Sep 11 14:51:11 2005
@@ -3,6 +3,7 @@
 #include <X11/Xmd.h>
 #include <X11/Xutil.h>
 #include <X11/keysym.h>
+#include <X11/extensions/Xinerama.h>
 #ifdef SHAPE
 #include <X11/extensions/shape.h>
 #endif
@@ -178,6 +179,8 @@
 #endif
 extern unsigned int numlockmask;
 extern unsigned int grabmask2;
+extern int have_xinerama, xinerama_num_screens;
+extern XineramaScreenInfo *xinerama_screens;
 
 /* client.c */
 
@@ -233,3 +236,4 @@
 void switch_vdesk(int v);
 #endif /* def VWM */
 ScreenInfo *find_screen(Window root);
+XineramaScreenInfo *xinerama_find_current_screen(Window root);
diff -urN evilwm-0.99.18.orig/main.c evilwm-0.99.18/main.c
--- evilwm-0.99.18.orig/main.c	Tue Apr 26 21:59:31 2005
+++ evilwm-0.99.18/main.c	Sun Sep 11 14:36:43 2005
@@ -50,6 +50,8 @@
 static unsigned int grabmask1 = ControlMask|Mod1Mask;
 /* This one is used for per-client mousebutton grabs, so global: */
 unsigned int grabmask2 = Mod1Mask;
+int have_xinerama = 0, xinerama_num_screens;
+XineramaScreenInfo *xinerama_screens;
 
 static void setup_display(void);
 static void *xmalloc(size_t size);
@@ -244,6 +246,21 @@
 #ifdef SHAPE
 	have_shape = XShapeQueryExtension(dpy, &shape_event, &i);
 #endif
+
+	/* Xinerama */
+
+	if (XineramaQueryExtension(dpy, &dummy, &dummy)) {
+	  have_xinerama = XineramaIsActive(dpy);
+	}
+	LOG_DEBUG("Xinerama: %d\n", have_xinerama);
+
+	if (have_xinerama) {
+	  xinerama_screens = XineramaQueryScreens(dpy, &xinerama_num_screens);
+	  for (i = 0; i < xinerama_num_screens; i++) {
+	    LOG_DEBUG("Xinerama screen %d: x: %d, y: %d, width: %d, height: %d\n", i, xinerama_screens[i].x_org, xinerama_screens[i].y_org,
+		      xinerama_screens[i].width, xinerama_screens[i].height);
+	  }
+	}
 
 	/* now set up each screen in turn */
 	num_screens = ScreenCount(dpy);
diff -urN evilwm-0.99.18.orig/screen.c evilwm-0.99.18/screen.c
--- evilwm-0.99.18.orig/screen.c	Mon May  9 12:08:29 2005
+++ evilwm-0.99.18/screen.c	Sun Sep 11 15:02:06 2005
@@ -313,6 +313,8 @@
 }
 
 void maximise_horiz(Client *c) {
+	XineramaScreenInfo *xinerama_screen;
+
 	LOG_DEBUG("SCREEN: maximise_horiz()\n");
 	if (c->oldw) {
 		c->x = c->oldx;
@@ -321,12 +323,20 @@
 	} else {
 		c->oldx = c->x;
 		c->oldw = c->width;
-		recalculate_sweep(c, 0, c->y, DisplayWidth(dpy, c->screen->screen),
-				c->y + c->height);
+		if (have_xinerama) {
+			xinerama_screen = xinerama_find_current_screen(c->parent);
+			recalculate_sweep(c, xinerama_screen->x_org, c->y, xinerama_screen->x_org + xinerama_screen->width,
+					c->y + c->height);
+		} else {
+			recalculate_sweep(c, 0, c->y, DisplayWidth(dpy, c->screen->screen),
+					c->y + c->height);
+		}
 	}
 }
 
 void maximise_vert(Client *c) {
+	XineramaScreenInfo *xinerama_screen;	
+
 	LOG_DEBUG("SCREEN: maximise_vert()\n");
 	if (c->oldh) {
 		c->y = c->oldy;
@@ -335,8 +345,14 @@
 	} else {
 		c->oldy = c->y;
 		c->oldh = c->height;
-		recalculate_sweep(c, c->x, 0, c->x + c->width,
-				DisplayHeight(dpy, c->screen->screen));
+		if (have_xinerama) {
+			xinerama_screen = xinerama_find_current_screen(c->parent);
+			recalculate_sweep(c, c->x, xinerama_screen->y_org, c->x + c->width,
+					xinerama_screen->y_org + xinerama_screen->height);
+		} else {
+			recalculate_sweep(c, c->x, 0, c->x + c->width,
+					DisplayHeight(dpy, c->screen->screen));
+		}
 	}
 }
 
@@ -437,4 +453,17 @@
 			return &screens[i];
 	}
 	return NULL;
+}
+
+XineramaScreenInfo *xinerama_find_current_screen(Window root) {
+	int i;
+	int x, y;
+	get_mouse_position(&x, &y, root);
+	for (i = 0; i < xinerama_num_screens; i++) {
+		if (x >= xinerama_screens[i].x_org && x < xinerama_screens[i].x_org + xinerama_screens[i].width &&
+			y >= xinerama_screens[i].y_org && y < xinerama_screens[i].y_org + xinerama_screens[i].height) {
+			return &xinerama_screens[i];
+		}
+	}
+	return &xinerama_screens[0];
 }
