From 12f49fb9b17b8e64241b5c281bcfcf87274e13fe Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 6 Dec 2004 16:38:19 +0000 Subject: [PATCH] ShowWindow activates only a being maximized child window, add a couple of message tests for MDI child activation. --- dlls/user/tests/msg.c | 41 +++++++++++++++++++++++++++++++++++++++++ dlls/x11drv/winpos.c | 11 ++++++----- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/dlls/user/tests/msg.c b/dlls/user/tests/msg.c index ede284eef5..3aee6c22bb 100644 --- a/dlls/user/tests/msg.c +++ b/dlls/user/tests/msg.c @@ -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, diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c index 21b82d9ead..b0dac93d7d 100644 --- a/dlls/x11drv/winpos.c +++ b/dlls/x11drv/winpos.c @@ -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, -- 2.33.8