Browse Source

fix: quit properly in simpleFullScreen mode (#14671)

Shelley Vohr 6 years ago
parent
commit
d70942190c
1 changed files with 12 additions and 2 deletions
  1. 12 2
      atom/browser/native_window_mac.mm

+ 12 - 2
atom/browser/native_window_mac.mm

@@ -728,10 +728,20 @@ enum {
 
 // 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)
+  if (shell_->title_bar_style() == 
+      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];
 }