diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-09-03 11:19:01 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2010-09-03 11:21:43 +0200 |
commit | 12e4577c020c6905d09459d833fd1c5313f1647b (patch) | |
tree | abffc1623dd5c8a840126639b2bd11adf54e661c /src | |
parent | 81a0a1a37e703296d109022bb76a1291e84064fd (diff) |
vmwlegacy: Always scale screen dimensions to the initial DPI on modeswitch.
When we switch mode we usually alter the size in a constant DPI environment
rather than keeping the size constant and alter the DPI.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vmware.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/vmware.c b/src/vmware.c index 1327d35..599ac07 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -74,6 +74,8 @@ char rcsId_vmware[] = #error "PCI_VENDOR_VMWARE is wrong, update it from vm_device_version.h" #endif +#define VMWARE_INCHTOMM 25.4 + /* * This is the only way I know to turn a #define of an integer constant into * a constant string. @@ -1557,7 +1559,6 @@ vmwareIsRegionEqual(const RegionPtr reg1, return TRUE; } - #if VMWARE_DRIVER_FUNC static Bool VMWareDriverFunc(ScrnInfoPtr pScrn, @@ -1585,8 +1586,10 @@ VMWareDriverFunc(ScrnInfoPtr pScrn, * keep the DPI constant. */ if (modemm && modemm->mode) { - modemm->mmWidth *= modemm->mode->HDisplay / (double)(modemm->virtX); - modemm->mmHeight *= modemm->mode->VDisplay / (double)(modemm->virtY); + modemm->mmWidth *= (modemm->mode->HDisplay * VMWARE_INCHTOMM + + pScrn->xDpi / 2) / pScrn->xDpi; + modemm->mmHeight *= (modemm->mode->VDisplay * VMWARE_INCHTOMM + + pScrn->yDpi / 2) / pScrn->yDpi; } return TRUE; default: @@ -1863,8 +1866,17 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) static Bool VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags) + { - return VMWAREModeInit(xf86Screens[scrnIndex], mode, TRUE); + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScreenPtr pScreen = pScrn->pScreen; + + pScreen->mmWidth = (pScreen->width * VMWARE_INCHTOMM + + pScrn->xDpi / 2) / pScrn->xDpi; + pScreen->mmHeight = (pScreen->height * VMWARE_INCHTOMM + + pScrn->yDpi / 2) / pScrn->yDpi; + + return VMWAREModeInit(pScrn, mode, TRUE); } static Bool |