If an MDI child becomes visible restore previously maximized MDI child

Dmitry Timoshkov dmitry at baikal.ru
Mon Feb 28 09:05:15 CST 2005


Hello,

The app I'm working on creates a maximized MDI child. Then creates another
not yet visible MDI child, and does ShowWindow(SW_SHOW) on it. The state of
the 1st MDI child remains maximized, but the 2nd MDI child becomes an active
one. If I click on the 1st MDI child the app simply crashes.

This patch is a pure guess work, but it appears to be a reasonable enough.
This might obsolete CreateWindowEx code which restores an old maximized
MDI child.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    If an MDI child becomes visible restore previously maximized MDI child.

--- cvs/hq/wine/windows/mdi.c	2005-02-17 15:32:40.000000000 +0800
+++ wine/windows/mdi.c	2005-02-28 22:46:23.000000000 +0800
@@ -1199,7 +1199,7 @@ static LRESULT MDIClientWndProc_common( 
 
       case WM_SIZE:
         if( IsWindow(ci->hwndActiveChild) && IsZoomed(ci->hwndActiveChild) &&
-            IsWindowVisible(ci->hwndActiveChild) )
+            (GetWindowLongW(ci->hwndActiveChild, GWL_STYLE) & WS_VISIBLE) )
 	{
 	    RECT	rect;
 
@@ -1479,7 +1479,15 @@ LRESULT WINAPI DefMDIChildProcW( HWND hw
 
     case WM_SHOWWINDOW:
     case WM_SETVISIBLE:
-        if (IsZoomed(ci->hwndActiveChild)) ci->mdiFlags &= ~MDIF_NEEDUPDATE;
+        if (wParam && IsZoomed(ci->hwndActiveChild) &&
+            (GetWindowLongW(ci->hwndActiveChild, GWL_STYLE) & WS_VISIBLE))
+        {
+            /* FIXME: need to write an appropriate test case to see
+             * what Windows does in that case.
+             */
+            ShowWindow(ci->hwndActiveChild, SW_SHOWNOACTIVATE);
+            ci->mdiFlags &= ~MDIF_NEEDUPDATE;
+        }
         else MDI_PostUpdate(client, ci, SB_BOTH+1);
         break;
 






More information about the wine-patches mailing list