[ros-diffs] [jimtabor] 45305: [Win32k] - Add back removed window dce support routine. Fixed list handling and implemented thread cleanup for dces.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Fri Jan 29 00:34:57 CET 2010


Author: jimtabor
Date: Fri Jan 29 00:34:57 2010
New Revision: 45305

URL: http://svn.reactos.org/svn/reactos?rev=45305&view=rev
Log:
[Win32k]
- Add back removed window dce support routine. Fixed list handling and implemented thread cleanup for dces.

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
    trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
    trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c?rev=45305&r1=45304&r2=45305&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Fri Jan 29 00:34:57 2010
@@ -1116,18 +1116,6 @@
     return 0;
 }
 
-/* ValidateRect gets redirected to NtUserValidateRect:
-   http://blog.csdn.net/ntdll/archive/2005/10/19/509299.aspx */
-BOOL
-APIENTRY
-NtUserValidateRect(
-    HWND hWnd,
-    const RECT *lpRect)
-{
-    UNIMPLEMENTED;
-    return 0;
-}
-
 BOOL
 APIENTRY
 NtUserValidateTimerCallback(

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/painting.c?rev=45305&r1=45304&r2=45305&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Fri Jan 29 00:34:57 2010
@@ -81,8 +81,9 @@
          if (Recurse)
             return FALSE;
 
-         IntInvalidateWindows(ParentWindow, hValidateRgn,
-                              RDW_VALIDATE | RDW_NOCHILDREN);
+         IntInvalidateWindows( ParentWindow,
+                               hValidateRgn,
+                               RDW_VALIDATE | RDW_NOCHILDREN);
       }
 
       ParentWindow = ParentWindow->spwndParent;
@@ -250,7 +251,9 @@
             Window->state &= ~WINDOWOBJECT_NEED_NCPAINT;
             MsqDecPaintCountQueue(Window->pti->MessageQueue);
             co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
-            if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
+
+            if ( (HANDLE) 1 != TempRegion &&
+                 NULL != TempRegion)
             {
                /* NOTE: The region can already be deleted! */
                GDIOBJ_FreeObjByHandle(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
@@ -261,9 +264,10 @@
          {
             if (Window->hrgnUpdate)
             {
-               hDC = UserGetDCEx(Window, Window->hrgnUpdate,
-                                 DCX_CACHE | DCX_USESTYLE |
-                                 DCX_INTERSECTRGN | DCX_KEEPCLIPRGN);
+               hDC = UserGetDCEx( Window,
+                                  Window->hrgnUpdate,
+                                  DCX_CACHE|DCX_USESTYLE|DCX_INTERSECTRGN|DCX_KEEPCLIPRGN);
+
                if (co_IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
                {
                   Window->state &= ~WINDOWOBJECT_NEED_ERASEBKGND;
@@ -285,8 +289,9 @@
    /*
     * Paint child windows.
     */
-   if (!(Flags & RDW_NOCHILDREN) && !(Wnd->style & WS_MINIMIZE) &&
-       ((Flags & RDW_ALLCHILDREN) || !(Wnd->style & WS_CLIPCHILDREN)))
+   if (!(Flags & RDW_NOCHILDREN) &&
+       !(Wnd->style & WS_MINIMIZE) &&
+        ((Flags & RDW_ALLCHILDREN) || !(Wnd->style & WS_CLIPCHILDREN)) )
    {
       HWND *List, *phWnd;
 
@@ -325,7 +330,7 @@
    BOOL HasPaintMessage, HasNCPaintMessage;
 
    Wnd = Window->Wnd;
-
+   DPRINT1("IntInvalidateWindows start\n");
    /*
     * If the nonclient is not to be redrawn, clip the region to the client
     * rect
@@ -353,13 +358,13 @@
    }
    else
    {
-      NtGdiOffsetRgn(hRgn,
-         -Wnd->rcWindow.left,
-         -Wnd->rcWindow.top);
+      NtGdiOffsetRgn( hRgn,
+                     -Wnd->rcWindow.left,
+                     -Wnd->rcWindow.top);
       RgnType = NtGdiCombineRgn(hRgn, hRgn, Window->hrgnClip, RGN_AND);
-      NtGdiOffsetRgn(hRgn,
-         Wnd->rcWindow.left,
-         Wnd->rcWindow.top);
+      NtGdiOffsetRgn( hRgn,
+                      Wnd->rcWindow.left,
+                      Wnd->rcWindow.top);
    }
 
    /*
@@ -477,7 +482,7 @@
       else
          MsqIncPaintCountQueue(Window->pti->MessageQueue);
    }
-
+   DPRINT1("IntInvalidateWindows exit\n");
 }
 
 /*
@@ -515,21 +520,23 @@
  */
 
 BOOL FASTCALL
-co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECTL* UpdateRect, HRGN UpdateRgn,
-                    ULONG Flags)
+co_UserRedrawWindow(
+   PWINDOW_OBJECT Window,
+   const RECTL* UpdateRect,
+   HRGN UpdateRgn,
+   ULONG Flags)
 {
    HRGN hRgn = NULL;
+   DPRINT1("co_UserRedrawWindow start\n");
 
    /*
     * Step 1.
     * Validation of passed parameters.
     */
 
-   if (!IntIsWindowDrawable(Window) ||
-         (Flags & (RDW_VALIDATE | RDW_INVALIDATE)) ==
-         (RDW_VALIDATE | RDW_INVALIDATE))
-   {
-      return FALSE;
+   if (!IntIsWindowDrawable(Window))
+   {
+      return TRUE; // Just do nothing!!!
    }
 
    /*
@@ -538,7 +545,7 @@
     * a region hRgn specified in screen coordinates.
     */
 
-   if (Flags & (RDW_INVALIDATE | RDW_VALIDATE))
+   if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) // Both are OKAY!
    {
       if (UpdateRgn != NULL)
       {
@@ -602,6 +609,7 @@
    {
       REGION_FreeRgnByHandle(hRgn);
    }
+   DPRINT1("co_UserRedrawWindow exit\n");
 
    return TRUE;
 }
@@ -660,8 +668,13 @@
 }
 
 BOOL FASTCALL
-IntGetPaintMessage(PWINDOW_OBJECT Window, UINT MsgFilterMin, UINT MsgFilterMax,
-                   PTHREADINFO Thread, MSG *Message, BOOL Remove)
+IntGetPaintMessage(
+   PWINDOW_OBJECT Window,
+   UINT MsgFilterMin,
+   UINT MsgFilterMax,
+   PTHREADINFO Thread,
+   MSG *Message,
+   BOOL Remove)
 {
    PUSER_MESSAGE_QUEUE MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue;
 
@@ -787,7 +800,9 @@
 
    RtlZeroMemory(&Ps, sizeof(PAINTSTRUCT));
 
-   Ps.hdc = UserGetDCEx(Window, Window->hrgnUpdate, DCX_INTERSECTRGN | DCX_USESTYLE);
+   Ps.hdc = UserGetDCEx( Window,
+                         Window->hrgnUpdate,
+                         DCX_INTERSECTRGN | DCX_USESTYLE);
    if (!Ps.hdc)
    {
       RETURN(NULL);
@@ -1060,16 +1075,20 @@
  */
 
 BOOL APIENTRY
-NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
-                   UINT flags)
+NtUserRedrawWindow(
+   HWND hWnd,
+   CONST RECT *lprcUpdate,
+   HRGN hrgnUpdate,
+   UINT flags)
 {
    RECTL SafeUpdateRect;
-   NTSTATUS Status;
    PWINDOW_OBJECT Wnd;
+   BOOL Ret;
+   USER_REFERENCE_ENTRY Ref;
+   NTSTATUS Status = STATUS_SUCCESS;
    DECLARE_RETURN(BOOL);
-   USER_REFERENCE_ENTRY Ref;
-
-   DPRINT("Enter NtUserRedrawWindow\n");
+
+   DPRINT1("Enter NtUserRedrawWindow\n");
    UserEnterExclusive();
 
    if (!(Wnd = UserGetWindowObject(hWnd ? hWnd : IntGetDesktopWindow())))
@@ -1077,44 +1096,61 @@
       RETURN( FALSE);
    }
 
-   if (lprcUpdate != NULL)
-   {
-      Status = MmCopyFromCaller(&SafeUpdateRect, lprcUpdate,
-                                sizeof(RECTL));
-
+   if (lprcUpdate)
+   {
+      _SEH2_TRY
+      {
+          ProbeForRead(lprcUpdate, sizeof(RECTL), 1);
+          RtlCopyMemory(&SafeUpdateRect, lprcUpdate, sizeof(RECTL));
+      }
+      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+      {
+         Status = _SEH2_GetExceptionCode();
+      }
+      _SEH2_END
       if (!NT_SUCCESS(Status))
       {
-         SetLastWin32Error(ERROR_INVALID_PARAMETER);
+         SetLastWin32Error(RtlNtStatusToDosError(Status));
          RETURN( FALSE);
       }
    }
 
+   if ( flags & ~(RDW_ERASE|RDW_FRAME|RDW_INTERNALPAINT|RDW_INVALIDATE|
+                  RDW_NOERASE|RDW_NOFRAME|RDW_NOINTERNALPAINT|RDW_VALIDATE|
+                  RDW_ERASENOW|RDW_UPDATENOW|RDW_ALLCHILDREN|RDW_NOCHILDREN) )
+   {
+      /* RedrawWindow fails only in case that flags are invalid */
+      SetLastWin32Error(ERROR_INVALID_FLAGS);
+      RETURN( FALSE);
+   }
+
    UserRefObjectCo(Wnd, &Ref);
 
-   Status = co_UserRedrawWindow(Wnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect,
-                                hrgnUpdate, flags);
+   Ret = co_UserRedrawWindow( Wnd,
+                              lprcUpdate ? &SafeUpdateRect : NULL,
+                              hrgnUpdate,
+                              flags);
 
    UserDerefObjectCo(Wnd);
 
-   if (!NT_SUCCESS(Status))
-   {
-      /* IntRedrawWindow fails only in case that flags are invalid */
-      SetLastWin32Error(ERROR_INVALID_PARAMETER);
-      RETURN( FALSE);
-   }
-
-   RETURN( TRUE);
+   RETURN( Ret);
 
 CLEANUP:
-   DPRINT("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
+   DPRINT1("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
    UserLeave();
    END_CLEANUP;
 }
 
 static
 INT FASTCALL
-UserScrollDC(HDC hDC, INT dx, INT dy, const RECTL *prcScroll,
-             const RECTL *prcClip, HRGN hrgnUpdate, RECTL *prcUpdate)
+UserScrollDC(
+   HDC hDC,
+   INT dx,
+   INT dy,
+   const RECTL *prcScroll,
+   const RECTL *prcClip,
+   HRGN hrgnUpdate,
+   RECTL *prcUpdate)
 {
    PDC pDC;
    RECTL rcScroll, rcClip, rcSrc, rcDst;
@@ -1141,9 +1177,17 @@
    RECTL_vOffsetRect(&rcDst, dx, dy);
    RECTL_bIntersectRect(&rcDst, &rcDst, &rcClip);
 
-   if (!NtGdiBitBlt(hDC, rcDst.left, rcDst.top,
-                    rcDst.right - rcDst.left, rcDst.bottom - rcDst.top,
-                    hDC, rcDst.left - dx, rcDst.top - dy, SRCCOPY, 0, 0))
+   if (!NtGdiBitBlt( hDC,
+                     rcDst.left,
+                     rcDst.top,
+                     rcDst.right - rcDst.left,
+                     rcDst.bottom - rcDst.top,
+                     hDC,
+                     rcDst.left - dx,
+                     rcDst.top - dy,
+                     SRCCOPY,
+                     0,
+                     0))
    {
       return ERROR;
    }
@@ -1159,7 +1203,7 @@
       {
          return FALSE;
       }
-      hrgnVisible = pDC->rosdc.hVisRgn;  // pDC->w.hGCClipRgn?
+      hrgnVisible = pDC->rosdc.hVisRgn;  // pDC->prgnRao?
       DC_UnlockDc(pDC);
 
       /* Begin with the shifted and then clipped scroll rect */
@@ -1539,7 +1583,8 @@
 }
 
 BOOL
-UserDrawCaptionText(HDC hDc,
+UserDrawCaptionText(
+   HDC hDc,
    const PUNICODE_STRING Text,
    const RECTL *lpRc,
    UINT uFlags)
@@ -1984,4 +2029,19 @@
     return NtUserRedrawWindow(hWnd, NULL, hRgn, RDW_INVALIDATE | (bErase? RDW_ERASE : 0));
 }
 
+/* ValidateRect gets redirected to NtUserValidateRect:
+   http://blog.csdn.net/ntdll/archive/2005/10/19/509299.aspx */
+BOOL
+APIENTRY
+NtUserValidateRect(
+    HWND hWnd,
+    const RECT *lpRect)
+{
+    if (hWnd)
+    {
+       return NtUserRedrawWindow(hWnd, lpRect, NULL, RDW_VALIDATE );
+    }
+    return NtUserRedrawWindow(hWnd, lpRect, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ERASENOW|RDW_ALLCHILDREN);
+}
+
 /* EOF */

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c?rev=45305&r1=45304&r2=45305&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Fri Jan 29 00:34:57 2010
@@ -903,8 +903,8 @@
    /*
     * Only allow CSRSS to mess with the desktop window
     */
-   if (Window->hSelf == IntGetDesktopWindow() &&
-         Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
+   if ( Window->hSelf == IntGetDesktopWindow() &&
+        Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
    {
       return FALSE;
    }
@@ -934,9 +934,9 @@
    }
 
    Ancestor = UserGetAncestor(Window, GA_PARENT);
-   if ((WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) !=
+   if ( (WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) !=
          SWP_NOZORDER &&
-         Ancestor && Ancestor->hSelf == IntGetDesktopWindow())
+         Ancestor && Ancestor->hSelf == IntGetDesktopWindow() )
    {
       WinPos.hwndInsertAfter = WinPosDoOwnedPopups(WinPos.hwnd, WinPos.hwndInsertAfter);
    }
@@ -945,15 +945,16 @@
    {
       /* Compute the visible region before the window position is changed */
       if (!(WinPos.flags & (SWP_NOREDRAW | SWP_SHOWWINDOW)) &&
-            (WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+           (WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
                              SWP_HIDEWINDOW | SWP_FRAMECHANGED)) !=
             (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER))
       {
          VisBefore = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE);
          VisRgn = NULL;
 
-         if (VisBefore != NULL && (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisBefore, NULL)) &&
-               REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION)
+         if ( VisBefore != NULL &&
+             (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisBefore, NULL)) &&
+              REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION )
          {
             RGNOBJAPI_Unlock(VisRgn);
             GreDeleteObject(VisBefore);
@@ -989,7 +990,8 @@
          {
             InsertAfterWindow = NULL;
             Sibling = ParentWindow->spwndChild;
-            while (NULL != Sibling && 0 != (Sibling->Wnd->ExStyle & WS_EX_TOPMOST))
+            while ( NULL != Sibling && 
+                    0 != (Sibling->Wnd->ExStyle & WS_EX_TOPMOST) )
             {
                InsertAfterWindow = Sibling;
                Sibling = Sibling->spwndNext;
@@ -1027,12 +1029,13 @@
          }
          if (InsertAfterWindow != NULL)
             UserDereferenceObject(InsertAfterWindow);
-         if ((HWND_TOPMOST == WinPos.hwndInsertAfter)
-               || (0 != (Window->Wnd->ExStyle & WS_EX_TOPMOST)
-                   && NULL != Window->spwndPrev
-                   && 0 != (Window->spwndPrev->Wnd->ExStyle & WS_EX_TOPMOST))
-               || (NULL != Window->spwndNext
-                   && 0 != (Window->spwndNext->Wnd->ExStyle & WS_EX_TOPMOST)))
+
+         if ( (HWND_TOPMOST == WinPos.hwndInsertAfter) || 
+              (0 != (Window->Wnd->ExStyle & WS_EX_TOPMOST) &&
+              NULL != Window->spwndPrev &&
+              0 != (Window->spwndPrev->Wnd->ExStyle & WS_EX_TOPMOST)) ||
+              (NULL != Window->spwndNext &&
+               0 != (Window->spwndNext->Wnd->ExStyle & WS_EX_TOPMOST)) )
          {
             Window->Wnd->ExStyle |= WS_EX_TOPMOST;
          }
@@ -1063,8 +1066,8 @@
 
    /* FIXME: Actually do something with WVR_VALIDRECTS */
 
-   if (NewClientRect.left != OldClientRect.left ||
-         NewClientRect.top != OldClientRect.top)
+   if ( NewClientRect.left != OldClientRect.left ||
+        NewClientRect.top  != OldClientRect.top)
    {
       WinPosInternalMoveWindow(Window,
                                NewClientRect.left - OldClientRect.left,
@@ -1077,8 +1080,11 @@
    if (!(WinPos.flags & SWP_SHOWWINDOW) && (WinPos.flags & SWP_HIDEWINDOW))
    {
       /* Clear the update region */
-      co_UserRedrawWindow(Window, NULL, 0, RDW_VALIDATE | RDW_NOFRAME |
-                          RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN);
+      co_UserRedrawWindow( Window,
+                           NULL,
+                           0,
+                           RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN);
+
       if ((Window->Wnd->style & WS_VISIBLE) &&
           Window->spwndParent == UserGetDesktopWindow())
       {
@@ -1089,7 +1095,7 @@
    else if (WinPos.flags & SWP_SHOWWINDOW)
    {
       if (!(Window->Wnd->style & WS_VISIBLE) &&
-          Window->spwndParent == UserGetDesktopWindow())
+           Window->spwndParent == UserGetDesktopWindow() )
       {
          co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf);
       }
@@ -1111,8 +1117,9 @@
       VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE);
       VisRgn = NULL;
 
-      if (VisAfter != NULL && (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisAfter, NULL)) &&
-            REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION)
+      if ( VisAfter != NULL &&
+          (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisAfter, NULL)) &&
+           REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION )
       {
          RGNOBJAPI_Unlock(VisRgn);
          GreDeleteObject(VisAfter);
@@ -1131,9 +1138,11 @@
        * class need to be completely repainted on (horizontal/vertical) size
        * change.
        */
-      if (VisBefore != NULL && VisAfter != NULL && !(WinPos.flags & SWP_NOCOPYBITS) &&
+      if ( VisBefore != NULL &&
+           VisAfter != NULL &&
+          !(WinPos.flags & SWP_NOCOPYBITS) &&
           ((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) &&
-          !(Window->Wnd->ExStyle & WS_EX_TRANSPARENT))
+          !(Window->Wnd->ExStyle & WS_EX_TRANSPARENT) )
       {
          CopyRgn = IntSysCreateRectRgn(0, 0, 0, 0);
          RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
@@ -1146,8 +1155,9 @@
           * we don't have to crop (can't take anything away from an empty
           * region...)
           */
-         if (!(WinPos.flags & SWP_NOSIZE) && RgnType != ERROR &&
-               RgnType != NULLREGION)
+         if (!(WinPos.flags & SWP_NOSIZE) &&
+               RgnType != ERROR &&
+               RgnType != NULLREGION )
          {
             PROSRGNDATA pCopyRgn;
             RECTL ORect = OldClientRect;
@@ -1173,7 +1183,7 @@
           * there's nothing to copy. Also, it's no use copying bits onto
           * themselves.
           */
-         if ((VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(CopyRgn, NULL)) &&
+         if ( (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(CopyRgn, NULL)) &&
                REGION_GetRgnBox(VisRgn, &CopyRect) == NULLREGION)
          {
             /* Nothing to copy, clean up */
@@ -1189,24 +1199,30 @@
                RGNOBJAPI_Unlock(VisRgn);
             }
 
-            /*
-             * Small trick here: there is no function to bitblt a region. So
-             * we set the region as the clipping region, take the bounding box
-             * of the region and bitblt that. Since nothing outside the clipping
-             * region is copied, this has the effect of bitblt'ing the region.
-             *
-             * Since NtUserGetDCEx takes ownership of the clip region, we need
-             * to create a copy of CopyRgn and pass that. We need CopyRgn later
-             */
+          /*
+           * Small trick here: there is no function to bitblt a region. So
+           * we set the region as the clipping region, take the bounding box
+           * of the region and bitblt that. Since nothing outside the clipping
+           * region is copied, this has the effect of bitblt'ing the region.
+           *
+           * Since NtUserGetDCEx takes ownership of the clip region, we need
+           * to create a copy of CopyRgn and pass that. We need CopyRgn later
+           */
             NtGdiOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
-            Dc = UserGetDCEx(Window, CopyRgn, DCX_WINDOW | DCX_CACHE |
-                             DCX_INTERSECTRGN | DCX_CLIPSIBLINGS |
-                             DCX_KEEPCLIPRGN);
-            NtGdiBitBlt(Dc,
-                        CopyRect.left, CopyRect.top, CopyRect.right - CopyRect.left,
-                        CopyRect.bottom - CopyRect.top, Dc,
-                        CopyRect.left + (OldWindowRect.left - NewWindowRect.left),
-                        CopyRect.top + (OldWindowRect.top - NewWindowRect.top), SRCCOPY, 0, 0);
+            Dc = UserGetDCEx( Window,
+                              CopyRgn,
+                              DCX_WINDOW|DCX_CACHE|DCX_INTERSECTRGN|DCX_CLIPSIBLINGS|DCX_KEEPCLIPRGN);
+            NtGdiBitBlt( Dc,
+                         CopyRect.left, CopyRect.top,
+                         CopyRect.right - CopyRect.left,
+                         CopyRect.bottom - CopyRect.top,
+                         Dc,
+                         CopyRect.left + (OldWindowRect.left - NewWindowRect.left),
+                         CopyRect.top + (OldWindowRect.top - NewWindowRect.top),
+                         SRCCOPY,
+                         0,
+                         0);
+
             UserReleaseDC(Window, Dc, FALSE);
             IntValidateParent(Window, CopyRgn, FALSE);
             NtGdiOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
@@ -1235,9 +1251,10 @@
          }
          if (RgnType != ERROR && RgnType != NULLREGION)
          {
-                      /* old code
+        /* old code
             NtGdiOffsetRgn(DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
-            IntInvalidateWindows(Window, DirtyRgn,
+            IntInvalidateWindows( Window,
+                                  DirtyRgn,
                RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
          }
          GreDeleteObject(DirtyRgn);
@@ -1245,21 +1262,23 @@
 
             PWINDOW_OBJECT Parent = Window->spwndParent;
 
-            NtGdiOffsetRgn(DirtyRgn,
-                           Window->Wnd->rcWindow.left,
-                           Window->Wnd->rcWindow.top);
-            if ((Window->Wnd->style & WS_CHILD) &&
-                (Parent) &&
+            NtGdiOffsetRgn( DirtyRgn,
+                            Window->Wnd->rcWindow.left,
+                            Window->Wnd->rcWindow.top);
+            if ( (Window->Wnd->style & WS_CHILD) &&
+                 (Parent) &&
                 !(Parent->Wnd->style & WS_CLIPCHILDREN))
             {
-               IntInvalidateWindows(Parent, DirtyRgn,
-                  RDW_ERASE | RDW_INVALIDATE);
+               IntInvalidateWindows( Parent,
+                                     DirtyRgn,
+                                     RDW_ERASE | RDW_INVALIDATE);
                co_IntPaintWindows(Parent, RDW_ERASENOW, FALSE);
             }
             else
             {
-                IntInvalidateWindows(Window, DirtyRgn,
-                RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
+                IntInvalidateWindows( Window,
+                                      DirtyRgn,
+                    RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
             }
          }
          REGION_FreeRgnByHandle(DirtyRgn);
@@ -1275,8 +1294,10 @@
       {
          ExposedRgn = IntSysCreateRectRgn(0, 0, 0, 0);
          NtGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY);
-         NtGdiOffsetRgn(ExposedRgn, OldWindowRect.left - NewWindowRect.left,
-                        OldWindowRect.top - NewWindowRect.top);
+         NtGdiOffsetRgn( ExposedRgn,
+                         OldWindowRect.left - NewWindowRect.left,
+                         OldWindowRect.top  - NewWindowRect.top);
+
          if (VisAfter != NULL)
             RgnType = NtGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
          else




More information about the Ros-diffs mailing list