Index: hw/xfree86/common/xf86RandR.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v retrieving revision 1.4 diff -u -r1.4 xf86RandR.c --- hw/xfree86/common/xf86RandR.c 2 Aug 2004 19:35:07 -0000 1.4 +++ hw/xfree86/common/xf86RandR.c 9 Aug 2004 19:17:36 -0000 @@ -38,6 +38,8 @@ CloseScreenProcPtr CloseScreen; int virtualX; int virtualY; + int mmWidth; + int mmHeight; Rotation rotation; } XF86RandRInfoRec, *XF86RandRInfoPtr; @@ -73,7 +75,7 @@ refresh0 = refresh; pSize = RRRegisterSize (pScreen, mode->HDisplay, mode->VDisplay, - pScreen->mmWidth, pScreen->mmHeight); + randrp->mmWidth, randrp->mmHeight); if (!pSize) return FALSE; RRRegisterRate (pScreen, pSize, refresh); @@ -89,8 +91,8 @@ mode = scrp->modes; pSize = RRRegisterSize (pScreen, randrp->virtualX, randrp->virtualY, - pScreen->mmWidth * randrp->virtualX / scrp->currentMode->HDisplay, - pScreen->mmHeight * randrp->virtualY / scrp->currentMode->VDisplay); + randrp->mmWidth, + randrp->mmHeight); if (!pSize) return FALSE; RRRegisterRate (pScreen, pSize, refresh0); @@ -117,12 +119,16 @@ static Bool xf86RandRSetMode (ScreenPtr pScreen, DisplayModePtr mode, - Bool useVirtual) + Bool useVirtual, + int mmWidth, + int mmHeight) { ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int oldWidth = pScreen->width; int oldHeight = pScreen->height; + int oldmmWidth = pScreen->mmWidth; + int oldmmHeight = pScreen->mmHeight; WindowPtr pRoot = WindowTable[pScreen->myNum]; if (pRoot) @@ -142,16 +148,22 @@ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */ pScreen->width = scrp->virtualY; pScreen->height = scrp->virtualX; + pScreen->mmWidth = mmHeight; + pScreen->mmHeight = mmWidth; } else { pScreen->width = scrp->virtualX; pScreen->height = scrp->virtualY; + pScreen->mmWidth = mmWidth; + pScreen->mmHeight = mmHeight; } if (!xf86SwitchMode (pScreen, mode)) { scrp->virtualX = pScreen->width = oldWidth; scrp->virtualY = pScreen->height = oldHeight; + pScreen->mmWidth = oldmmWidth; + pScreen->mmHeight = oldmmHeight; return FALSE; } /* @@ -215,7 +227,7 @@ return FALSE; } - if (!xf86RandRSetMode (pScreen, mode, useVirtual)) + if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) return FALSE; /* * Move the cursor back where it belongs; SwitchMode repositions it @@ -307,6 +319,8 @@ randrp->virtualX = scrp->virtualX; randrp->virtualY = scrp->virtualY; + randrp->mmWidth = pScreen->mmWidth; + randrp->mmHeight = pScreen->mmHeight; randrp->CreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = xf86RandRCreateScreenResources;