Author: mjansen
Date: Sun Jun  5 11:16:02 2016
New Revision: 71529

URL: http://svn.reactos.org/svn/reactos?rev=71529&view=rev
Log:
[WIN32SS] Remember the last process that changed the displaymode with 
CDS_FULLSCREEN, restore mode after it quits. CORE-11358 #resolve

Modified:
    trunk/reactos/win32ss/user/ntuser/display.c
    trunk/reactos/win32ss/user/ntuser/main.c

Modified: trunk/reactos/win32ss/user/ntuser/display.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/display.c?rev=71529&r1=71528&r2=71529&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Sun Jun  5 
11:16:02 2016
@@ -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 @@
     return Status;
 }
 
+VOID
+UserUpdateFullscreen(
+    DWORD flags)
+{
+    if (flags & CDS_FULLSCREEN)
+        gpFullscreen = gptiCurrent->ppi;
+    else
+        gpFullscreen = NULL;
+}
+
 LONG
 APIENTRY
 UserChangeDisplaySettings(
@@ -773,6 +784,8 @@
 
             goto leave;
         }
+
+        UserUpdateFullscreen(flags);
 
         /* Update the system metrics */
         InitMetrics();
@@ -809,6 +822,18 @@
     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(

Modified: trunk/reactos/win32ss/user/ntuser/main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c?rev=71529&r1=71528&r2=71529&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/main.c    [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/main.c    [iso-8859-1] Sun Jun  5 
11:16:02 2016
@@ -677,6 +677,9 @@
     return Status;
 }
 
+VOID
+UserDisplayNotifyShutdown(PPROCESSINFO ppiCurrent);
+
 NTSTATUS
 NTAPI
 ExitThreadCallback(PETHREAD Thread)
@@ -805,6 +808,11 @@
 
        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)


Reply via email to