[WINHTTP] Sync with Wine Staging 3.9. CORE-14656
[reactos.git] / dll / cpl / desk / monslctl.c
index b7be54a..1d09206 100644 (file)
@@ -39,6 +39,7 @@ typedef struct _MONITORSELWND
     PMONSL_MON Monitors;
     RECT rcExtent;
     RECT rcMonitors;
+    RECT rcOldMonitors;
     POINT ScrollPos;
     SIZE Margin;
     SIZE SelectionFrame;
@@ -261,6 +262,14 @@ MonSelRepaint(IN PMONITORSELWND infoPtr)
     InvalidateRect(infoPtr->hSelf,
                    &rc,
                    TRUE);
+
+    if (!EqualRect(&infoPtr->rcMonitors, &infoPtr->rcOldMonitors) &&
+        infoPtr->rcOldMonitors.right != infoPtr->rcOldMonitors.left)
+    {
+        MonSelRectToScreen(infoPtr, &infoPtr->rcOldMonitors, &rc);
+        InvalidateRect(infoPtr->hSelf, &rc, TRUE);
+        infoPtr->rcOldMonitors = infoPtr->rcMonitors;
+    }
 }
 
 static VOID
@@ -355,6 +364,7 @@ MonSelUpdateMonitorsInfo(IN OUT PMONITORSELWND infoPtr,
         ScaleRectSizeFit(&rcExtSurface,
                          &rcExtDisplay);
 
+        infoPtr->rcOldMonitors = infoPtr->rcMonitors;
         infoPtr->rcMonitors = rcExtDisplay;
 
         /* Now that we know in which area all monitors are located,
@@ -529,7 +539,7 @@ MonSelGetMonitorRect(IN OUT PMONITORSELWND infoPtr,
 {
     RECT rc, rcClient;
 
-    if (Index < 0 || Index >= infoPtr->MonitorsCount)
+    if (Index < 0 || (UINT)Index >= infoPtr->MonitorsCount)
         return -1;
 
     if (!infoPtr->CanDisplay)
@@ -688,7 +698,7 @@ MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr,
     hFont = infoPtr->Monitors[Index].hFont;
     if (hFont == NULL &&
         GetObject(infoPtr->hFont,
-                  sizeof(LOGFONT),
+                  sizeof(lf),
                   &lf) != 0)
     {
         rcsize.cx = infoPtr->Monitors[Index].rc.right - infoPtr->Monitors[Index].rc.left -
@@ -1459,7 +1469,7 @@ MonitorSelWndProc(IN HWND hwnd,
                                 Index++;
                         }
 
-                        if (infoPtr->SelectedMonitor < infoPtr->MonitorsCount)
+                        if (infoPtr->SelectedMonitor < (INT)infoPtr->MonitorsCount)
                         {
                             MonSelSetCurSelMonitor(infoPtr,
                                                    Index,
@@ -1570,9 +1580,9 @@ MonitorSelWndProc(IN HWND hwnd,
 
         case WM_CREATE:
         {
-            infoPtr = (PMONITORSELWND) HeapAlloc(GetProcessHeap(),
-                                                 0,
-                                                 sizeof(MONITORSELWND));
+            infoPtr = (PMONITORSELWND)HeapAlloc(GetProcessHeap(),
+                                                0,
+                                                sizeof(MONITORSELWND));
             if (infoPtr == NULL)
             {
                 Ret = (LRESULT)-1;