Commit 68b8a4ab authored by Alexandre Julliard's avatar Alexandre Julliard

Don't call SetWindowPos in ShowWindow if a parent window is not

visible, only toggle the WS_VISIBLE flag.
parent 86b67492
...@@ -543,6 +543,15 @@ static const struct message WmDestroyChildSeq[] = { ...@@ -543,6 +543,15 @@ static const struct message WmDestroyChildSeq[] = {
{ WM_NCDESTROY, sent }, { WM_NCDESTROY, sent },
{ 0 } { 0 }
}; };
/* DestroyWindow for a visible child window with invisible parent */
static const struct message WmDestroyInvisibleChildSeq[] = {
{ HCBT_DESTROYWND, hook },
{ WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
{ WM_SHOWWINDOW, sent|wparam, 0 },
{ WM_DESTROY, sent },
{ WM_NCDESTROY, sent },
{ 0 }
};
/* Moving the mouse in nonclient area */ /* Moving the mouse in nonclient area */
static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */ static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */
{ WM_NCHITTEST, sent }, { WM_NCHITTEST, sent },
...@@ -2855,14 +2864,14 @@ static void test_showwindow(void) ...@@ -2855,14 +2864,14 @@ static void test_showwindow(void)
/* ShowWindow(SW_SHOWNA) with child and parent invisible */ /* ShowWindow(SW_SHOWNA) with child and parent invisible */
trace("calling ShowWindow( SW_SHOWNA) for invisible child with invisible parent\n"); trace("calling ShowWindow( SW_SHOWNA) for invisible child with invisible parent\n");
ok( ShowWindow(hchild, SW_SHOWNA) == FALSE, "ShowWindow: window was visible\n" ); ok( ShowWindow(hchild, SW_SHOWNA) == FALSE, "ShowWindow: window was visible\n" );
ok_sequence(WmSHOWNAChildInvisParInvis, "ShowWindow(SW_SHOWNA) invisible child and parent", TRUE); ok_sequence(WmSHOWNAChildInvisParInvis, "ShowWindow(SW_SHOWNA) invisible child and parent", FALSE);
trace("done\n"); trace("done\n");
/* ShowWindow(SW_SHOWNA) with child visible and parent invisible */ /* ShowWindow(SW_SHOWNA) with child visible and parent invisible */
ok( ShowWindow(hchild, SW_SHOW) != FALSE, "ShowWindow: window was invisible\n" ); ok( ShowWindow(hchild, SW_SHOW) != FALSE, "ShowWindow: window was invisible\n" );
flush_sequence(); flush_sequence();
trace("calling ShowWindow( SW_SHOWNA) for the visible child and invisible parent\n"); trace("calling ShowWindow( SW_SHOWNA) for the visible child and invisible parent\n");
ok( ShowWindow(hchild, SW_SHOWNA) != FALSE, "ShowWindow: window was invisible\n" ); ok( ShowWindow(hchild, SW_SHOWNA) != FALSE, "ShowWindow: window was invisible\n" );
ok_sequence(WmSHOWNAChildVisParInvis, "ShowWindow(SW_SHOWNA) visible child and invisible parent", TRUE); ok_sequence(WmSHOWNAChildVisParInvis, "ShowWindow(SW_SHOWNA) visible child and invisible parent", FALSE);
trace("done\n"); trace("done\n");
/* ShowWindow(SW_SHOWNA) with child visible and parent visible */ /* ShowWindow(SW_SHOWNA) with child visible and parent visible */
ShowWindow( hwnd, SW_SHOW); ShowWindow( hwnd, SW_SHOW);
...@@ -3176,12 +3185,12 @@ static void test_messages(void) ...@@ -3176,12 +3185,12 @@ static void test_messages(void)
ok_sequence(WmCreateChildSeq, "CreateWindow:child", FALSE); ok_sequence(WmCreateChildSeq, "CreateWindow:child", FALSE);
ShowWindow( hchild, SW_SHOW ); ShowWindow( hchild, SW_SHOW );
ok_sequence(WmShowChildInvisibleParentSeq, "ShowWindow:show child with invisible parent", TRUE); ok_sequence(WmShowChildInvisibleParentSeq, "ShowWindow:show child with invisible parent", FALSE);
ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n");
ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n");
ShowWindow( hchild, SW_HIDE ); ShowWindow( hchild, SW_HIDE );
ok_sequence(WmHideChildInvisibleParentSeq, "ShowWindow:hide child with invisible parent", TRUE); ok_sequence(WmHideChildInvisibleParentSeq, "ShowWindow:hide child with invisible parent", FALSE);
ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should be not set\n"); ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should be not set\n");
ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n");
...@@ -3195,7 +3204,11 @@ static void test_messages(void) ...@@ -3195,7 +3204,11 @@ static void test_messages(void)
ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should not be set\n"); ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should not be set\n");
ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n"); 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);
flush_sequence();
DestroyWindow(hchild); DestroyWindow(hchild);
ok_sequence(WmDestroyInvisibleChildSeq, "DestroyInvisibleChildSeq", FALSE);
DestroyWindow(hparent); DestroyWindow(hparent);
flush_sequence(); flush_sequence();
......
...@@ -1003,12 +1003,22 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd ) ...@@ -1003,12 +1003,22 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
if (!IsWindow( hwnd )) return wasVisible; if (!IsWindow( hwnd )) return wasVisible;
} }
/* ShowWindow won't activate a not being maximized child window */ if (!IsWindowVisible( GetAncestor( hwnd, GA_PARENT )))
if ((style & WS_CHILD) && cmd != SW_MAXIMIZE) {
swp |= SWP_NOACTIVATE | SWP_NOZORDER; /* if parent is not visible simply toggle WS_VISIBLE and return */
if (showFlag) WIN_SetStyle( hwnd, WS_VISIBLE, 0 );
else WIN_SetStyle( hwnd, 0, WS_VISIBLE );
}
else
{
/* ShowWindow won't activate a not being maximized child window */
if ((style & WS_CHILD) && cmd != SW_MAXIMIZE)
swp |= SWP_NOACTIVATE | SWP_NOZORDER;
SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top,
newPos.right, newPos.bottom, LOWORD(swp) );
}
SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top,
newPos.right, newPos.bottom, LOWORD(swp) );
if (cmd == SW_HIDE) if (cmd == SW_HIDE)
{ {
HWND hFocus; HWND hFocus;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment