Author: tfaber Date: Mon Apr 17 20:25:55 2017 New Revision: 74360
URL: http://svn.reactos.org/svn/reactos?rev=74360&view=rev Log: [WIN32K] Fix automatic resolution change when resizing the VirtualBox window. Based on a patch by Ismael Ferreras Morezuelas. - Provide a function, PDEVOBJ_vRefreshModeList, to reload the list of display modes - Call PDEVOBJ_vRefreshModeList from UserEnumDisplaySettings to get an updated list of modes each time CORE-6742 #resolve
Modified: trunk/reactos/win32ss/gdi/eng/device.h trunk/reactos/win32ss/gdi/eng/pdevobj.c trunk/reactos/win32ss/user/ntuser/display.c
Modified: trunk/reactos/win32ss/gdi/eng/device.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/device.h?re... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/device.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/device.h [iso-8859-1] Mon Apr 17 20:25:55 2017 @@ -2,6 +2,11 @@ #pragma once
#define TAG_GDEV 'gdev' + +VOID +NTAPI +PDEVOBJ_vRefreshModeList( + PPDEVOBJ ppdev);
extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice; extern PGRAPHICS_DEVICE gpVgaGraphicsDevice;
Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/pdevobj.c?r... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] Mon Apr 17 20:25:55 2017 @@ -256,6 +256,45 @@
DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface); return ppdev->pSurface; +} + +VOID +NTAPI +PDEVOBJ_vRefreshModeList( + PPDEVOBJ ppdev) +{ + PGRAPHICS_DEVICE pGraphicsDevice; + PDEVMODEINFO pdminfo, pdmiNext; + DEVMODEW dmDefault; + + /* Lock the PDEV */ + EngAcquireSemaphore(ppdev->hsemDevLock); + + pGraphicsDevice = ppdev->pGraphicsDevice; + + /* Remember our default mode */ + dmDefault = *pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm; + + /* Clear out the modes */ + for (pdminfo = pGraphicsDevice->pdevmodeInfo; + pdminfo; + pdminfo = pdmiNext) + { + pdmiNext = pdminfo->pdmiNext; + ExFreePoolWithTag(pdminfo, GDITAG_DEVMODE); + } + pGraphicsDevice->pdevmodeInfo = NULL; + ExFreePoolWithTag(pGraphicsDevice->pDevModeList, GDITAG_GDEVICE); + pGraphicsDevice->pDevModeList = NULL; + + /* Now re-populate the list */ + if (!EngpPopulateDeviceModeList(pGraphicsDevice, &dmDefault)) + { + DPRINT1("FIXME: EngpPopulateDeviceModeList failed, we just destroyed a perfectly good mode list\n"); + } + + /* Unlock PDEV */ + EngReleaseSemaphore(ppdev->hsemDevLock); }
PDEVMODEW
Modified: trunk/reactos/win32ss/user/ntuser/display.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/display... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Mon Apr 17 20:25:55 2017 @@ -463,19 +463,27 @@ PGRAPHICS_DEVICE pGraphicsDevice; PDEVMODEENTRY pdmentry; ULONG i, iFoundMode; + PPDEVOBJ ppdev;
TRACE("Enter UserEnumDisplaySettings('%wZ', %lu)\n", pustrDevice, iModeNum);
/* Ask GDI for the GRAPHICS_DEVICE */ pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0, 0); - - if (!pGraphicsDevice) + ppdev = EngpGetPDEV(pustrDevice); + + if (!pGraphicsDevice || !ppdev) { /* No device found */ ERR("No device found!\n"); return STATUS_INVALID_PARAMETER_1; } + + /* let's politely ask the driver for an updated mode list, + just in case there's something new in there (vbox) */ + + PDEVOBJ_vRefreshModeList(ppdev); + PDEVOBJ_vRelease(ppdev);
iFoundMode = 0; for (i = 0; i < pGraphicsDevice->cDevModes; i++)