Dmitry Timoshkov : user32: Remove redundant visibility checks of a maximized MDI child, add an explanation why we do that.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 15 07:43:09 CST 2007


Module: wine
Branch: master
Commit: 499c26ce66ec6cbbb3569c69ca95c9dfac01d39f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=499c26ce66ec6cbbb3569c69ca95c9dfac01d39f

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Mon Jan 15 17:03:11 2007 +0800

user32: Remove redundant visibility checks of a maximized MDI child, add an explanation why we do that.

---

 dlls/user32/mdi.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index a2def9b..f8bb8f8 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -120,6 +120,14 @@ typedef struct
     /* At some points, particularly when switching MDI children, active and
      * maximized MDI children may be not the same window, so we need to track
      * them separately.
+     * The only place where we switch to/from maximized state is DefMDIChildProc
+     * WM_SIZE/SIZE_MAXIMIZED handler. We get that notification only after the
+     * ShowWindow(SW_SHOWMAXIMIZED) request, therefore window is guaranteed to
+     * be visible at the time we get the notification, and it's safe to assume
+     * that hwndChildMaximized is always visible.
+     * If the app plays games with WS_VISIBLE, WS_MAXIMIZE or any other window
+     * states it must keep coherency with USER32 on its own. This is true for
+     * Windows as well.
      */
     UINT      nActiveChildren;
     HWND      hwndChildMaximized;
@@ -355,7 +363,7 @@ static LRESULT MDISetMenu( HWND hwnd, HM
             HMENU oldFrameMenu = ci->hFrameMenu;
 
             ci->hFrameMenu = hmenuFrame;
-            if (ci->hwndChildMaximized && (GetWindowLongW(ci->hwndChildMaximized, GWL_STYLE) & WS_VISIBLE))
+            if (ci->hwndChildMaximized)
                 MDI_AugmentFrameMenu( hwndFrame, ci->hwndChildMaximized );
 
             return (LRESULT)oldFrameMenu;
@@ -974,7 +982,7 @@ static void MDI_UpdateFrameText( HWND fr
 
     if (ci->frameTitle)
     {
-	if (ci->hwndChildMaximized && (GetWindowLongW(ci->hwndChildMaximized, GWL_STYLE) & WS_VISIBLE))
+	if (ci->hwndChildMaximized)
 	{
 	    /* combine frame title and child title if possible */
 
@@ -1220,8 +1228,7 @@ static LRESULT MDIClientWndProc_common(
         return 0;
 
       case WM_SIZE:
-        if( IsWindow(ci->hwndActiveChild) && IsZoomed(ci->hwndActiveChild) &&
-            (GetWindowLongW(ci->hwndActiveChild, GWL_STYLE) & WS_VISIBLE) )
+        if( ci->hwndChildMaximized )
 	{
 	    RECT	rect;
 
@@ -1230,9 +1237,9 @@ static LRESULT MDIClientWndProc_common(
 	    rect.right = LOWORD(lParam);
 	    rect.bottom = HIWORD(lParam);
 
-	    AdjustWindowRectEx(&rect, GetWindowLongA(ci->hwndActiveChild, GWL_STYLE),
-                               0, GetWindowLongA(ci->hwndActiveChild, GWL_EXSTYLE) );
-	    MoveWindow(ci->hwndActiveChild, rect.left, rect.top,
+	    AdjustWindowRectEx( &rect, GetWindowLongA(ci->hwndChildMaximized, GWL_STYLE),
+                               0, GetWindowLongA(ci->hwndChildMaximized, GWL_EXSTYLE) );
+	    MoveWindow( ci->hwndChildMaximized, rect.left, rect.top,
 			 rect.right - rect.left, rect.bottom - rect.top, 1);
 	}
 	else
@@ -1507,6 +1514,7 @@ LRESULT WINAPI DefMDIChildProcW( HWND hw
         break;
 
     case WM_SIZE:
+        /* This is the only place where we switch to/from maximized state */
         /* do not change */
         TRACE("current active %p, maximized %p\n", ci->hwndActiveChild, ci->hwndChildMaximized);
 




More information about the wine-cvs mailing list