From d58b1d5b72dfa2ba2762dad2d33fd3cd00ec3699 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 Mar 2013 16:33:04 -0400 Subject: [PATCH] Hide the :skull: dev button in full screen mode Closes #417 --- native/atom_window_controller.h | 1 + native/atom_window_controller.mm | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/native/atom_window_controller.h b/native/atom_window_controller.h index 09b7590c6..15e5983b9 100644 --- a/native/atom_window_controller.h +++ b/native/atom_window_controller.h @@ -6,6 +6,7 @@ class AtomCefClient; NSSplitView *_splitView; NSView *_devToolsView; NSView *_webView; + NSButton *_devButton; NSString *_bootstrapScript; NSString *_resourcePath; NSString *_pathToOpen; diff --git a/native/atom_window_controller.mm b/native/atom_window_controller.mm index 9b79be82a..957f84a4b 100644 --- a/native/atom_window_controller.mm +++ b/native/atom_window_controller.mm @@ -16,6 +16,7 @@ [_splitView release]; [_devToolsView release]; [_webView release]; + [_devButton release]; [_bootstrapScript release]; [_resourcePath release]; [_pathToOpen release]; @@ -244,6 +245,16 @@ return YES; } +- (void)windowWillEnterFullScreen:(NSNotification *)notification { + if (_devButton) + [_devButton setHidden:YES]; +} + +- (void)windowDidExitFullScreen:(NSNotification *)notification { + if (_devButton) + [_devButton setHidden:NO]; +} + - (bool)isDevMode { NSString *bundleResourcePath = [[NSBundle bundleForClass:self.class] resourcePath]; return ![_resourcePath isEqualToString:bundleResourcePath]; @@ -260,15 +271,15 @@ break; } - NSButton *devButton = [[NSButton alloc] init]; - [devButton setTitle:@"\xF0\x9F\x92\x80"]; - devButton.autoresizingMask = NSViewMinXMargin | NSViewMinYMargin; - devButton.buttonType = NSMomentaryChangeButton; - devButton.bordered = NO; - [devButton sizeToFit]; - devButton.frame = NSMakeRect(fullScreenButton.frame.origin.x - devButton.frame.size.width - 5, fullScreenButton.frame.origin.y, devButton.frame.size.width, devButton.frame.size.height); + _devButton = [[NSButton alloc] init]; + [_devButton setTitle:@"\xF0\x9F\x92\x80"]; + _devButton.autoresizingMask = NSViewMinXMargin | NSViewMinYMargin; + _devButton.buttonType = NSMomentaryChangeButton; + _devButton.bordered = NO; + [_devButton sizeToFit]; + _devButton.frame = NSMakeRect(fullScreenButton.frame.origin.x - _devButton.frame.size.width - 5, fullScreenButton.frame.origin.y, _devButton.frame.size.width, _devButton.frame.size.height); - [[self.window.contentView superview] addSubview:devButton]; + [[self.window.contentView superview] addSubview:_devButton]; } - (void)populateBrowserSettings:(CefBrowserSettings &)settings {