[WIN32SS] Remember the last process that changed the displaymode with CDS_FULLSCREEN, restore mode after it quits. CORE-11358 #resolve

svn path=/trunk/; revision=71529
This commit is contained in:
Mark Jansen
2016-06-05 11:16:02 +00:00
parent 4322caeede
commit 5e01926bf5
2 changed files with 33 additions and 0 deletions
+25
View File
@@ -10,6 +10,7 @@
DBG_DEFAULT_CHANNEL(UserDisplay);
BOOL gbBaseVideo = 0;
static PPROCESSINFO gpFullscreen = NULL;
static const PWCHAR KEY_VIDEO = L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO";
@@ -650,6 +651,16 @@ NtUserEnumDisplaySettings(
return Status;
}
VOID
UserUpdateFullscreen(
DWORD flags)
{
if (flags & CDS_FULLSCREEN)
gpFullscreen = gptiCurrent->ppi;
else
gpFullscreen = NULL;
}
LONG
APIENTRY
UserChangeDisplaySettings(
@@ -774,6 +785,8 @@ UserChangeDisplaySettings(
goto leave;
}
UserUpdateFullscreen(flags);
/* Update the system metrics */
InitMetrics();
@@ -809,6 +822,18 @@ leave:
return lResult;
}
VOID
UserDisplayNotifyShutdown(
PPROCESSINFO ppiCurrent)
{
if (ppiCurrent == gpFullscreen)
{
UserChangeDisplaySettings(NULL, NULL, 0, NULL);
if (gpFullscreen)
ERR("Failed to restore display mode!\n");
}
}
LONG
APIENTRY
NtUserChangeDisplaySettings(
+8
View File
@@ -677,6 +677,9 @@ error:
return Status;
}
VOID
UserDisplayNotifyShutdown(PPROCESSINFO ppiCurrent);
NTSTATUS
NTAPI
ExitThreadCallback(PETHREAD Thread)
@@ -806,6 +809,11 @@ ExitThreadCallback(PETHREAD Thread)
gptiForeground = NULL;
}
/* Restore display mode when we are the last thread, and we changed the display mode */
if (ppiCurrent->cThreads == 0)
UserDisplayNotifyShutdown(ppiCurrent);
// Fixes CORE-6384 & CORE-7030.
/* if (ptiLastInput == ptiCurrent)
{