If there no MDI child to activate set hwndActiveChild to 0 in WM_MDIDESTROY hander
Dmitry Timoshkov
dmitry at baikal.ru
Fri Oct 1 09:34:24 CDT 2004
Hello,
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
If there no MDI child to activate set hwndActiveChild to 0
in WM_MDIDESTROY hander, add a test case.
diff -u cvs/hq/wine/dlls/user/tests/msg.c wine/dlls/user/tests/msg.c
--- cvs/hq/wine/dlls/user/tests/msg.c 2004-09-22 16:49:01.000000000 +0900
+++ wine/dlls/user/tests/msg.c 2004-10-01 23:16:44.000000000 +0900
@@ -1522,6 +1522,7 @@ static BOOL mdi_RegisterWindowClasses(vo
static void test_mdi_messages(void)
{
+ MDICREATESTRUCTA mdi_cs;
CLIENTCREATESTRUCT client_cs;
HWND mdi_frame, mdi_child, mdi_child2, active_child;
BOOL zoomed;
@@ -1807,6 +1808,29 @@ static void test_mdi_messages(void)
flush_sequence();
/* end of test for maximized MDI children */
+ mdi_cs.szClass = "MDI_child_Class";
+ mdi_cs.szTitle = "MDI child";
+ mdi_cs.hOwner = GetModuleHandleA(0);
+ mdi_cs.x = CW_USEDEFAULT;
+ mdi_cs.y = CW_USEDEFAULT;
+ mdi_cs.cx = CW_USEDEFAULT;
+ mdi_cs.cy = CW_USEDEFAULT;
+ mdi_cs.style = WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX;
+ mdi_cs.lParam = 0;
+ mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs);
+ ok(mdi_child != 0, "MDI child creation failed\n");
+
+ active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
+ ok(active_child == mdi_child, "wrong active MDI child %p\n", active_child);
+
+ SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
+ ok(!IsWindow(mdi_child), "MDI child should be destroyed\n");
+ active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
+ ok(!active_child, "wrong active MDI child %p\n", active_child);
+
+ SetFocus(0);
+ flush_sequence();
+
DestroyWindow(mdi_client);
ok_sequence(WmDestroyMDIclientSeq, "Destroy MDI client window", FALSE);
diff -u cvs/hq/wine/windows/mdi.c wine/windows/mdi.c
--- cvs/hq/wine/windows/mdi.c 2004-09-23 20:12:00.000000000 +0900
+++ wine/windows/mdi.c 2004-10-01 23:24:04.000000000 +0900
@@ -525,7 +525,10 @@ static LRESULT MDIDestroyChild( HWND par
if( child == ci->hwndActiveChild )
{
HWND next = MDI_GetWindow(ci, child, TRUE, 0);
- MDI_SwitchActiveChild(ci, next);
+ if (next)
+ MDI_SwitchActiveChild(ci, next);
+ else
+ ci->hwndActiveChild = 0; /* nothing to activate */
}
for (i = 0; i < ci->nActiveChildren; i++)
More information about the wine-patches
mailing list