diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 502cefc53d5..e6443e6e044 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 a13753c7461..8878c67a1c8 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)) + /* 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))) { - 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 ); - } + HWND parent = GetAncestor( winpos->hwnd, GA_PARENT ); + if (!parent || parent == GetDesktopWindow()) parent = winpos->hwnd; + erase_now( parent, 0 ); } if( winpos->flags & SWP_HIDEWINDOW )