Author: jimtabor
Date: Wed Jul 26 02:52:00 2017
New Revision: 75407

URL: http://svn.reactos.org/svn/reactos?rev=75407&view=rev
Log:
[NtUser]
- 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.

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

Modified: trunk/reactos/win32ss/user/ntuser/display.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/display.c?rev=75407&r1=75406&r2=75407&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Wed Jul 26 
02:52:00 2017
@@ -697,6 +697,7 @@
     HKEY hkey;
     NTSTATUS Status;
     PPDEVOBJ ppdev;
+    WORD OrigBC;
     //PDESKTOP pdesk;
 
     /* If no DEVMODE is given, use registry settings */
@@ -715,6 +716,9 @@
     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 @@
         }
     }
 
-    /* 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 @@
         /* 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 @@
         //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);
 

Modified: trunk/reactos/win32ss/user/ntuser/monitor.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/monitor.c?rev=75407&r1=75406&r2=75407&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/monitor.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/monitor.c [iso-8859-1] Wed Jul 26 
02:52:00 2017
@@ -266,6 +266,11 @@
     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;
 }
 


Reply via email to