nsresult os2FrameWindow::SetSizeMode(int32_t aMode) { int32_t previousMode; mOwner->GetSizeMode(&previousMode); // save the new state nsresult rv = mOwner->nsBaseWidget::SetSizeMode(aMode); if (!NS_SUCCEEDED(rv)) { return rv; } // Minimized windows would get restored involuntarily if we fired an // NS_ACTIVATE when the user clicks on them. Instead, we defer the // activation event until the window has explicitly been restored. if (previousMode == nsSizeMode_Minimized && previousMode != aMode) { DEBUGFOCUS(deferred NS_ACTIVATE); ActivateTopLevelWidget(); } ULONG ulStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE); switch (aMode) { case nsSizeMode_Normal: if (ulStyle & (WS_MAXIMIZED | WS_MINIMIZED)) { WinSetWindowPos(mFrameWnd, 0, 0, 0, 0, 0, SWP_RESTORE); } break; case nsSizeMode_Minimized: if (!(ulStyle & WS_MINIMIZED)) { WinSetWindowPos(mFrameWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_MINIMIZE | SWP_ZORDER | SWP_DEACTIVATE); } break; case nsSizeMode_Maximized: // Don't permit the window to be maximized when in // fullscreen mode because it won't be restored correctly. if (!(ulStyle & WS_MAXIMIZED) && !mChromeHidden) { WinSetWindowPos(mFrameWnd, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE | SWP_ZORDER); } break; // 'nsSizeMode_Fullscreen' is defined but isn't used (as of v1.9.3) case nsSizeMode_Fullscreen: default: break; } return NS_OK; }
nsresult os2FrameWindow::SetSizeMode(PRInt32 aMode) { PRInt32 previousMode; mOwner->GetSizeMode(&previousMode); // save the new state nsresult rv = mOwner->nsBaseWidget::SetSizeMode(aMode); // Minimized windows would get restored involuntarily if we fired an // NS_ACTIVATE when the user clicks on them. Instead, we defer the // activation event until the window has explicitly been restored. if (previousMode == nsSizeMode_Minimized && previousMode != aMode) { DEBUGFOCUS(deferred NS_ACTIVATE); ActivateTopLevelWidget(); } // nothing to do in these cases if (!NS_SUCCEEDED(rv) || !mChromeHidden || aMode == nsSizeMode_Maximized) { return rv; } ULONG ulStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE); // act on the request if the frame isn't already in the requested state if (aMode == nsSizeMode_Minimized) { if (!(ulStyle & WS_MINIMIZED)) { WinSetWindowPos(mFrameWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_MINIMIZE | SWP_ZORDER | SWP_DEACTIVATE); } } else if (ulStyle & (WS_MAXIMIZED | WS_MINIMIZED)) { WinSetWindowPos(mFrameWnd, 0, 0, 0, 0, 0, SWP_RESTORE); } return NS_OK; }