From c712cab4d434e94be45fb6a502f6ee388a838d97 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 6 Apr 2020 14:34:27 -0700 Subject: [PATCH] fix: persist maximizable state when toggling fullscreen --- shell/browser/ui/cocoa/atom_ns_window.mm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shell/browser/ui/cocoa/atom_ns_window.mm b/shell/browser/ui/cocoa/atom_ns_window.mm index 95eba2a35cdba..5eeb848a25973 100644 --- a/shell/browser/ui/cocoa/atom_ns_window.mm +++ b/shell/browser/ui/cocoa/atom_ns_window.mm @@ -185,11 +185,17 @@ - (void)toggleFullScreenMode:(id)sender { // If we're in simple fullscreen mode and trying to exit it // we need to ensure we exit it properly to prevent a crash - // with NSWindowStyleMaskTitled mode - if (is_simple_fs || always_simple_fs) + // with NSWindowStyleMaskTitled mode. + if (is_simple_fs || always_simple_fs) { shell_->SetSimpleFullScreen(!is_simple_fs); - else + } else { + bool maximizable = shell_->IsMaximizable(); [super toggleFullScreen:sender]; + + // Exiting fullscreen causes Cocoa to redraw the NSWindow, which resets + // the enabled state for NSWindowZoomButton. We need to persist it. + shell_->SetMaximizable(maximizable); + } } - (void)performMiniaturize:(id)sender {