Jacek Caban : user32: Ignore WM_CHILDACTIVATE on disabled windows in DefMDIChildProc.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Feb 26 10:26:46 CST 2016
Module: wine
Branch: master
Commit: aa5762d5c20a6f1281b9018813169a67c79896b2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aa5762d5c20a6f1281b9018813169a67c79896b2
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Feb 24 12:35:34 2016 +0100
user32: Ignore WM_CHILDACTIVATE on disabled windows in DefMDIChildProc.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/mdi.c | 3 ++-
dlls/user32/tests/msg.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
dlls/user32/tests/win.c | 6 -----
3 files changed, 68 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index b360528..bda2b00 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -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:
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index cc92acf..bd02c89 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -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",
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 988aa6c..4a09e39 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -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");
More information about the wine-cvs
mailing list