- Rewrite NtUserGetUpdateRect. It should return TRUE when the window needs to be pained, not only when the client update rect is non-empty.
- Return TRUE for windows with pending WM_NCPAINT message in IntIsWindowDirty.
Modified: trunk/reactos/subsys/win32k/ntuser/painting.c

Modified: trunk/reactos/subsys/win32k/ntuser/painting.c
--- trunk/reactos/subsys/win32k/ntuser/painting.c	2005-03-27 01:57:26 UTC (rev 14341)
+++ trunk/reactos/subsys/win32k/ntuser/painting.c	2005-03-27 08:29:25 UTC (rev 14342)
@@ -537,7 +537,8 @@
 {
    return (Window->Style & WS_VISIBLE) &&
       ((Window->UpdateRegion != NULL) ||
-       (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT));
+       (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) ||
+       (Window->Flags & WINDOWOBJECT_NEED_NCPAINT));
 }
 
 HWND STDCALL
@@ -873,6 +874,7 @@
       return ERROR;
    }
     
+   IntLockWindowUpdate(Window);
    if (Window->UpdateRegion == NULL)
    {
       RegionType = (NtGdiSetRectRgn(hRgn, 0, 0, 0, 0) ? NULLREGION : ERROR);
@@ -885,6 +887,7 @@
          Window->WindowRect.left - Window->ClientRect.left,
          Window->WindowRect.top - Window->ClientRect.top);
    }
+   IntUnLockWindowUpdate(Window);
 
    IntReleaseWindowObject(Window);
 
@@ -904,49 +907,56 @@
  */
 
 BOOL STDCALL
-NtUserGetUpdateRect(HWND Wnd, LPRECT UnsafeRect, BOOL Erase)
+NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
 {
-  RECT Rect;
-  HRGN Rgn;
-  PROSRGNDATA RgnData;
-  NTSTATUS Status;
+   PWINDOW_OBJECT Window;
+   RECT Rect;
+   INT RegionType;
+   PROSRGNDATA RgnData;
+   BOOL AlwaysPaint;
+   NTSTATUS Status;
 
-  Rgn = NtGdiCreateRectRgn(0, 0, 0, 0);
-  if (NULL == Rgn)
-    {
-      NtGdiDeleteObject(Rgn);
-      SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
-      return FALSE;
-    }
-  NtUserGetUpdateRgn(Wnd, Rgn, Erase);
-  RgnData = RGNDATA_LockRgn(Rgn);
-  if (NULL == RgnData)
-    {
-      NtGdiDeleteObject(Rgn);
-      SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
-      return FALSE;
-    }
-  if (ERROR == UnsafeIntGetRgnBox(RgnData, &Rect))
-    {
-      RGNDATA_UnlockRgn(Rgn);
-      NtGdiDeleteObject(Rgn);
-      SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
-      return FALSE;
-    }
-  RGNDATA_UnlockRgn(Rgn);
-  NtGdiDeleteObject(Rgn);
+   if (!(Window = IntGetWindowObject(hWnd)))
+   {
+      SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
+      return ERROR;
+   }
+    
+   IntLockWindowUpdate(Window);
+   if (Window->UpdateRegion == NULL)
+   {
+      Rect.left = Rect.top = Rect.right = Rect.bottom = 0;
+   }
+   else
+   {
+      RgnData = RGNDATA_LockRgn(Window->UpdateRegion);
+      ASSERT(RgnData != NULL);
+      RegionType = UnsafeIntGetRgnBox(RgnData, &Rect);
+      ASSERT(RegionType != ERROR);
+      RGNDATA_UnlockRgn(Window->UpdateRegion);
+   }
+   AlwaysPaint = (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) ||
+                 (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT);
+   IntUnLockWindowUpdate(Window);
 
-  if (UnsafeRect != NULL)
-    {
+   IntReleaseWindowObject(Window);
+
+   if (bErase && Rect.left < Rect.right && Rect.top < Rect.bottom)
+   {
+      NtUserRedrawWindow(hWnd, NULL, NULL, RDW_ERASENOW | RDW_NOCHILDREN);
+   }
+  
+   if (UnsafeRect != NULL)
+   {
       Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
-      if (! NT_SUCCESS(Status))
-        {
-          SetLastWin32Error(ERROR_INVALID_PARAMETER);
-          return FALSE;
-        }
-    }
+      if (!NT_SUCCESS(Status))
+      {
+         SetLastWin32Error(ERROR_INVALID_PARAMETER);
+         return FALSE;
+      }
+   }
 
-  return Rect.left < Rect.right && Rect.top < Rect.bottom;
+   return (Rect.left < Rect.right && Rect.top < Rect.bottom) || AlwaysPaint;
 }
 
 /*