Alexandre Julliard : user32: SetWindowPos should erase the parent also for child moves.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 27 13:57:12 CDT 2007


Module: wine
Branch: master
Commit: a887a64c17ba7a2a80a67a31f7623474c62e9830
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a887a64c17ba7a2a80a67a31f7623474c62e9830

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 27 15:13:51 2007 +0200

user32: SetWindowPos should erase the parent also for child moves.

---

 dlls/user32/tests/msg.c |    3 +++
 dlls/user32/winpos.c    |   22 +++++++++-------------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 502cefc..e6443e6 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -941,6 +941,7 @@ static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */
 static const struct message WmResizingChildWithMoveWindowSeq[] = {
     { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
     { WM_NCCALCSIZE, sent|wparam, 1 },
+    { WM_ERASEBKGND, sent|parent|optional },
     { WM_ERASEBKGND, sent|optional },
     { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE },
     { WM_MOVE, sent|defwinproc },
@@ -4020,8 +4021,10 @@ static void test_messages(void)
     /* test WM_SETREDRAW on a visible child window */
     test_WM_SETREDRAW(hchild);
 
+    log_all_parent_messages++;
     MoveWindow(hchild, 10, 10, 20, 20, TRUE);
     ok_sequence(WmResizingChildWithMoveWindowSeq, "MoveWindow:child", FALSE);
+    log_all_parent_messages--;
 
     ShowWindow(hchild, SW_HIDE);
     flush_sequence();
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index a13753c..8878c67 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1604,19 +1604,15 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos )
                             &newWindowRect, &newClientRect, orig_flags, valid_rects ))
         return FALSE;
 
-    /* erase parent if hiding child */
-    if (!(orig_flags & SWP_DEFERERASE))
-    {
-        if (orig_flags & SWP_HIDEWINDOW)
-        {
-            HWND parent = GetAncestor( winpos->hwnd, GA_PARENT );
-            erase_now( parent, RDW_NOCHILDREN );
-        }
-        else if (!(orig_flags & SWP_SHOWWINDOW) &&
-                 (winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOGEOMETRYCHANGE)
-        {
-            erase_now( winpos->hwnd, 0 );
-        }
+    /* erase parent when hiding or resizing child */
+    if (!(orig_flags & SWP_DEFERERASE) &&
+        ((orig_flags & SWP_HIDEWINDOW) ||
+         (!(orig_flags & SWP_SHOWWINDOW) &&
+          (winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOGEOMETRYCHANGE)))
+    {
+        HWND parent = GetAncestor( winpos->hwnd, GA_PARENT );
+        if (!parent || parent == GetDesktopWindow()) parent = winpos->hwnd;
+        erase_now( parent, 0 );
     }
 
     if( winpos->flags & SWP_HIDEWINDOW )




More information about the wine-cvs mailing list