fix: handle failing to enter fullscreen on macOS (#43112)
* fix: handle failing to enter/exit fullscreen on macOS On macOS, failing to enter/exit fullscreen can fail. If this happens, properly restore the original window state. * refactor: remove fail to exit fullscreen handlers Seem to be unnecessary since the window exits fullscreen anyway.
This commit is contained in:
parent
45e5ccc55e
commit
2337d8676d
3 changed files with 20 additions and 0 deletions
|
@ -167,6 +167,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void DetachChildren() override;
|
void DetachChildren() override;
|
||||||
|
|
||||||
void NotifyWindowWillEnterFullScreen();
|
void NotifyWindowWillEnterFullScreen();
|
||||||
|
void NotifyWindowDidFailToEnterFullScreen();
|
||||||
void NotifyWindowWillLeaveFullScreen();
|
void NotifyWindowWillLeaveFullScreen();
|
||||||
|
|
||||||
// Cleanup observers when window is getting closed. Note that the destructor
|
// Cleanup observers when window is getting closed. Note that the destructor
|
||||||
|
|
|
@ -1662,6 +1662,13 @@ void NativeWindowMac::NotifyWindowWillEnterFullScreen() {
|
||||||
UpdateVibrancyRadii(true);
|
UpdateVibrancyRadii(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowMac::NotifyWindowDidFailToEnterFullScreen() {
|
||||||
|
UpdateVibrancyRadii(false);
|
||||||
|
|
||||||
|
if (buttons_proxy_)
|
||||||
|
[buttons_proxy_ redraw];
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowMac::NotifyWindowWillLeaveFullScreen() {
|
void NativeWindowMac::NotifyWindowWillLeaveFullScreen() {
|
||||||
if (buttons_proxy_) {
|
if (buttons_proxy_) {
|
||||||
// Hide window title when leaving fullscreen.
|
// Hide window title when leaving fullscreen.
|
||||||
|
|
|
@ -311,6 +311,18 @@ using FullScreenTransitionState =
|
||||||
shell_->HandlePendingFullscreenTransitions();
|
shell_->HandlePendingFullscreenTransitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)windowDidFailToEnterFullScreen:(NSWindow*)window {
|
||||||
|
shell_->set_fullscreen_transition_state(FullScreenTransitionState::kNone);
|
||||||
|
|
||||||
|
shell_->SetResizable(is_resizable_);
|
||||||
|
shell_->NotifyWindowDidFailToEnterFullScreen();
|
||||||
|
|
||||||
|
if (shell_->HandleDeferredClose())
|
||||||
|
return;
|
||||||
|
|
||||||
|
shell_->HandlePendingFullscreenTransitions();
|
||||||
|
}
|
||||||
|
|
||||||
- (void)windowWillExitFullScreen:(NSNotification*)notification {
|
- (void)windowWillExitFullScreen:(NSNotification*)notification {
|
||||||
shell_->set_fullscreen_transition_state(FullScreenTransitionState::kExiting);
|
shell_->set_fullscreen_transition_state(FullScreenTransitionState::kExiting);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue