fix: avoid flicker when leaving fullscreen in frameless window (#27587)

This commit is contained in:
Cheng Zhao 2021-02-05 10:03:12 +09:00 committed by GitHub
parent b31217a889
commit eb91b1c965
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1490,11 +1490,6 @@ void NativeWindowMac::NotifyWindowEnterFullScreen() {
void NativeWindowMac::NotifyWindowLeaveFullScreen() { void NativeWindowMac::NotifyWindowLeaveFullScreen() {
NativeWindow::NotifyWindowLeaveFullScreen(); NativeWindow::NotifyWindowLeaveFullScreen();
exiting_fullscreen_ = false; exiting_fullscreen_ = false;
// Add back buttonsView after leaving fullscreen mode.
if (buttons_view_) {
InternalSetStandardButtonsVisibility(false);
[[window_ contentView] addSubview:buttons_view_];
}
} }
void NativeWindowMac::NotifyWindowWillEnterFullScreen() { void NativeWindowMac::NotifyWindowWillEnterFullScreen() {
@ -1507,9 +1502,12 @@ void NativeWindowMac::NotifyWindowWillEnterFullScreen() {
} }
void NativeWindowMac::NotifyWindowWillLeaveFullScreen() { void NativeWindowMac::NotifyWindowWillLeaveFullScreen() {
// Hide window title after leaving fullscreen. // Hide window title and restore buttonsView when leaving fullscreen.
if (buttons_view_) if (buttons_view_) {
[window_ setTitleVisibility:NSWindowTitleHidden]; [window_ setTitleVisibility:NSWindowTitleHidden];
InternalSetStandardButtonsVisibility(false);
[[window_ contentView] addSubview:buttons_view_];
}
exiting_fullscreen_ = true; exiting_fullscreen_ = true;
RedrawTrafficLights(); RedrawTrafficLights();
} }