Skip to content

Commit a7469f8

Browse files
authored
fix: persist maximizable state when toggling fullscreen (electron#22988)
1 parent b4447be commit a7469f8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

shell/browser/ui/cocoa/electron_ns_window.mm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,17 @@ - (void)toggleFullScreenMode:(id)sender {
207207

208208
// If we're in simple fullscreen mode and trying to exit it
209209
// we need to ensure we exit it properly to prevent a crash
210-
// with NSWindowStyleMaskTitled mode
211-
if (is_simple_fs || always_simple_fs)
210+
// with NSWindowStyleMaskTitled mode.
211+
if (is_simple_fs || always_simple_fs) {
212212
shell_->SetSimpleFullScreen(!is_simple_fs);
213-
else
213+
} else {
214+
bool maximizable = shell_->IsMaximizable();
214215
[super toggleFullScreen:sender];
216+
217+
// Exiting fullscreen causes Cocoa to redraw the NSWindow, which resets
218+
// the enabled state for NSWindowZoomButton. We need to persist it.
219+
shell_->SetMaximizable(maximizable);
220+
}
215221
}
216222

217223
- (void)performMiniaturize:(id)sender {

0 commit comments

Comments
 (0)