From a283c62c1db9e25ba11c6d72e4d00e0d911d64a2 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Fri, 9 Feb 2007 11:09:17 -0800 Subject: [PATCH] Filter out default modes that are larger than the hardware maxmimum size and add an explicit mode for the hardware maximum. --- src/vmware.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/vmware.c b/src/vmware.c index dabf352..e02e2fa 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -1584,11 +1584,18 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) unsigned int numModes = sizeof (VMWAREDefaultModes) / sizeof *(VMWAREDefaultModes); char name[10]; for (i = 0; i < numModes; i++) { - snprintf(name, 10, "%dx%d", - VMWAREDefaultModes[i].width, VMWAREDefaultModes[i].height); - VMWAREAddDisplayMode(pScrn, name, VMWAREDefaultModes[i].width, - VMWAREDefaultModes[i].height); + const VMWAREDefaultMode *mode = &VMWAREDefaultModes[i]; + + /* Only modes that fit the hardware maximums should be added. */ + if (mode->width <= pVMWARE->maxWidth && mode->height <= pVMWARE->maxHeight) { + snprintf(name, 10, "%dx%d", mode->width, mode->height); + VMWAREAddDisplayMode(pScrn, name, mode->width, mode->height); + } } + + /* Add the hardware maximums as a mode. */ + snprintf(name, 10, "%dx%d", pVMWARE->maxWidth, pVMWARE->maxHeight); + VMWAREAddDisplayMode(pScrn, name, pVMWARE->maxWidth, pVMWARE->maxHeight); } /* -- 2.7.4