[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 12 Jan 2011 14:02:54 +0000 (14:02 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 12 Jan 2011 14:02:54 +0000 (14:02 +0000)
Reset monitor size after mode switch. patch by rafalh <rafalh1992 at o2 dor pl>

See issue #5727 for more details.

svn path=/trunk/; revision=50370

reactos/subsystems/win32/win32k/include/monitor.h
reactos/subsystems/win32/win32k/ntuser/display.c
reactos/subsystems/win32/win32k/ntuser/monitor.c

index 04a9a3f..729f28d 100644 (file)
@@ -40,6 +40,7 @@ NTSTATUS CleanupMonitorImpl();
 
 NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber);
 NTSTATUS IntDetachMonitor(PDEVOBJ *pGdiDevice);
+NTSTATUS IntResetMonitorSize(IN PDEVOBJ *pGdiDevice);
 PMONITOR FASTCALL UserGetMonitorObject(IN HMONITOR);
 PMONITOR FASTCALL IntGetPrimaryMonitor(VOID);
 
index ba54900..7e0f25c 100644 (file)
@@ -765,6 +765,9 @@ UserChangeDisplaySettings(
 
         //IntvGetDeviceCaps(&PrimarySurface, &GdiHandleTable->DevCaps);
 
+        /* Set new size of the monitor */
+        IntResetMonitorSize(ppdev);
+
         /* Remove all cursor clipping */
         UserClipCursor(NULL);
 
index 9dd49ef..d744d6e 100644 (file)
@@ -246,6 +246,51 @@ IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
     return STATUS_SUCCESS;
 }
 
+/* IntResetMonitorSize
+ *
+ * Reset size of the monitor using atached device
+ *
+ * Arguments
+ *
+ *   PMONITOR
+ *      pGdiDevice  Pointer to the PDEVOBJ, which size has changed
+ *
+ * Return value
+ *   Returns a NTSTATUS
+ */
+NTSTATUS
+IntResetMonitorSize(IN PDEVOBJ *pGdiDevice)
+{
+       PMONITOR Monitor;
+
+    for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next)
+    {
+        if (Monitor->GdiDevice == pGdiDevice)
+            break;
+    }
+
+    if (Monitor == NULL)
+    {
+        /* no monitor for given device found */
+        return STATUS_INVALID_PARAMETER;
+    }
+
+    Monitor->rcMonitor.left  = 0;
+    Monitor->rcMonitor.top   = 0;
+    Monitor->rcMonitor.right  = Monitor->rcMonitor.left + Monitor->GdiDevice->gdiinfo.ulHorzRes;
+    Monitor->rcMonitor.bottom = Monitor->rcMonitor.top + Monitor->GdiDevice->gdiinfo.ulVertRes;
+    Monitor->rcWork = Monitor->rcMonitor;
+
+    if (Monitor->hrgnMonitor)
+        REGION_FreeRgnByHandle(Monitor->hrgnMonitor);
+
+    Monitor->hrgnMonitor = IntSysCreateRectRgnIndirect( &Monitor->rcMonitor );
+
+    IntGdiSetRegionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
+
+    return STATUS_SUCCESS;
+}
+
 /* IntGetPrimaryMonitor
  *
  * Returns a PMONITOR for the primary monitor