Commit 499c26ce authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user32: Remove redundant visibility checks of a maximized MDI child, add an…

user32: Remove redundant visibility checks of a maximized MDI child, add an explanation why we do that.
parent f6d5368d
...@@ -120,6 +120,14 @@ typedef struct ...@@ -120,6 +120,14 @@ typedef struct
/* At some points, particularly when switching MDI children, active and /* At some points, particularly when switching MDI children, active and
* maximized MDI children may be not the same window, so we need to track * maximized MDI children may be not the same window, so we need to track
* them separately. * 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; UINT nActiveChildren;
HWND hwndChildMaximized; HWND hwndChildMaximized;
...@@ -355,7 +363,7 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame, ...@@ -355,7 +363,7 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
HMENU oldFrameMenu = ci->hFrameMenu; HMENU oldFrameMenu = ci->hFrameMenu;
ci->hFrameMenu = hmenuFrame; ci->hFrameMenu = hmenuFrame;
if (ci->hwndChildMaximized && (GetWindowLongW(ci->hwndChildMaximized, GWL_STYLE) & WS_VISIBLE)) if (ci->hwndChildMaximized)
MDI_AugmentFrameMenu( hwndFrame, ci->hwndChildMaximized ); MDI_AugmentFrameMenu( hwndFrame, ci->hwndChildMaximized );
return (LRESULT)oldFrameMenu; return (LRESULT)oldFrameMenu;
...@@ -974,7 +982,7 @@ static void MDI_UpdateFrameText( HWND frame, HWND hClient, BOOL repaint, LPCWSTR ...@@ -974,7 +982,7 @@ static void MDI_UpdateFrameText( HWND frame, HWND hClient, BOOL repaint, LPCWSTR
if (ci->frameTitle) if (ci->frameTitle)
{ {
if (ci->hwndChildMaximized && (GetWindowLongW(ci->hwndChildMaximized, GWL_STYLE) & WS_VISIBLE)) if (ci->hwndChildMaximized)
{ {
/* combine frame title and child title if possible */ /* combine frame title and child title if possible */
...@@ -1220,8 +1228,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, ...@@ -1220,8 +1228,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
return 0; return 0;
case WM_SIZE: case WM_SIZE:
if( IsWindow(ci->hwndActiveChild) && IsZoomed(ci->hwndActiveChild) && if( ci->hwndChildMaximized )
(GetWindowLongW(ci->hwndActiveChild, GWL_STYLE) & WS_VISIBLE) )
{ {
RECT rect; RECT rect;
...@@ -1230,9 +1237,9 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, ...@@ -1230,9 +1237,9 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
rect.right = LOWORD(lParam); rect.right = LOWORD(lParam);
rect.bottom = HIWORD(lParam); rect.bottom = HIWORD(lParam);
AdjustWindowRectEx(&rect, GetWindowLongA(ci->hwndActiveChild, GWL_STYLE), AdjustWindowRectEx( &rect, GetWindowLongA(ci->hwndChildMaximized, GWL_STYLE),
0, GetWindowLongA(ci->hwndActiveChild, GWL_EXSTYLE) ); 0, GetWindowLongA(ci->hwndChildMaximized, GWL_EXSTYLE) );
MoveWindow(ci->hwndActiveChild, rect.left, rect.top, MoveWindow( ci->hwndChildMaximized, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, 1); rect.right - rect.left, rect.bottom - rect.top, 1);
} }
else else
...@@ -1507,6 +1514,7 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message, ...@@ -1507,6 +1514,7 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message,
break; break;
case WM_SIZE: case WM_SIZE:
/* This is the only place where we switch to/from maximized state */
/* do not change */ /* do not change */
TRACE("current active %p, maximized %p\n", ci->hwndActiveChild, ci->hwndChildMaximized); TRACE("current active %p, maximized %p\n", ci->hwndActiveChild, ci->hwndChildMaximized);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment