Loading widget/windows/nsWindow.cpp +64 −74 Original line number Diff line number Diff line Loading @@ -2388,107 +2388,57 @@ static UINT GetCurrentShowCmd(HWND aWnd) { return pl.showCmd; } void nsWindow::SetSizeModeInternal(nsSizeMode aMode, nsIScreen* aFullscreenTarget) { // Maximize, minimize or restore the window. void nsWindow::SetSizeMode(nsSizeMode aMode) { // Let's not try and do anything if we're already in that state. // (This is needed to prevent problems when calling window.minimize(), which // calls us directly, and then the OS triggers another call to us.) if (aMode == mSizeMode) return; const bool currentlyFullscreen = mSizeMode == nsSizeMode_Fullscreen; const bool requestedFullscreen = aMode == nsSizeMode_Fullscreen; const bool fullscreenChanging = currentlyFullscreen || requestedFullscreen; MOZ_DIAGNOSTIC_ASSERT(currentlyFullscreen == mFullscreenMode); if (fullscreenChanging) { if (mWidgetListener) { mWidgetListener->FullscreenWillChange(requestedFullscreen); } mFullscreenMode = requestedFullscreen; // If we are still displaying a maximized pre-XUL skeleton UI, ignore the // noise of sizemode changes. Once we have "shown" the window for the first // time (called nsWindow::Show(true), even though the window is already // technically displayed), we will again accept sizemode changes. if (mIsShowingPreXULSkeletonUI && WasPreXULSkeletonUIMaximized()) { return; } // save the requested state mLastSizeMode = mSizeMode; nsBaseWidget::SetSizeMode(aMode); if (mIsVisible) { int mode; switch (aMode) { case nsSizeMode_Fullscreen: ::ShowWindow(mWnd, SW_SHOW); mode = SW_SHOW; break; case nsSizeMode_Maximized: ::ShowWindow(mWnd, SW_MAXIMIZE); mode = SW_MAXIMIZE; break; case nsSizeMode_Minimized: ::ShowWindow(mWnd, SW_MINIMIZE); mode = SW_MINIMIZE; break; default: MOZ_ASSERT(aMode == nsSizeMode_Normal); mode = SW_RESTORE; } // Don't call ::ShowWindow if we're trying to "restore" a window that is // already in a normal state. Prevents a bug where snapping to one side // of the screen and then minimizing would cause Windows to forget our // window's correct restored position/size. if (GetCurrentShowCmd(mWnd) != SW_SHOWNORMAL) { ::ShowWindow(mWnd, SW_RESTORE); } } } if (fullscreenChanging) { // taskbarInfo will be nullptr pre Windows 7 until Bug 680227 is resolved. nsCOMPtr<nsIWinTaskbar> taskbarInfo = do_GetService(NS_TASKBAR_CONTRACTID); if (requestedFullscreen && taskbarInfo) { // Notify the taskbar that we will be entering full screen mode. taskbarInfo->PrepareFullScreenHWND(mWnd, TRUE); } // If we are going fullscreen, the window size continues to change // and the window will be reflow again then. UpdateNonClientMargins(mSizeMode, /* Reflow */ !requestedFullscreen); // Will call hide chrome, reposition window. Note this will // also cache dimensions for restoration, so it should only // be called once per fullscreen request. nsBaseWidget::InfallibleMakeFullScreen(requestedFullscreen, aFullscreenTarget); if (mIsVisible && aMode != nsSizeMode_Minimized) { DispatchFocusToTopLevelWindow(true); } if (!requestedFullscreen && taskbarInfo) { // Notify the taskbar that we have exited full screen mode. taskbarInfo->PrepareFullScreenHWND(mWnd, FALSE); } OnSizeModeChange(mSizeMode); if (mWidgetListener) { mWidgetListener->FullscreenChanged(requestedFullscreen); if (!(GetCurrentShowCmd(mWnd) == SW_SHOWNORMAL && mode == SW_RESTORE)) { ::ShowWindow(mWnd, mode); } } else if(mIsVisible && aMode != nsSizeMode_Minimized) { // we activate here to ensure that the right child window is focused if (mode == SW_MAXIMIZE || mode == SW_SHOW) DispatchFocusToTopLevelWindow(true); } } // Maximize, minimize or restore the window. void nsWindow::SetSizeMode(nsSizeMode aMode) { // If we are still displaying a maximized pre-XUL skeleton UI, ignore the // noise of sizemode changes. Once we have "shown" the window for the first // time (called nsWindow::Show(true), even though the window is already // technically displayed), we will again accept sizemode changes. if (mIsShowingPreXULSkeletonUI && WasPreXULSkeletonUIMaximized()) { return; } SetSizeModeInternal(aMode, nullptr); } void nsWindow::GetWorkspaceID(nsAString& workspaceID) { RefPtr<IVirtualDesktopManager> desktopManager = gVirtualDesktopManager; if (!desktopManager) { Loading Loading @@ -3756,11 +3706,51 @@ void nsWindow::CleanupFullscreenTransition() { } nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) { // taskbarInfo will be nullptr pre Windows 7 until Bug 680227 is resolved. nsCOMPtr<nsIWinTaskbar> taskbarInfo = do_GetService(NS_TASKBAR_CONTRACTID); if (mWidgetListener) { mWidgetListener->FullscreenWillChange(aFullScreen); } mFullscreenMode = aFullScreen; if (aFullScreen) { if (mSizeMode == nsSizeMode_Fullscreen) return NS_OK; mOldSizeMode = mSizeMode; SetSizeModeInternal(nsSizeMode_Fullscreen, aTargetScreen); SetSizeMode(nsSizeMode_Fullscreen); // Notify the taskbar that we will be entering full screen mode. if (taskbarInfo) { taskbarInfo->PrepareFullScreenHWND(mWnd, TRUE); } } else { SetSizeModeInternal(mOldSizeMode, aTargetScreen); SetSizeMode(mOldSizeMode); } // If we are going fullscreen, the window size continues to change // and the window will be reflow again then. UpdateNonClientMargins(mSizeMode, /* Reflow */ !aFullScreen); // Will call hide chrome, reposition window. Note this will // also cache dimensions for restoration, so it should only // be called once per fullscreen request. nsBaseWidget::InfallibleMakeFullScreen(aFullScreen, aTargetScreen); if (mIsVisible && !aFullScreen && mOldSizeMode == nsSizeMode_Normal) { // Ensure the window exiting fullscreen get activated. Window // activation might be bypassed in SetSizeMode. DispatchFocusToTopLevelWindow(true); } // Notify the taskbar that we have exited full screen mode. if (!aFullScreen && taskbarInfo) { taskbarInfo->PrepareFullScreenHWND(mWnd, FALSE); } OnSizeModeChange(mSizeMode); if (mWidgetListener) { mWidgetListener->FullscreenChanged(aFullScreen); } return NS_OK; Loading widget/windows/nsWindow.h +0 −1 Original line number Diff line number Diff line Loading @@ -520,7 +520,6 @@ class nsWindow final : public nsWindowBase { bool DispatchTouchEventFromWMPointer(UINT msg, LPARAM aLParam, const WinPointerInfo& aPointerInfo, mozilla::MouseButton aButton); void SetSizeModeInternal(nsSizeMode aMode, nsIScreen* aFullscreenTarget); protected: #endif // MOZ_XUL Loading Loading
widget/windows/nsWindow.cpp +64 −74 Original line number Diff line number Diff line Loading @@ -2388,107 +2388,57 @@ static UINT GetCurrentShowCmd(HWND aWnd) { return pl.showCmd; } void nsWindow::SetSizeModeInternal(nsSizeMode aMode, nsIScreen* aFullscreenTarget) { // Maximize, minimize or restore the window. void nsWindow::SetSizeMode(nsSizeMode aMode) { // Let's not try and do anything if we're already in that state. // (This is needed to prevent problems when calling window.minimize(), which // calls us directly, and then the OS triggers another call to us.) if (aMode == mSizeMode) return; const bool currentlyFullscreen = mSizeMode == nsSizeMode_Fullscreen; const bool requestedFullscreen = aMode == nsSizeMode_Fullscreen; const bool fullscreenChanging = currentlyFullscreen || requestedFullscreen; MOZ_DIAGNOSTIC_ASSERT(currentlyFullscreen == mFullscreenMode); if (fullscreenChanging) { if (mWidgetListener) { mWidgetListener->FullscreenWillChange(requestedFullscreen); } mFullscreenMode = requestedFullscreen; // If we are still displaying a maximized pre-XUL skeleton UI, ignore the // noise of sizemode changes. Once we have "shown" the window for the first // time (called nsWindow::Show(true), even though the window is already // technically displayed), we will again accept sizemode changes. if (mIsShowingPreXULSkeletonUI && WasPreXULSkeletonUIMaximized()) { return; } // save the requested state mLastSizeMode = mSizeMode; nsBaseWidget::SetSizeMode(aMode); if (mIsVisible) { int mode; switch (aMode) { case nsSizeMode_Fullscreen: ::ShowWindow(mWnd, SW_SHOW); mode = SW_SHOW; break; case nsSizeMode_Maximized: ::ShowWindow(mWnd, SW_MAXIMIZE); mode = SW_MAXIMIZE; break; case nsSizeMode_Minimized: ::ShowWindow(mWnd, SW_MINIMIZE); mode = SW_MINIMIZE; break; default: MOZ_ASSERT(aMode == nsSizeMode_Normal); mode = SW_RESTORE; } // Don't call ::ShowWindow if we're trying to "restore" a window that is // already in a normal state. Prevents a bug where snapping to one side // of the screen and then minimizing would cause Windows to forget our // window's correct restored position/size. if (GetCurrentShowCmd(mWnd) != SW_SHOWNORMAL) { ::ShowWindow(mWnd, SW_RESTORE); } } } if (fullscreenChanging) { // taskbarInfo will be nullptr pre Windows 7 until Bug 680227 is resolved. nsCOMPtr<nsIWinTaskbar> taskbarInfo = do_GetService(NS_TASKBAR_CONTRACTID); if (requestedFullscreen && taskbarInfo) { // Notify the taskbar that we will be entering full screen mode. taskbarInfo->PrepareFullScreenHWND(mWnd, TRUE); } // If we are going fullscreen, the window size continues to change // and the window will be reflow again then. UpdateNonClientMargins(mSizeMode, /* Reflow */ !requestedFullscreen); // Will call hide chrome, reposition window. Note this will // also cache dimensions for restoration, so it should only // be called once per fullscreen request. nsBaseWidget::InfallibleMakeFullScreen(requestedFullscreen, aFullscreenTarget); if (mIsVisible && aMode != nsSizeMode_Minimized) { DispatchFocusToTopLevelWindow(true); } if (!requestedFullscreen && taskbarInfo) { // Notify the taskbar that we have exited full screen mode. taskbarInfo->PrepareFullScreenHWND(mWnd, FALSE); } OnSizeModeChange(mSizeMode); if (mWidgetListener) { mWidgetListener->FullscreenChanged(requestedFullscreen); if (!(GetCurrentShowCmd(mWnd) == SW_SHOWNORMAL && mode == SW_RESTORE)) { ::ShowWindow(mWnd, mode); } } else if(mIsVisible && aMode != nsSizeMode_Minimized) { // we activate here to ensure that the right child window is focused if (mode == SW_MAXIMIZE || mode == SW_SHOW) DispatchFocusToTopLevelWindow(true); } } // Maximize, minimize or restore the window. void nsWindow::SetSizeMode(nsSizeMode aMode) { // If we are still displaying a maximized pre-XUL skeleton UI, ignore the // noise of sizemode changes. Once we have "shown" the window for the first // time (called nsWindow::Show(true), even though the window is already // technically displayed), we will again accept sizemode changes. if (mIsShowingPreXULSkeletonUI && WasPreXULSkeletonUIMaximized()) { return; } SetSizeModeInternal(aMode, nullptr); } void nsWindow::GetWorkspaceID(nsAString& workspaceID) { RefPtr<IVirtualDesktopManager> desktopManager = gVirtualDesktopManager; if (!desktopManager) { Loading Loading @@ -3756,11 +3706,51 @@ void nsWindow::CleanupFullscreenTransition() { } nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) { // taskbarInfo will be nullptr pre Windows 7 until Bug 680227 is resolved. nsCOMPtr<nsIWinTaskbar> taskbarInfo = do_GetService(NS_TASKBAR_CONTRACTID); if (mWidgetListener) { mWidgetListener->FullscreenWillChange(aFullScreen); } mFullscreenMode = aFullScreen; if (aFullScreen) { if (mSizeMode == nsSizeMode_Fullscreen) return NS_OK; mOldSizeMode = mSizeMode; SetSizeModeInternal(nsSizeMode_Fullscreen, aTargetScreen); SetSizeMode(nsSizeMode_Fullscreen); // Notify the taskbar that we will be entering full screen mode. if (taskbarInfo) { taskbarInfo->PrepareFullScreenHWND(mWnd, TRUE); } } else { SetSizeModeInternal(mOldSizeMode, aTargetScreen); SetSizeMode(mOldSizeMode); } // If we are going fullscreen, the window size continues to change // and the window will be reflow again then. UpdateNonClientMargins(mSizeMode, /* Reflow */ !aFullScreen); // Will call hide chrome, reposition window. Note this will // also cache dimensions for restoration, so it should only // be called once per fullscreen request. nsBaseWidget::InfallibleMakeFullScreen(aFullScreen, aTargetScreen); if (mIsVisible && !aFullScreen && mOldSizeMode == nsSizeMode_Normal) { // Ensure the window exiting fullscreen get activated. Window // activation might be bypassed in SetSizeMode. DispatchFocusToTopLevelWindow(true); } // Notify the taskbar that we have exited full screen mode. if (!aFullScreen && taskbarInfo) { taskbarInfo->PrepareFullScreenHWND(mWnd, FALSE); } OnSizeModeChange(mSizeMode); if (mWidgetListener) { mWidgetListener->FullscreenChanged(aFullScreen); } return NS_OK; Loading
widget/windows/nsWindow.h +0 −1 Original line number Diff line number Diff line Loading @@ -520,7 +520,6 @@ class nsWindow final : public nsWindowBase { bool DispatchTouchEventFromWMPointer(UINT msg, LPARAM aLParam, const WinPointerInfo& aPointerInfo, mozilla::MouseButton aButton); void SetSizeModeInternal(nsSizeMode aMode, nsIScreen* aFullscreenTarget); protected: #endif // MOZ_XUL Loading