Author: jimtabor
Date: Sat Sep  2 04:45:16 2017
New Revision: 75735
URL: 
http://svn.reactos.org/svn/reactos?rev=75735&view=rev
Log:
[NtUser]
- Patch by Fabian Maurer : Send WM_NCPAINT and WM_ERASEBKGND when window is shown. Only
send position-change messages when needed.
- Adapted patch and fixes CORE-3998.
Modified:
    trunk/reactos/win32ss/user/ntuser/winpos.c
Modified: trunk/reactos/win32ss/user/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winpos.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winpos.c  [iso-8859-1] Sat Sep  2 04:45:16 2017
@@ -22,6 +22,8 @@
     (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER)
 #define  SWP_AGG_STATUSFLAGS \
     (SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
+#define SWP_AGG_NOCLIENTCHANGE \
+    (SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
 #define EMPTYPOINT(pt) ((pt).x == -1 && (pt).y == -1)
 #define PLACE_MIN               0x0001
@@ -1263,7 +1265,8 @@
    /* Send WM_WINDOWPOSCHANGING message */
-   if (!(WinPos->flags & SWP_NOSENDCHANGING))
+   if (!(WinPos->flags & SWP_NOSENDCHANGING)
+          && !((WinPos->flags & SWP_AGG_NOCLIENTCHANGE) &&
(WinPos->flags & SWP_SHOWWINDOW)))
    {
       TRACE("Sending WM_WINDOWPOSCHANGING to hwnd %p flags %04x.\n",
Window->head.h,WinPos->flags);
       co_IntSendMessage(Window->head.h, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
@@ -2105,11 +2108,32 @@
       WinPos.flags |= SWP_NOZORDER|SWP_NOREDRAW;
    }
+   if(!(flags & SWP_DEFERERASE))
+   {
+       /* erase parent when hiding or resizing child */
+       if ((flags & SWP_HIDEWINDOW) ||
+         (!(flags & SWP_SHOWWINDOW) &&
+          (WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOGEOMETRYCHANGE))
+       {
+           PWND Parent = Window->spwndParent;
+           if (!Parent || UserIsDesktopWindow(Parent)) Parent = Window;
+           UserSyncAndPaintWindows( Parent, RDW_ERASENOW);
+       }
+
+       /* Give newly shown windows a chance to redraw */
+       if(((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
+                && !(flags & SWP_AGG_NOCLIENTCHANGE) && (flags &
SWP_SHOWWINDOW))
+       {
+           UserSyncAndPaintWindows( Window, RDW_ERASENOW);
+       }
+   }
+
    /* And last, send the WM_WINDOWPOSCHANGED message */
    TRACE("\tstatus hwnd %p flags =
%04x\n",Window?Window->head.h:NULL,WinPos.flags & SWP_AGG_STATUSFLAGS);
-   if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
+   if (((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
+            && !((flags & SWP_AGG_NOCLIENTCHANGE) && (flags &
SWP_SHOWWINDOW)))
    {
       /* WM_WINDOWPOSCHANGED is sent even if SWP_NOSENDCHANGING is set
          and always contains final window position.