Skip to content

Commit

Permalink
Bug 1823284 - Avoid waiting for window resizing if it is already at e…
Browse files Browse the repository at this point in the history
…xpected dimensions; r=smaug

Depends on D175384

Differential Revision: https://phabricator.services.mozilla.com/D175213
  • Loading branch information
EdgarChen committed Apr 23, 2023
1 parent a7c64be commit 8cfdebf
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion xpfe/appshell/AppWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2946,7 +2946,23 @@ void AppWindow::FullscreenWillChange(bool aInFullscreen) {
}
}
MOZ_ASSERT(mFullscreenChangeState == FullscreenChangeState::NotChanging);
mFullscreenChangeState = FullscreenChangeState::WillChange;

int32_t winWidth = 0;
int32_t winHeight = 0;
GetSize(&winWidth, &winHeight);

int32_t screenWidth = 0;
int32_t screenHeight = 0;
GetAvailScreenSize(&screenWidth, &screenHeight);

// Check if the window is already at the expected dimensions. If it is, set
// the fullscreen change state to WidgetResized to avoid waiting for a resize
// event. On macOS, a fullscreen window could be slightly higher than
// available screen size because of the OS menu bar isn't yet hidden.
mFullscreenChangeState =
(aInFullscreen == (winWidth == screenWidth && winHeight >= screenHeight))
? FullscreenChangeState::WidgetResized
: FullscreenChangeState::WillChange;
}

void AppWindow::FullscreenChanged(bool aInFullscreen) {
Expand Down

0 comments on commit 8cfdebf

Please sign in to comment.