ShowWindow activates only a being maximized child window, add a couple

of message tests for MDI child activation.
This commit is contained in:
Dmitry Timoshkov 2004-12-06 16:38:19 +00:00 committed by Alexandre Julliard
parent 193c83f646
commit 12f49fb9b1
2 changed files with 47 additions and 5 deletions

View File

@ -1778,6 +1778,47 @@ static void test_mdi_messages(void)
SetFocus(0);
flush_sequence();
trace("creating invisible MDI child window\n");
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child",
WS_CHILD,
0, 0, CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandleA(0), NULL);
assert(mdi_child);
flush_sequence();
ShowWindow(mdi_child, SW_SHOWNORMAL);
ok_sequence(WmShowChildSeq, "ShowWindow(SW_SHOWNORMAL) MDI child window", FALSE);
ok(GetWindowLongA(mdi_child, GWL_STYLE) & WS_VISIBLE, "MDI child should be visible\n");
ok(IsWindowVisible(mdi_child), "MDI child should be visible\n");
ok(GetActiveWindow() == mdi_frame, "wrong active window %p\n", GetActiveWindow());
ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(!active_child, "wrong active MDI child %p\n", active_child);
ok(!zoomed, "wrong zoomed state %d\n", zoomed);
ShowWindow(mdi_child, SW_HIDE);
ok_sequence(WmHideChildSeq, "ShowWindow(SW_HIDE) MDI child window", FALSE);
flush_sequence();
ShowWindow(mdi_child, SW_SHOW);
ok_sequence(WmShowChildSeq, "ShowWindow(SW_SHOW) MDI child window", FALSE);
ok(GetWindowLongA(mdi_child, GWL_STYLE) & WS_VISIBLE, "MDI child should be visible\n");
ok(IsWindowVisible(mdi_child), "MDI child should be visible\n");
ok(GetActiveWindow() == mdi_frame, "wrong active window %p\n", GetActiveWindow());
ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(!active_child, "wrong active MDI child %p\n", active_child);
ok(!zoomed, "wrong zoomed state %d\n", zoomed);
DestroyWindow(mdi_child);
flush_sequence();
trace("creating visible MDI child window\n");
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child",
WS_CHILD | WS_VISIBLE,

View File

@ -1288,13 +1288,15 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
break;
case SW_RESTORE:
swp |= SWP_FRAMECHANGED;
/* fall through */
case SW_SHOWNOACTIVATE:
swp |= SWP_NOACTIVATE | SWP_NOZORDER;
/* fall through */
case SW_SHOWNORMAL: /* same as SW_NORMAL: */
case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
case SW_RESTORE:
swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
swp |= SWP_SHOWWINDOW;
if( wndPtr->dwStyle & (WS_MINIMIZE | WS_MAXIMIZE) )
swp |= WINPOS_MinMaximize( hwnd, SW_RESTORE, &newPos );
@ -1309,9 +1311,8 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
if (!IsWindow( hwnd )) goto END;
}
/* We can't activate a child window */
if ((wndPtr->dwStyle & WS_CHILD) &&
!(wndPtr->dwExStyle & WS_EX_MDICHILD))
/* ShowWindow won't activate a not being maximized child window */
if ((wndPtr->dwStyle & WS_CHILD) && cmd != SW_MAXIMIZE)
swp |= SWP_NOACTIVATE | SWP_NOZORDER;
SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top,