fix: handle async nature of [NSWindow -toggleFullScreen] (#25470)
This commit is contained in:
parent
7063b5ef2c
commit
503d24a473
7 changed files with 127 additions and 17 deletions
|
@ -223,11 +223,23 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
if (is_simple_fs || always_simple_fs) {
|
||||
shell_->SetSimpleFullScreen(!is_simple_fs);
|
||||
} else {
|
||||
bool maximizable = shell_->IsMaximizable();
|
||||
[super toggleFullScreen:sender];
|
||||
if (shell_->IsVisible()) {
|
||||
// Until 10.13, AppKit would obey a call to -toggleFullScreen: made inside
|
||||
// windowDidEnterFullScreen & windowDidExitFullScreen. Starting in 10.13,
|
||||
// it behaves as though the transition is still in progress and just emits
|
||||
// "not in a fullscreen state" when trying to exit fullscreen in the same
|
||||
// runloop that entered it. To handle this, invoke -toggleFullScreen:
|
||||
// asynchronously.
|
||||
[super performSelector:@selector(toggleFullScreen:)
|
||||
withObject:nil
|
||||
afterDelay:0];
|
||||
} else {
|
||||
[super toggleFullScreen:sender];
|
||||
}
|
||||
|
||||
// Exiting fullscreen causes Cocoa to redraw the NSWindow, which resets
|
||||
// the enabled state for NSWindowZoomButton. We need to persist it.
|
||||
bool maximizable = shell_->IsMaximizable();
|
||||
shell_->SetMaximizable(maximizable);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue