From 5ae51c47ddccd521f620ea30b3298c1243bf4c01 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 21 Jan 2005 17:06:07 +0000 Subject: [PATCH] Tweak SetWindowPos flags handling to make a few more of the messaging tests pass. --- dlls/user/tests/msg.c | 4 ++-- dlls/x11drv/winpos.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dlls/user/tests/msg.c b/dlls/user/tests/msg.c index afd92c57fa9..5c286013c8f 100644 --- a/dlls/user/tests/msg.c +++ b/dlls/user/tests/msg.c @@ -2878,12 +2878,12 @@ static void test_messages(void) ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n"); SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); - ok_sequence(WmShowChildInvisibleParentSeq_2, "SetWindowPos:show child with invisible parent", TRUE); + ok_sequence(WmShowChildInvisibleParentSeq_2, "SetWindowPos:show child with invisible parent", FALSE); ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n"); SetWindowPos(hchild, 0,0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); - ok_sequence(WmHideChildInvisibleParentSeq_2, "SetWindowPos:hide child with invisible parent", TRUE); + ok_sequence(WmHideChildInvisibleParentSeq_2, "SetWindowPos:hide child with invisible parent", FALSE); ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should not be set\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n"); diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c index 2a0a51cfd52..cad383700e2 100644 --- a/dlls/x11drv/winpos.c +++ b/dlls/x11drv/winpos.c @@ -521,6 +521,7 @@ static HWND SWP_DoOwnedPopups(HWND hwnd, HWND hwndInsertAfter) /* fix redundant flags and values in the WINDOWPOS structure */ static BOOL fixup_flags( WINDOWPOS *winpos ) { + HWND parent; WND *wndPtr = WIN_GetPtr( winpos->hwnd ); BOOL ret = TRUE; @@ -542,6 +543,9 @@ static BOOL fixup_flags( WINDOWPOS *winpos ) if (winpos->cy < 0) winpos->cy = 0; else if (winpos->cy > 32767) winpos->cy = 32767; + parent = GetAncestor( winpos->hwnd, GA_PARENT ); + if (!IsWindowVisible( parent )) winpos->flags |= SWP_NOREDRAW; + if (wndPtr->dwStyle & WS_VISIBLE) winpos->flags &= ~SWP_SHOWWINDOW; else { @@ -558,7 +562,7 @@ static BOOL fixup_flags( WINDOWPOS *winpos ) if ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD) { - if (!(winpos->flags & SWP_NOACTIVATE)) /* Bring to the top when activating */ + if (!(winpos->flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW))) /* Bring to the top when activating */ { winpos->flags &= ~SWP_NOZORDER; winpos->hwndInsertAfter = HWND_TOP; @@ -589,7 +593,7 @@ static BOOL fixup_flags( WINDOWPOS *winpos ) } else { - if (GetAncestor( winpos->hwndInsertAfter, GA_PARENT ) != wndPtr->parent) ret = FALSE; + if (GetAncestor( winpos->hwndInsertAfter, GA_PARENT ) != parent) ret = FALSE; else { /* don't need to change the Zorder of hwnd if it's already inserted @@ -860,7 +864,7 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos ) else if (winpos->flags & SWP_SHOWWINDOW) ShowCaret(winpos->hwnd); - if (!(winpos->flags & SWP_NOACTIVATE)) + if (!(winpos->flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW))) { /* child windows get WM_CHILDACTIVATE message */ if ((GetWindowLongW( winpos->hwnd, GWL_STYLE ) & (WS_CHILD | WS_POPUP)) == WS_CHILD) @@ -1071,8 +1075,7 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd ) { case SW_HIDE: if (!wasVisible) goto END; - swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | - SWP_NOACTIVATE | SWP_NOZORDER; + swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER; break; case SW_SHOWMINNOACTIVE: -- 2.11.4.GIT