- Broadcast the appropriate messages to notify a change in display parameters and color. This should fix rollback issues from setting display modes. See CORE-12571 and CORE-13212.

svn path=/trunk/; revision=75407
This commit is contained in:
James Tabor 2017-07-26 02:52:00 +00:00
parent 27783c2956
commit 09ab5ea7ed
2 changed files with 40 additions and 16 deletions

View file

@ -697,6 +697,7 @@ UserChangeDisplaySettings(
HKEY hkey;
NTSTATUS Status;
PPDEVOBJ ppdev;
WORD OrigBC;
//PDESKTOP pdesk;
/* If no DEVMODE is given, use registry settings */
@ -715,6 +716,9 @@ UserChangeDisplaySettings(
else
dm = *pdm;
/* Save original bit count */
OrigBC = gpsi->BitCount;
/* Check params */
if ((dm.dmFields & (DM_PELSWIDTH | DM_PELSHEIGHT)) != (DM_PELSWIDTH | DM_PELSHEIGHT))
{
@ -775,18 +779,12 @@ UserChangeDisplaySettings(
}
}
/* Check if DEVMODE matches the current mode */
if (pdm == ppdev->pdmwDev && !(flags & CDS_RESET))
{
ERR("DEVMODE matches, nothing to do\n");
goto leave;
}
/* Shall we apply the settings? */
if (!(flags & CDS_NORESET))
{
ULONG ulResult;
PVOID pvOldCursor;
TEXTMETRICW tmw;
/* Remove mouse pointer */
pvOldCursor = UserSetCursor(NULL, TRUE);
@ -813,11 +811,24 @@ UserChangeDisplaySettings(
/* Update the system metrics */
InitMetrics();
//IntvGetDeviceCaps(&PrimarySurface, &GdiHandleTable->DevCaps);
/* Set new size of the monitor */
UserUpdateMonitorSize((HDEV)ppdev);
/* Update the SERVERINFO */
gpsi->dmLogPixels = ppdev->gdiinfo.ulLogPixelsY;
gpsi->Planes = ppdev->gdiinfo.cPlanes;
gpsi->BitsPixel = ppdev->gdiinfo.cBitsPixel;
gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel;
if (ppdev->gdiinfo.flRaster & RC_PALETTE)
{
gpsi->PUSIFlags |= PUSIF_PALETTEDISPLAY;
}
else
gpsi->PUSIFlags &= ~PUSIF_PALETTEDISPLAY;
// Font is realized and this dc was previously set to internal DC_ATTR.
gpsi->cxSysFontChar = IntGetCharDimensions(hSystemBM, &tmw, (DWORD*)&gpsi->cySysFontChar);
gpsi->tmSysFont = tmw;
/* Remove all cursor clipping */
UserClipCursor(NULL);
@ -825,13 +836,21 @@ UserChangeDisplaySettings(
//IntHideDesktop(pdesk);
/* Send WM_DISPLAYCHANGE to all toplevel windows */
co_IntSendMessageTimeout(HWND_BROADCAST,
WM_DISPLAYCHANGE,
(WPARAM)ppdev->gdiinfo.cBitsPixel,
(LPARAM)(ppdev->gdiinfo.ulHorzRes + (ppdev->gdiinfo.ulVertRes << 16)),
SMTO_NORMAL,
100,
&ulResult);
UserSendNotifyMessage( HWND_BROADCAST,
WM_DISPLAYCHANGE,
gpsi->BitCount,
MAKELONG(gpsi->aiSysMet[SM_CXSCREEN], gpsi->aiSysMet[SM_CYSCREEN]) );
ERR("BitCount New %d Orig %d ChkNew %d\n",gpsi->BitCount,OrigBC,ppdev->gdiinfo.cBitsPixel);
/* Not full screen and different bit count, send messages */
if (!(flags & CDS_FULLSCREEN) &&
gpsi->BitCount != OrigBC )
{
ERR("Detect settings changed.\n");
UserSendNotifyMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 );
UserSendNotifyMessage( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0 );
}
//co_IntShowDesktop(pdesk, ppdev->gdiinfo.ulHorzRes, ppdev->gdiinfo.ulVertRes);

View file

@ -266,6 +266,11 @@ UserUpdateMonitorSize(IN HDEV hDev)
if (pMonitor->hrgnMonitor)
IntGdiSetRegionOwner(pMonitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
//
// Should be Virtual accumulation of all the available monitors.
//
gpsi->rcScreenReal = pMonitor->rcMonitor;
return STATUS_SUCCESS;
}