user32: Ignore WM_CHILDACTIVATE on disabled windows in DefMDIChildProc.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-02-24 12:35:34 +01:00 committed by Alexandre Julliard
parent 142133ae6c
commit aa5762d5c2
3 changed files with 68 additions and 7 deletions

View File

@ -1485,7 +1485,8 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message,
break;
case WM_CHILDACTIVATE:
MDI_ChildActivate( client, hwnd );
if (IsWindowEnabled( hwnd ))
MDI_ChildActivate( client, hwnd );
return 0;
case WM_SYSCOMMAND:

View File

@ -2343,6 +2343,28 @@ static const struct message WmCreateMDIchildVisibleSeq[] = {
{ WM_MDIACTIVATE, sent|defwinproc },
{ 0 }
};
/* WM_CHILDACTIVATE sent to disabled window */
static const struct message WmChildActivateDisabledWindowSeq[] = {
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
{ 0 }
};
/* WM_CHILDACTIVATE sent to enabled window */
static const struct message WmChildActivateWindowSeq[] = {
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
{ WM_NCACTIVATE, sent|wparam|defwinproc, 0 },
{ WM_MDIACTIVATE, sent|defwinproc },
{ WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
{ WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
{ HCBT_SETFOCUS, hook },
{ WM_KILLFOCUS, sent|defwinproc },
{ WM_SETFOCUS, sent },
{ HCBT_SETFOCUS, hook },
{ WM_KILLFOCUS, sent },
{ WM_SETFOCUS, sent|defwinproc },
{ WM_MDIACTIVATE, sent|defwinproc },
{ 0 }
};
/* CreateWindow for MDI child window with invisible parent */
static const struct message WmCreateMDIchildInvisibleParentSeq[] = {
{ HCBT_CREATEWND, hook },
@ -3618,6 +3640,50 @@ static void test_mdi_messages(void)
ok(GetActiveWindow() == mdi_frame, "wrong active window %p\n", GetActiveWindow());
ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
trace("Testing WM_CHILDACTIVATE\n");
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child",
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_DISABLED,
0, 0, CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandleA(0), NULL);
mdi_child2 = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child",
WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX,
0, 0, CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandleA(0), NULL);
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(active_child == mdi_child2, "wrong active MDI child %p\n", active_child);
ok(!zoomed, "wrong zoomed state %d\n", zoomed);
flush_sequence();
SendMessageW(mdi_child, WM_CHILDACTIVATE, 0, 0);
ok_sequence(WmChildActivateDisabledWindowSeq, "WM_CHILDACTIVATE sent to disabled window", FALSE);
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(active_child == mdi_child2, "wrong active MDI child %p\n", active_child);
ok(!zoomed, "wrong zoomed state %d\n", zoomed);
flush_sequence();
EnableWindow(mdi_child, TRUE);
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(active_child == mdi_child2, "wrong active MDI child %p\n", active_child);
ok(!zoomed, "wrong zoomed state %d\n", zoomed);
flush_sequence();
SendMessageW(mdi_child, WM_CHILDACTIVATE, 0, 0);
ok_sequence(WmChildActivateWindowSeq, "WM_CHILDACTIVATE sent to enabled window", FALSE);
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(active_child == mdi_child, "wrong active MDI child %p\n", active_child);
ok(!zoomed, "wrong zoomed state %d\n", zoomed);
flush_sequence();
DestroyWindow(mdi_child);
DestroyWindow(mdi_child2);
flush_sequence();
/* test for maximized MDI children */
trace("creating maximized visible MDI child window 1\n");
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child",

View File

@ -1411,7 +1411,6 @@ static void test_MDI_create(HWND parent, HWND mdi_client, INT_PTR first_id)
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
ok(id == first_id, "wrong child id %ld\n", id);
hwnd = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
todo_wine
ok(!hwnd, "WM_MDIGETACTIVE should return 0, got %p\n", hwnd);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "WM_MDIDESTROY failed\n");
@ -1428,7 +1427,6 @@ todo_wine
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
ok(id == first_id, "wrong child id %ld\n", id);
hwnd = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
todo_wine
ok(!hwnd, "WM_MDIGETACTIVE should return 0, got %p\n", hwnd);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "WM_MDIDESTROY failed\n");
@ -1484,7 +1482,6 @@ todo_wine
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
ok(id == first_id, "wrong child id %ld\n", id);
hwnd = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
todo_wine
ok(!hwnd, "WM_MDIGETACTIVE should return 0, got %p\n", hwnd);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "WM_MDIDESTROY failed\n");
@ -1505,7 +1502,6 @@ todo_wine
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
ok(id == first_id, "wrong child id %ld\n", id);
hwnd = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
todo_wine
ok(!hwnd, "WM_MDIGETACTIVE should return 0, got %p\n", hwnd);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "WM_MDIDESTROY failed\n");
@ -1562,7 +1558,6 @@ todo_wine
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
ok(id == first_id, "wrong child id %ld\n", id);
hwnd = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
todo_wine
ok(!hwnd, "WM_MDIGETACTIVE should return 0, got %p\n", hwnd);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "WM_MDIDESTROY failed\n");
@ -1583,7 +1578,6 @@ todo_wine
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
ok(id == first_id, "wrong child id %ld\n", id);
hwnd = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
todo_wine
ok(!hwnd, "WM_MDIGETACTIVE should return 0, got %p\n", hwnd);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "WM_MDIDESTROY failed\n");