From 12a435273d11be3dfaa61ac66044b2c690c39d3d Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Sun, 16 Sep 2018 22:22:09 -0700 Subject: [PATCH] fix: quit properly in simpleFullScreen mode (#14620) --- atom/browser/ui/cocoa/atom_ns_window.mm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/atom/browser/ui/cocoa/atom_ns_window.mm b/atom/browser/ui/cocoa/atom_ns_window.mm index 03ed762cf368..983c86012bb9 100644 --- a/atom/browser/ui/cocoa/atom_ns_window.mm +++ b/atom/browser/ui/cocoa/atom_ns_window.mm @@ -224,12 +224,22 @@ bool ScopedDisableResize::disable_resize_ = false; // Custom window button methods +- (BOOL)windowShouldClose:(id)sender { return YES; } + - (void)performClose:(id)sender { if (shell_->title_bar_style() == - atom::NativeWindowMac::CUSTOM_BUTTONS_ON_HOVER) + atom::NativeWindowMac::CUSTOM_BUTTONS_ON_HOVER) { [[self delegate] windowShouldClose:self]; - else + } else if (shell_->IsSimpleFullScreen()) { + if([[self delegate] respondsToSelector:@selector(windowShouldClose:)]) { + if(![[self delegate] windowShouldClose:self]) return; + } else if([self respondsToSelector:@selector(windowShouldClose:)]) { + if(![self windowShouldClose:self]) return; + } + [self close]; + } else { [super performClose:sender]; + } } - (void)toggleFullScreenMode:(id)sender {