Do not activate an MDI child if the child is invisible

Dmitry Timoshkov dmitry at baikal.ru
Tue May 25 05:45:19 CDT 2004


Hello,

this patch fixes a crash in the application I'm working on.

The scenario is the following:

/* create a not visible mdi child */
mdi = CreateMDIWindow(WS_CHILD);
/* create a child of the mdi child */
child = CreateWindow(WS_CHILD, mdi);
ShowWindow(child, SW_SHOW);
SetFocus(child);
ShowWindow(child, SW_HIDE);

This causes focus to be reverted to child's parent - mdi child, which
in turn by default activates itself on WM_SETFOCUS.

An app is just not ready for an invisible MDI child activation.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Do not activate an MDI child if the child is invisible.

--- cvs/hq/wine/windows/mdi.c	Sat May  1 18:19:11 2004
+++ wine/windows/mdi.c	Tue May 25 19:07:40 2004
@@ -1469,7 +1469,8 @@ LRESULT WINAPI DefMDIChildProcW( HWND hw
         return 0;
 
     case WM_SETFOCUS:
-        if (ci->hwndActiveChild != hwnd) MDI_ChildActivate( client, hwnd );
+        if (ci->hwndActiveChild != hwnd && IsWindowVisible(hwnd))
+            MDI_ChildActivate( client, hwnd );
         break;
 
     case WM_CHILDACTIVATE:






More information about the wine-patches mailing list