Index: Xrandr.c
===================================================================
RCS file: /cvs/xorg/xc/lib/Xrandr/Xrandr.c,v
retrieving revision 1.2
diff -u -r1.2 Xrandr.c
--- Xrandr.c	23 Apr 2004 18:43:47 -0000	1.2
+++ Xrandr.c	22 Aug 2005 22:47:16 -0000
@@ -709,10 +709,17 @@
 	scevent = (XRRScreenChangeNotifyEvent *) event;
 	snum = XRRRootToScreen(dpy, 
 			       ((XRRScreenChangeNotifyEvent *) event)->root);
-	dpy->screens[snum].width   = scevent->width;
-	dpy->screens[snum].height  = scevent->height;
-	dpy->screens[snum].mwidth  = scevent->mwidth;
-	dpy->screens[snum].mheight = scevent->mheight;
+	if (scevent->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+	    dpy->screens[snum].width   = scevent->height;
+	    dpy->screens[snum].height  = scevent->width;
+	    dpy->screens[snum].mwidth  = scevent->mheight;
+	    dpy->screens[snum].mheight = scevent->mwidth;
+	} else {
+	    dpy->screens[snum].width   = scevent->width;
+	    dpy->screens[snum].height  = scevent->height;
+	    dpy->screens[snum].mwidth  = scevent->mwidth;
+	    dpy->screens[snum].mheight = scevent->mheight;
+	}
 	XRenderSetSubpixelOrder (dpy, snum, scevent->subpixel_order);
 	break;
     default: