From 976d45a7ac55993e1fa6ef974e664b1896ae7580 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Wed, 30 Oct 2013 14:47:02 -0700 Subject: [PATCH 01/12] fixes dark shell on mac going full screen --- appshell/cefclient_mac.mm | 5 ++++- appshell/client_handler_mac.mm | 10 ++++++++++ appshell/config.h | 4 ---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 5418261c7..171a8a8c1 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -291,8 +291,9 @@ - (void)addCustomDrawHook:(NSView*)contentView - (void)removeCustomDrawHook:(NSView*)contentView { NSView* themeView = [contentView superview]; + Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - object_setClass(themeView, NULL); + object_setClass(themeView, NSThemeFrame); } -(void)windowTitleDidChange:(NSString*)title { @@ -304,6 +305,8 @@ -(void)windowTitleDidChange:(NSString*)title { - (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; + [self removeCustomDrawHook: contentView]; savedTitle = [[window title] copy]; [window setTitle:@""]; #endif diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 816ed883a..463f4be21 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -223,6 +223,14 @@ - (void)addCustomDrawHook:(NSView*)contentView #endif } +- (void)removeCustomDrawHook:(NSView*)contentView +{ + NSView* themeView = [contentView superview]; + Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); + + object_setClass(themeView, NSThemeFrame); +} + - (IBAction)handleMenuAction:(id)sender { if (clientHandler.get() && clientHandler->GetBrowserId()) { CefRefPtr browser = ClientHandler::GetBrowserForNativeWindow(window); @@ -276,6 +284,8 @@ -(void)windowTitleDidChange:(NSString*)title { - (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI + NSView* contentView = [window contentView]; + [self removeCustomDrawHook: contentView]; savedTitle = [[window title] copy]; [window setTitle:@""]; #endif diff --git a/appshell/config.h b/appshell/config.h index a5b4e6817..c1331bd7e 100644 --- a/appshell/config.h +++ b/appshell/config.h @@ -63,11 +63,7 @@ #define REMOTE_DEBUGGING_PORT 9234 -#ifdef OS_WIN - // Comment out this line to enable OS themed drawing #define DARK_UI #define CUSTOM_TRAFFIC_LIGHTS #define LIGHT_CAPTION_TEXT - -#endif From bc51315e01af9907c28a7e268688a55c11d9a9ff Mon Sep 17 00:00:00 2001 From: Bob Easterday Date: Fri, 8 Nov 2013 16:14:53 -0800 Subject: [PATCH 02/12] First pass at creating a custom title bar without swizzling --- appshell/CustomTitlebarView.h | 18 ++++ appshell/CustomTitlebarView.m | 88 ++++++++++++++++ appshell/cefclient_mac.mm | 193 +++++++++------------------------- appshell_paths.gypi | 4 + 4 files changed, 159 insertions(+), 144 deletions(-) create mode 100644 appshell/CustomTitlebarView.h create mode 100644 appshell/CustomTitlebarView.m diff --git a/appshell/CustomTitlebarView.h b/appshell/CustomTitlebarView.h new file mode 100644 index 000000000..751c37589 --- /dev/null +++ b/appshell/CustomTitlebarView.h @@ -0,0 +1,18 @@ +// +// CustomTitlebarView.h +// appshell +// +// Created by Bob Easterday on 11/6/13. +// +// + +#import + +@interface CustomTitlebarView : NSView +{ + NSString *titleString; +} + +@property (nonatomic, strong) NSString *titleString; + +@end diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m new file mode 100644 index 000000000..2905e01c5 --- /dev/null +++ b/appshell/CustomTitlebarView.m @@ -0,0 +1,88 @@ +// +// CustomTitlebarView.m +// appshell +// +// Created by Bob Easterday on 11/6/13. +// +// + +#import "CustomTitlebarView.h" +#import "client_colors_mac.h" + +#define titleTextHeight 16 + +@implementation CustomTitlebarView + +@synthesize titleString; + +- (void)drawRect:(NSRect)dirtyRect +{ + NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; + NSRect windowFrame = [NSWindow frameRectForContentRect:[[[self window] contentView] bounds] styleMask:[[self window] styleMask]]; + NSRect contentBounds = [[[self window] contentView] bounds]; + + NSRect titlebarRect = NSMakeRect(0, 0, self.bounds.size.width, windowFrame.size.height - contentBounds.size.height); + titlebarRect.origin.y = self.bounds.size.height - titlebarRect.size.height; + + [[NSColor clearColor] set]; + NSRectFill( titlebarRect ); + + //This constant matches the radius for other macosx apps. + //For some reason if we use the default value it is double that of safari etc. + float cornerRadius = 4.0f; + + [[NSBezierPath bezierPathWithRoundedRect:titlebarRect + xRadius:cornerRadius + yRadius:cornerRadius] addClip]; + [[NSBezierPath bezierPathWithRect:titlebarRect] addClip]; + + NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; + [fillColor set]; + NSRectFill(titlebarRect); + + NSFont *titleFont = [NSFont fontWithName:@"HelveticaNeue-Bold" size:titleTextHeight]; + CGFloat stringWidth = [self widthOfString:titleString withFont:titleFont]; + NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; + NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; + + if (stringWidth) + { + NSRect textRect = NSMakeRect(titlebarRect.origin.x + ((titlebarRect.size.width / 2) - (stringWidth / 2)), + titlebarRect.origin.y + ((titlebarRect.size.height / 2) - (titleTextHeight / 2)), + titlebarRect.size.width, + titlebarRect.size.height); + + [titleString drawInRect:textRect withAttributes:[NSDictionary dictionaryWithObjectsAndKeys: + titleFont, NSFontAttributeName, + [NSApp isActive] ? activeColor : inactiveColor, + NSForegroundColorAttributeName, + nil]]; + } +} + +- (CGFloat)widthOfString:(NSString *)string withFont:(NSFont *)font +{ + if (string == nil || [string length] == 0) + return 0.0f; + + NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]; + return [[[NSAttributedString alloc] initWithString:string attributes:attributes] size].width; +} + +#pragma mark Property accessors + +- (NSString *)titleString +{ + return titleString; +} + +- (void)setTitleString:(NSString *)aString +{ + if ((!titleString && !aString) || (titleString && aString && [titleString isEqualToString:aString])) + return; + titleString = [aString copy]; + [self setNeedsDisplay:YES]; +} + + +@end diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 171a8a8c1..3fef549b3 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -30,6 +30,7 @@ #include "FullScreenView.h" #include "FullScreenViewController.h" +#import "CustomTitlebarView.h" // Application startup time CFTimeInterval g_appStartupTime; @@ -107,6 +108,7 @@ - (NSWindow *) findTargetWindow { @end +// BOBNOTE: Consider moving the delegate interface into its own .h file @interface ClientMenuDelegate : NSObject { } - (void)menuWillOpen:(NSMenu *)menu; @@ -126,87 +128,14 @@ - (void)menuWillOpen:(NSMenu *)menu { @end - - -// Custom draw interface for NSThemeFrame -@interface NSView (UndocumentedAPI) -- (float)roundedCornerRadius; -- (CGRect)_titlebarTitleRect; -- (NSTextFieldCell*)titleCell; -- (void)_drawTitleStringIn:(struct CGRect)arg1 withColor:(id)color; -@end - -/** - * The patched implementation for drawRect that lets us tweak - * the title bar. - */ -void ShellWindowFrameDrawRect(id self, SEL _cmd, NSRect rect) { - // Clear to 0 alpha - [[NSColor clearColor] set]; - NSRectFill( rect ); - //Obtain reference to our NSThemeFrame view - NSRect windowRect = [self frame]; - windowRect.origin = NSMakePoint(0,0); - //This constant matches the radius for other macosx apps. - //For some reason if we use the default value it is double that of safari etc. - float cornerRadius = 4.0f; - - //Clip our title bar render - [[NSBezierPath bezierPathWithRoundedRect:windowRect - xRadius:cornerRadius - yRadius:cornerRadius] addClip]; - [[NSBezierPath bezierPathWithRect:rect] addClip]; - - - - NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; - NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; - [fillColor set]; - NSRectFill( rect ); - NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; - NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; - // Render our title text - [self _drawTitleStringIn:[self _titlebarTitleRect] - withColor:[NSApp isActive] ? - activeColor : inactiveColor]; - - - - -} - - - - -/** - * Create a custom class based on NSThemeFrame called - * ShellWindowFrame. ShellWindowFrame uses ShellWindowFrameDrawRect() - * as the implementation for the drawRect selector allowing us - * to draw the border/title bar the way we see fit. - */ -Class GetShellWindowFrameClass() { - // lazily change the class implementation if - // not done so already. - static Class k = NULL; - if (!k) { - // See http://cocoawithlove.com/2010/01/what-is-meta-class-in-objective-c.html - Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - k = objc_allocateClassPair(NSThemeFrame, "ShellWindowFrame", 0); - Method m0 = class_getInstanceMethod(NSThemeFrame, @selector(drawRect:)); - class_addMethod(k, @selector(drawRect:), - (IMP)ShellWindowFrameDrawRect, method_getTypeEncoding(m0)); - objc_registerClassPair(k); - } - return k; -} - - +// BOBNOTE: Consider moving the delegate interface into its own .h file // Receives notifications from controls and the browser window. Will delete // itself when done. @interface ClientWindowDelegate : NSObject { - BOOL isReallyClosing; - NSString* savedTitle; - NSView* fullScreenButtonView; + BOOL isReallyClosing; + NSView* fullScreenButtonView; + BOOL isReentering; + CustomTitlebarView *customTitlebar; } - (void)setIsReallyClosing; - (IBAction)handleMenuAction:(id)sender; @@ -218,15 +147,15 @@ - (void)notifyConsoleMessage:(id)object; - (void)notifyDownloadComplete:(id)object; - (void)notifyDownloadError:(id)object; - (void)setFullScreenButtonView:(NSView*)view; -- (void)addCustomDrawHook:(NSView*)contentView; @end @implementation ClientWindowDelegate - (id) init { - [super init]; - savedTitle = nil; - isReallyClosing = false; - return self; + [super init]; + isReallyClosing = false; + isReentering = NO; + + return self; } - (void)setIsReallyClosing { @@ -275,40 +204,9 @@ - (void)setFullScreenButtonView:(NSView *)view { fullScreenButtonView = view; } -- (void)addCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, GetShellWindowFrameClass()); - -#ifdef LIGHT_CAPTION_TEXT - // Reset our frame view text cell background style - NSTextFieldCell * cell = [themeView titleCell]; - [cell setBackgroundStyle:NSBackgroundStyleLight]; -#endif -} - -- (void)removeCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - - object_setClass(themeView, NSThemeFrame); -} - -(void)windowTitleDidChange:(NSString*)title { #ifdef DARK_UI - savedTitle = [title copy]; -#endif -} - -- (void)windowWillEnterFullScreen:(NSNotification *)notification { -#ifdef DARK_UI - NSWindow* window = [notification object]; - NSView* contentView = [window contentView]; - [self removeCustomDrawHook: contentView]; - savedTitle = [[window title] copy]; - [window setTitle:@""]; + [customTitlebar setTitleString:title]; #endif } @@ -318,12 +216,15 @@ - (BOOL)isFullScreenSupported { return (version >= 0x1070); } - -(void)windowDidResize:(NSNotification *)notification { + +// BOBNOTE: this should be moved into the CustomTitlebarView class #ifdef DARK_UI + NSWindow* window = [notification object]; + if ([self isFullScreenSupported]) { - NSWindow* window = [notification object]; + NSView* themeView = [[window contentView] superview]; NSRect parentFrame = [themeView frame]; @@ -333,21 +234,20 @@ -(void)windowDidResize:(NSNotification *)notification oldFrame.size.width, // width oldFrame.size.height); - [fullScreenButtonView setFrame:newFrame]; [themeView setNeedsDisplay:YES]; } #endif } +// BOBNOTE: Consider moving this into the customTitlebarView class in which case you won't need to +// repeat this work every time you exit full screen mode. - (void)windowDidExitFullScreen:(NSNotification *)notification { NSWindow* window = [notification object]; NSView* contentView = [window contentView]; - NSView* themeView = [[window contentView] superview]; + NSView* themeView = [contentView superview]; + #ifdef DARK_UI - [self addCustomDrawHook: contentView]; - [window setTitle:savedTitle]; - [savedTitle release]; [themeView setNeedsDisplay:YES]; #endif @@ -380,6 +280,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { #endif #ifdef DARK_UI + if ([self isFullScreenSupported]) { windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; @@ -439,6 +340,27 @@ - (void)notifyDownloadError:(id)object { } - (void)windowDidBecomeKey:(NSNotification*)notification { +#ifdef DARK_UI + if (!isReentering) + { + NSWindow *thisWindow = [notification object]; + NSView* contentView = [thisWindow contentView]; + NSRect bounds = [[contentView superview] bounds]; + + customTitlebar = [[CustomTitlebarView alloc] initWithFrame:bounds]; + + // BOBNOTE: should get the initial title from a resource or app name as opposed to hard-coding + [customTitlebar setTitleString:@"Brackets"]; + + [customTitlebar setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [[contentView superview] addSubview:customTitlebar positioned:NSWindowBelow relativeTo:[[[contentView superview] subviews] objectAtIndex:0]]; + + NSButton *windowButton = [thisWindow standardWindowButton:NSWindowFullScreenButton]; + [windowButton setHidden:YES]; + isReentering = YES; + } +#endif + if (g_handler.get() && g_handler->GetBrowserId()) { // Give focus to the browser window. g_handler->GetBrowser()->GetHost()->SetFocus(true); @@ -495,14 +417,16 @@ - (void)cleanup:(id)window { @end +// BOBNOTE: Consider moving the AppDelegate interface into its own .h file // Receives notifications from the application. Will delete itself when done. @interface ClientAppDelegate : NSObject - (void)createApp:(id)object; -- (void)addCustomDrawHook:(NSView*)contentView; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; - (BOOL)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames; @end + +// BOBNOTE: Consider moving the AppDelegate implementation into its own .m file @implementation ClientAppDelegate - (id) init { @@ -567,6 +491,7 @@ - (void)createApp:(id)object { NSWindow* theWin = mainWnd; NSButton *windowButton; +// BOBNOTE: Consider moving this into the customTitlebarView class #ifdef CUSTOM_TRAFFIC_LIGHTS //hide buttons windowButton = [theWin standardWindowButton:NSWindowCloseButton]; @@ -612,13 +537,6 @@ - (void)createApp:(id)object { [mainWnd setReleasedWhenClosed:NO]; NSView* contentView = [mainWnd contentView]; -#ifdef DARK_UI - // Register our custom title bar rendering hook. - [self addCustomDrawHook:contentView]; - windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; - [windowButton setHidden:YES]; -#endif - // Create the handler. g_handler = new ClientHandler(); @@ -649,6 +567,7 @@ - (void)createApp:(id)object { NSView *themeView = [[mainWnd contentView] superview]; NSRect parentFrame = [themeView frame]; + // BOBNOTE: Consider moving this into the customTitlebarView class #ifdef CUSTOM_TRAFFIC_LIGHTS TrafficLightsViewController *tvController = [[TrafficLightsViewController alloc] init]; if ([NSBundle loadNibNamed: @"TrafficLights" owner: tvController]) @@ -727,20 +646,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)theAp return NSTerminateNow; } - -- (void)addCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, GetShellWindowFrameClass()); - -#ifdef LIGHT_CAPTION_TEXT - // Reset our frame view text cell background style - NSTextFieldCell * cell = [themeView titleCell]; - [cell setBackgroundStyle:NSBackgroundStyleLight]; -#endif -} - - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { if (!pendingOpenFiles) { ClientApplication * clientApp = (ClientApplication *)theApplication; diff --git a/appshell_paths.gypi b/appshell_paths.gypi index 17e3596b0..7d747d934 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -149,6 +149,8 @@ 'appshell/TrafficLightsView.mm', 'appshell/TrafficLightsViewController.h', 'appshell/TrafficLightsViewController.mm', + 'appshell/CustomTitlebarView.h', + 'appshell/CustomTitlebarView.m', 'appshell/FullScreenButton.h', 'appshell/FullScreenButton.mm', 'appshell/FullScreenView.h', @@ -177,6 +179,8 @@ 'appshell/TrafficLightsView.mm', 'appshell/TrafficLightsViewController.h', 'appshell/TrafficLightsViewController.mm', + 'appshell/CustomTitlebarView.h', + 'appshell/CustomTitlebarView.m', 'appshell/FullScreenButton.h', 'appshell/FullScreenButton.mm', 'appshell/FullScreenView.h', From 4205088ec38449bcb4d52d12d9bfff744dcc39f9 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Mon, 11 Nov 2013 18:13:10 -0800 Subject: [PATCH 03/12] various fixes and optimizations --- appshell/CustomTitlebarView.m | 31 +++-- appshell/cefclient_mac.mm | 51 ++------ appshell/client_handler_mac.mm | 212 ++++++++------------------------- 3 files changed, 80 insertions(+), 214 deletions(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index 2905e01c5..e77a78a7a 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -9,7 +9,7 @@ #import "CustomTitlebarView.h" #import "client_colors_mac.h" -#define titleTextHeight 16 +#define titleTextHeight 14 @implementation CustomTitlebarView @@ -18,6 +18,7 @@ @implementation CustomTitlebarView - (void)drawRect:(NSRect)dirtyRect { NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; + NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; NSRect windowFrame = [NSWindow frameRectForContentRect:[[[self window] contentView] bounds] styleMask:[[self window] styleMask]]; NSRect contentBounds = [[[self window] contentView] bounds]; @@ -26,29 +27,35 @@ - (void)drawRect:(NSRect)dirtyRect [[NSColor clearColor] set]; NSRectFill( titlebarRect ); + + [fillColor set]; + [NSGraphicsContext saveGraphicsState]; //This constant matches the radius for other macosx apps. //For some reason if we use the default value it is double that of safari etc. float cornerRadius = 4.0f; - - [[NSBezierPath bezierPathWithRoundedRect:titlebarRect - xRadius:cornerRadius - yRadius:cornerRadius] addClip]; - [[NSBezierPath bezierPathWithRect:titlebarRect] addClip]; - NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; - [fillColor set]; + NSBezierPath* clipPath = [NSBezierPath bezierPath]; + [clipPath appendBezierPathWithRoundedRect:titlebarRect xRadius:cornerRadius yRadius:cornerRadius]; + [clipPath moveToPoint: NSMakePoint(titlebarRect.origin.x, titlebarRect.origin.y)]; + [clipPath appendBezierPathWithRect: NSMakeRect(titlebarRect.origin.x, titlebarRect.origin.y, titlebarRect.size.width, titlebarRect.size.height / 2)]; + [clipPath addClip]; + NSRectFill(titlebarRect); - NSFont *titleFont = [NSFont fontWithName:@"HelveticaNeue-Bold" size:titleTextHeight]; + + NSFont *titleFont = [NSFont titleBarFontOfSize:titleTextHeight]; CGFloat stringWidth = [self widthOfString:titleString withFont:titleFont]; NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; + + NSLayoutManager *lm = [[NSLayoutManager alloc] init]; + int height = [lm defaultLineHeightForFont:titleFont]; if (stringWidth) { NSRect textRect = NSMakeRect(titlebarRect.origin.x + ((titlebarRect.size.width / 2) - (stringWidth / 2)), - titlebarRect.origin.y + ((titlebarRect.size.height / 2) - (titleTextHeight / 2)), + titlebarRect.origin.y + ((titlebarRect.size.height / 2) - (height / 2)) - 4, titlebarRect.size.width, titlebarRect.size.height); @@ -58,6 +65,10 @@ - (void)drawRect:(NSRect)dirtyRect NSForegroundColorAttributeName, nil]]; } + + [NSGraphicsContext restoreGraphicsState]; + + } - (CGFloat)widthOfString:(NSString *)string withFont:(NSFont *)font diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 3fef549b3..ff1bf6e81 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -152,9 +152,10 @@ - (void)setFullScreenButtonView:(NSView*)view; @implementation ClientWindowDelegate - (id) init { [super init]; - isReallyClosing = false; + isReallyClosing = NO; isReentering = NO; - + customTitlebar = nil; + fullScreenButtonView = nil; return self; } @@ -243,44 +244,19 @@ -(void)windowDidResize:(NSNotification *)notification // BOBNOTE: Consider moving this into the customTitlebarView class in which case you won't need to // repeat this work every time you exit full screen mode. - (void)windowDidExitFullScreen:(NSNotification *)notification { + // TODO: Clean this up... NSWindow* window = [notification object]; NSView* contentView = [window contentView]; NSView* themeView = [contentView superview]; - -#ifdef DARK_UI - [themeView setNeedsDisplay:YES]; -#endif - - NSWindow* theWin = window; NSRect parentFrame = [themeView frame]; NSButton *windowButton = nil; - -#ifdef CUSTOM_TRAFFIC_LIGHTS - //hide buttons - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; - - TrafficLightsViewController *controller = [[TrafficLightsViewController alloc] init]; - - if ([NSBundle loadNibNamed: @"TrafficLights" owner: controller]) - { - NSRect oldFrame = [controller.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [controller.view setFrame:newFrame]; - [themeView addSubview:controller.view]; + + if (fullScreenButtonView) { + [fullScreenButtonView removeFromSuperview]; + fullScreenButtonView = nil; } -#endif - #ifdef DARK_UI - if ([self isFullScreenSupported]) { windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; @@ -300,7 +276,6 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { } #endif - [themeView setNeedsDisplay:YES]; } @@ -349,8 +324,7 @@ - (void)windowDidBecomeKey:(NSNotification*)notification { customTitlebar = [[CustomTitlebarView alloc] initWithFrame:bounds]; - // BOBNOTE: should get the initial title from a resource or app name as opposed to hard-coding - [customTitlebar setTitleString:@"Brackets"]; + [customTitlebar setTitleString: [thisWindow title]]; [customTitlebar setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [[contentView superview] addSubview:customTitlebar positioned:NSWindowBelow relativeTo:[[[contentView superview] subviews] objectAtIndex:0]]; @@ -504,7 +478,6 @@ - (void)createApp:(id)object { #ifdef DARK_UI NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; - float fillComp[4] = {0.23137255f, 0.24705882f, 0.25490196f, 1.0}; // Background fill, solid for now. NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; [mainWnd setMinSize:NSMakeSize(kMinWindowWidth, kMinWindowHeight)]; @@ -762,14 +735,14 @@ int main(int argc, char* argv[]) { if ([[NSFileManager defaultManager] fileExistsAtPath:devFile]) { startupUrl = [NSURL fileURLWithPath:devFile]; } - +/* if (startupUrl == nil) { // If the dev file wasn't found, look for /Contents/www/index.html NSString* indexFile = [bundlePath stringByAppendingString:@"/Contents/www/index.html"]; if ([[NSFileManager defaultManager] fileExistsAtPath:indexFile]) { startupUrl = [NSURL fileURLWithPath:indexFile]; } - } + } */ } } @@ -790,7 +763,7 @@ int main(int argc, char* argv[]) { // Create the application delegate and window. [delegate performSelectorOnMainThread:@selector(createApp:) withObject:nil - waitUntilDone:NO]; + waitUntilDone:YES]; // Run the application message loop. CefRunMessageLoop(); diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 463f4be21..eed15fc68 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -18,18 +18,11 @@ #include "config.h" #include "client_colors_mac.h" - +#import "CustomTitlebarView.h" extern CefRefPtr g_handler; -// Custom draw interface for NSThemeFrame -@interface NSView (UndocumentedAPI) -- (float)roundedCornerRadius; -- (CGRect)_titlebarTitleRect; -- (NSTextFieldCell*)titleCell; -- (void)_drawTitleStringIn:(struct CGRect)arg1 withColor:(id)color; -@end // ClientHandler::ClientLifeSpanHandler implementation @@ -104,7 +97,8 @@ @interface PopupClientWindowDelegate : NSObject { NSWindow* window; NSView* fullScreenButtonView; BOOL isReallyClosing; - NSString* savedTitle; + BOOL isReentering; + CustomTitlebarView *customTitlebar; } - (IBAction)quit:(id)sender; - (IBAction)handleMenuAction:(id)sender; @@ -113,78 +107,21 @@ - (BOOL)windowShouldClose:(id)window; - (void)setClientHandler:(CefRefPtr)handler; - (void)setWindow:(NSWindow*)window; - (void)setFullScreenButtonView:(NSView*)view; -- (void)addCustomDrawHook:(NSView*)contentView; - (BOOL)isFullScreenSupported; +- (void)makeDark; +- (void)initUI; @end -/** - * The patched implementation for drawRect that lets us tweak - * the title bar. - */ -void PopupWindowFrameDrawRect(id self, SEL _cmd, NSRect rect) { - // Clear to 0 alpha - [[NSColor clearColor] set]; - NSRectFill( rect ); - //Obtain reference to our NSThemeFrame view - NSRect windowRect = [self frame]; - windowRect.origin = NSMakePoint(0,0); - //This constant matches the radius for other macosx apps. - //For some reason if we use the default value it is double that of safari etc. - float cornerRadius = 4.0f; - - //Clip our title bar render - [[NSBezierPath bezierPathWithRoundedRect:windowRect - xRadius:cornerRadius - yRadius:cornerRadius] addClip]; - [[NSBezierPath bezierPathWithRect:rect] addClip]; - - - - NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; - // Background fill, solid for now. - NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; - [fillColor set]; - NSRectFill( rect ); - NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; - NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; - // Render our title text - [self _drawTitleStringIn:[self _titlebarTitleRect] - withColor:[NSApp isActive] ? - activeColor : inactiveColor]; - -} - - -/** - * Create a custom class based on NSThemeFrame called - * ShellWindowFrame. ShellWindowFrame uses ShellWindowFrameDrawRect() - * as the implementation for the drawRect selector allowing us - * to draw the border/title bar the way we see fit. - */ -Class GetPopuplWindowFrameClass() { - // lazily change the class implementation if - // not done so already. - static Class k = NULL; - if (!k) { - // See http://cocoawithlove.com/2010/01/what-is-meta-class-in-objective-c.html - Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - k = objc_allocateClassPair(NSThemeFrame, "PopupWindowFrame", 0); - Method m0 = class_getInstanceMethod(NSThemeFrame, @selector(drawRect:)); - class_addMethod(k, @selector(drawRect:), - (IMP)PopupWindowFrameDrawRect, method_getTypeEncoding(m0)); - objc_registerClassPair(k); - } - return k; -} @implementation PopupClientWindowDelegate - (id) init { [super init]; - isReallyClosing = false; - savedTitle = nil; + isReallyClosing = NO; fullScreenButtonView = nil; + isReentering = NO; + customTitlebar = nil; return self; } @@ -210,27 +147,6 @@ - (IBAction)quit:(id)sender { clientHandler->DispatchCloseToNextBrowser(); } -- (void)addCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, GetPopuplWindowFrameClass()); - -#ifdef LIGHT_CAPTION_TEXT - // Reset our frame view text cell background style - NSTextFieldCell * cell = [themeView titleCell]; - [cell setBackgroundStyle:NSBackgroundStyleLight]; -#endif -} - -- (void)removeCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - - object_setClass(themeView, NSThemeFrame); -} - - (IBAction)handleMenuAction:(id)sender { if (clientHandler.get() && clientHandler->GetBrowserId()) { CefRefPtr browser = ClientHandler::GetBrowserForNativeWindow(window); @@ -278,19 +194,34 @@ - (void)setFullScreenButtonView:(NSView *)view { -(void)windowTitleDidChange:(NSString*)title { #ifdef DARK_UI - savedTitle = [title copy]; + [customTitlebar setTitleString:title]; #endif } - (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI - NSView* contentView = [window contentView]; - [self removeCustomDrawHook: contentView]; - savedTitle = [[window title] copy]; - [window setTitle:@""]; #endif } +-(void)makeDark { + if (!isReentering) + { + NSView* contentView = [window contentView]; + NSRect bounds = [[contentView superview] bounds]; + + customTitlebar = [[CustomTitlebarView alloc] initWithFrame:bounds]; + + [customTitlebar setTitleString: [window title]]; + + [customTitlebar setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [[contentView superview] addSubview:customTitlebar positioned:NSWindowBelow relativeTo:[[[contentView superview] subviews] objectAtIndex:0]]; + + NSButton *windowButton = [window standardWindowButton:NSWindowFullScreenButton]; + [windowButton setHidden:YES]; + isReentering = YES; + } +} + -(void)windowDidResize:(NSNotification *)notification { @@ -312,21 +243,13 @@ -(void)windowDidResize:(NSNotification *)notification #endif } -- (void)windowDidExitFullScreen:(NSNotification *)notification { -#ifdef DARK_UI - NSView* contentView = [window contentView]; - [self addCustomDrawHook: contentView]; - [window setTitle:savedTitle]; - [savedTitle release]; -#endif - - NSView * themeView = [[window contentView] superview]; - NSRect parentFrame = [themeView frame]; +- (void)initUI { NSWindow* theWin = window; - NSButton *windowButton = nil; + NSView* themeView = [[window contentView] superview]; + NSRect parentFrame = [themeView frame]; + NSButton* windowButton = nil; #ifdef CUSTOM_TRAFFIC_LIGHTS - //hide buttons windowButton = [theWin standardWindowButton:NSWindowCloseButton]; [windowButton setHidden:YES]; windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; @@ -340,7 +263,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { { NSRect oldFrame = [controller.view frame]; NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position + parentFrame.size.height - oldFrame.size.height - 4, // y position oldFrame.size.width, // width oldFrame.size.height); // height [controller.view setFrame:newFrame]; @@ -352,7 +275,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { if ([self isFullScreenSupported]) { windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; - + FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; if ([NSBundle loadNibNamed: @"FullScreen" owner: fsController]) { @@ -366,11 +289,18 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { [self setFullScreenButtonView:fsController.view]; } } + [self makeDark]; #endif + - [themeView setNeedsDisplay:YES]; } +- (void)windowDidExitFullScreen:(NSNotification *)notification { + [self initUI]; +} + + + // Called when the window is about to close. Perform the self-destruction // sequence by getting rid of the window. By returning YES, we allow the window @@ -412,6 +342,10 @@ - (void)cleanup:(id)window { } - (void)windowDidBecomeKey:(NSNotification*)notification { +#ifdef DARK_UI + [self makeDark]; +#endif + CefRefPtr browser = ClientHandler::GetBrowserForNativeWindow([notification object]); if(browser) { // Give focus to the browser window. @@ -450,59 +384,7 @@ - (void)windowDidResignKey:(NSNotification *)notification { [delegate setClientHandler:this]; [delegate setWindow:window]; [window setDelegate:delegate]; -#ifdef DARK_UI - NSView* contentView = [window contentView]; - [delegate addCustomDrawHook: contentView]; -#endif - - NSWindow* theWin = window; - NSView* themeView = [[window contentView] superview]; - NSRect parentFrame = [themeView frame]; - NSButton* windowButton = nil; - -#ifdef CUSTOM_TRAFFIC_LIGHTS - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; - - TrafficLightsViewController *controller = [[TrafficLightsViewController alloc] init]; - - if ([NSBundle loadNibNamed: @"TrafficLights" owner: controller]) - { - NSRect oldFrame = [controller.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - 4, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [controller.view setFrame:newFrame]; - [themeView addSubview:controller.view]; - } -#endif - -#ifdef DARK_UI - if ([delegate isFullScreenSupported]) { - windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; - [windowButton setHidden:YES]; - - FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; - if ([NSBundle loadNibNamed: @"FullScreen" owner: fsController]) - { - NSRect oldFrame = [fsController.view frame]; - NSRect newFrame = NSMakeRect(parentFrame.size.width - oldFrame.size.width - 4, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [fsController.view setFrame:newFrame]; - [themeView addSubview:fsController.view]; - [delegate setFullScreenButtonView:fsController.view]; - } - } -#endif - - [themeView setNeedsDisplay:YES]; + [delegate initUI]; } } From e2c36ca2589dd57e790fdf0021471e2e3630aa43 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Tue, 12 Nov 2013 11:37:07 -0800 Subject: [PATCH 04/12] fix issue with app disappearing after going full screen --- appshell/CustomTitlebarView.m | 5 +++-- appshell/cefclient_mac.mm | 7 +++++++ appshell/client_handler_mac.mm | 9 ++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index e77a78a7a..a3198c8ff 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -35,12 +35,14 @@ - (void)drawRect:(NSRect)dirtyRect //For some reason if we use the default value it is double that of safari etc. float cornerRadius = 4.0f; + // make a clip mask that is rounded on top and square on the bottom... NSBezierPath* clipPath = [NSBezierPath bezierPath]; [clipPath appendBezierPathWithRoundedRect:titlebarRect xRadius:cornerRadius yRadius:cornerRadius]; [clipPath moveToPoint: NSMakePoint(titlebarRect.origin.x, titlebarRect.origin.y)]; [clipPath appendBezierPathWithRect: NSMakeRect(titlebarRect.origin.x, titlebarRect.origin.y, titlebarRect.size.width, titlebarRect.size.height / 2)]; [clipPath addClip]; + // Fill in with the Dark UI color NSRectFill(titlebarRect); @@ -52,6 +54,7 @@ - (void)drawRect:(NSRect)dirtyRect NSLayoutManager *lm = [[NSLayoutManager alloc] init]; int height = [lm defaultLineHeightForFont:titleFont]; + // Draw the title text if (stringWidth) { NSRect textRect = NSMakeRect(titlebarRect.origin.x + ((titlebarRect.size.width / 2) - (stringWidth / 2)), @@ -67,8 +70,6 @@ - (void)drawRect:(NSRect)dirtyRect } [NSGraphicsContext restoreGraphicsState]; - - } - (CGFloat)widthOfString:(NSString *)string withFont:(NSFont *)font diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index ff1bf6e81..530478264 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -241,6 +241,12 @@ -(void)windowDidResize:(NSNotification *)notification #endif } +- (void)windowWillEnterFullScreen:(NSNotification *)notification { + [NSApp activateIgnoringOtherApps:YES]; + [NSApp unhide:nil]; +} + + // BOBNOTE: Consider moving this into the customTitlebarView class in which case you won't need to // repeat this work every time you exit full screen mode. - (void)windowDidExitFullScreen:(NSNotification *)notification { @@ -578,6 +584,7 @@ - (void)createApp:(id)object { [mainWnd display]; [mainWnd makeKeyAndOrderFront: nil]; [NSApp requestUserAttention:NSInformationalRequest]; + [NSApp unhide:nil]; } diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index eed15fc68..4061dc10d 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -198,11 +198,6 @@ -(void)windowTitleDidChange:(NSString*)title { #endif } -- (void)windowWillEnterFullScreen:(NSNotification *)notification { -#ifdef DARK_UI -#endif -} - -(void)makeDark { if (!isReentering) { @@ -300,6 +295,10 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { } +- (void)windowWillEnterFullScreen:(NSNotification *)notification { + [NSApp activateIgnoringOtherApps:YES]; + [NSApp unhide:nil]; +} // Called when the window is about to close. Perform the self-destruction From dd08f7a56115e89a64ddf7964519223f0d0a220e Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Tue, 12 Nov 2013 11:59:20 -0800 Subject: [PATCH 05/12] hopefully this fixes it... --- appshell/cefclient_mac.mm | 15 +++++++++++++-- appshell/client_handler_mac.mm | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 530478264..98e5bf015 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -244,6 +244,17 @@ -(void)windowDidResize:(NSNotification *)notification - (void)windowWillEnterFullScreen:(NSNotification *)notification { [NSApp activateIgnoringOtherApps:YES]; [NSApp unhide:nil]; + NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; + + [contentView setNeedsDisplay:YES]; +} + +- (void)windowDidEnterFullScreen:(NSNotification *)notification { + NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; + + [contentView setNeedsDisplay:YES]; } @@ -742,14 +753,14 @@ int main(int argc, char* argv[]) { if ([[NSFileManager defaultManager] fileExistsAtPath:devFile]) { startupUrl = [NSURL fileURLWithPath:devFile]; } -/* + if (startupUrl == nil) { // If the dev file wasn't found, look for /Contents/www/index.html NSString* indexFile = [bundlePath stringByAppendingString:@"/Contents/www/index.html"]; if ([[NSFileManager defaultManager] fileExistsAtPath:indexFile]) { startupUrl = [NSURL fileURLWithPath:indexFile]; } - } */ + } } } diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 4061dc10d..aee71b824 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -301,6 +301,11 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { } +- (void)windowDidEnterFullScreen:(NSNotification *)notification { + NSView* contentView = [window contentView]; + [contentView setNeedsDisplay:YES]; +} + // Called when the window is about to close. Perform the self-destruction // sequence by getting rid of the window. By returning YES, we allow the window // to be removed from the screen. From 59ac8f02cf7560ba89f8decf662c41e56a5d0296 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Tue, 12 Nov 2013 15:27:32 -0800 Subject: [PATCH 06/12] isolate hacks to >= 10.9 --- appshell/cefclient_mac.mm | 33 ++++++++++++++++++++++++--------- appshell/client_handler_mac.mm | 23 +++++++++++++++++++---- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 98e5bf015..0488332ab 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -217,6 +217,12 @@ - (BOOL)isFullScreenSupported { return (version >= 0x1070); } +-(BOOL)needsFullScreenActivateHack { + SInt32 version; + Gestalt(gestaltSystemVersion, &version); + return (version >= 0x1090); +} + -(void)windowDidResize:(NSNotification *)notification { @@ -241,20 +247,29 @@ -(void)windowDidResize:(NSNotification *)notification #endif } + - (void)windowWillEnterFullScreen:(NSNotification *)notification { - [NSApp activateIgnoringOtherApps:YES]; - [NSApp unhide:nil]; - NSWindow* window = [notification object]; - NSView* contentView = [window contentView]; +#ifdef DARK_UI + if ([self needsFullScreenActivateHack]) { + [NSApp activateIgnoringOtherApps:YES]; + [NSApp unhide:nil]; + NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; - [contentView setNeedsDisplay:YES]; + [contentView setNeedsDisplay:YES]; + } +#endif } - (void)windowDidEnterFullScreen:(NSNotification *)notification { - NSWindow* window = [notification object]; - NSView* contentView = [window contentView]; - - [contentView setNeedsDisplay:YES]; +#ifdef DARK_UI + if ([self needsFullScreenActivateHack]) { + NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; + + [contentView setNeedsDisplay:YES]; + } +#endif } diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index aee71b824..dde7d8efc 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -188,6 +188,13 @@ - (BOOL)isFullScreenSupported { return (version >= 0x1070); } + +-(BOOL)needsFullScreenActivateHack { + SInt32 version; + Gestalt(gestaltSystemVersion, &version); + return (version >= 0x1090); +} + - (void)setFullScreenButtonView:(NSView *)view { fullScreenButtonView = view; } @@ -296,14 +303,22 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { - (void)windowWillEnterFullScreen:(NSNotification *)notification { - [NSApp activateIgnoringOtherApps:YES]; - [NSApp unhide:nil]; +#ifdef DARK_UI + if ([self needsFullScreenActivateHack]) { + [NSApp activateIgnoringOtherApps:YES]; + [NSApp unhide:nil]; + } +#endif } - (void)windowDidEnterFullScreen:(NSNotification *)notification { - NSView* contentView = [window contentView]; - [contentView setNeedsDisplay:YES]; +#ifdef DARK_UI + if ([self needsFullScreenActivateHack]) { + NSView* contentView = [window contentView]; + [contentView setNeedsDisplay:YES]; + } +#endif } // Called when the window is about to close. Perform the self-destruction From 2d4b38c0c070b8c396bbd82be701b372c766e339 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Tue, 12 Nov 2013 17:39:29 -0800 Subject: [PATCH 07/12] update titlebar font --- appshell/CustomTitlebarView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index a3198c8ff..ff43a9124 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -9,7 +9,7 @@ #import "CustomTitlebarView.h" #import "client_colors_mac.h" -#define titleTextHeight 14 +#define titleTextHeight 13 @implementation CustomTitlebarView From e85b04afe8c37c002a891cbbfcbd0c2b1d0135b0 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Tue, 12 Nov 2013 17:43:29 -0800 Subject: [PATCH 08/12] update copyright thx @jasonsanjose --- appshell/CustomTitlebarView.h | 30 ++++++++++++++++++++++-------- appshell/CustomTitlebarView.m | 30 ++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/appshell/CustomTitlebarView.h b/appshell/CustomTitlebarView.h index 751c37589..4c46a4ca0 100644 --- a/appshell/CustomTitlebarView.h +++ b/appshell/CustomTitlebarView.h @@ -1,11 +1,25 @@ -// -// CustomTitlebarView.h -// appshell -// -// Created by Bob Easterday on 11/6/13. -// -// - +/* + * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ #import @interface CustomTitlebarView : NSView diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index ff43a9124..9eafc5feb 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -1,11 +1,25 @@ -// -// CustomTitlebarView.m -// appshell -// -// Created by Bob Easterday on 11/6/13. -// -// - +/* + * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ #import "CustomTitlebarView.h" #import "client_colors_mac.h" From 24cd05073d6b2ea2c6e2a3d5e11438907f3309ef Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Tue, 12 Nov 2013 22:04:14 -0800 Subject: [PATCH 09/12] fix double up on the fs button --- appshell/client_handler_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index dde7d8efc..69ee308a1 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -304,6 +304,10 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { - (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI + if (fullScreenButtonView) { + [fullScreenButtonView removeFromSuperview]; + fullScreenButtonView = nil; + } if ([self needsFullScreenActivateHack]) { [NSApp activateIgnoringOtherApps:YES]; [NSApp unhide:nil]; From ede5832a01c35c6ccc79bb48b892b91a3a7b6440 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Wed, 13 Nov 2013 11:32:22 -0800 Subject: [PATCH 10/12] code cleanup and fixes --- appshell/CustomTitlebarView.m | 22 +++--- appshell/cefclient_mac.mm | 135 ++++++++++++++++++--------------- appshell/client_handler_mac.mm | 114 ++++++++++++++++------------ 3 files changed, 149 insertions(+), 122 deletions(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index 9eafc5feb..f7cd6ceb7 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -33,22 +33,22 @@ - (void)drawRect:(NSRect)dirtyRect { NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; - NSRect windowFrame = [NSWindow frameRectForContentRect:[[[self window] contentView] bounds] styleMask:[[self window] styleMask]]; - NSRect contentBounds = [[[self window] contentView] bounds]; - - NSRect titlebarRect = NSMakeRect(0, 0, self.bounds.size.width, windowFrame.size.height - contentBounds.size.height); - titlebarRect.origin.y = self.bounds.size.height - titlebarRect.size.height; - + NSRect windowFrame = [NSWindow frameRectForContentRect:[[[self window] contentView] bounds] styleMask:[[self window] styleMask]]; + NSRect contentBounds = [[[self window] contentView] bounds]; + + NSRect titlebarRect = NSMakeRect(0, 0, self.bounds.size.width, windowFrame.size.height - contentBounds.size.height); + titlebarRect.origin.y = self.bounds.size.height - titlebarRect.size.height; + [[NSColor clearColor] set]; NSRectFill( titlebarRect ); [fillColor set]; - + [NSGraphicsContext saveGraphicsState]; //This constant matches the radius for other macosx apps. //For some reason if we use the default value it is double that of safari etc. float cornerRadius = 4.0f; - + // make a clip mask that is rounded on top and square on the bottom... NSBezierPath* clipPath = [NSBezierPath bezierPath]; [clipPath appendBezierPathWithRoundedRect:titlebarRect xRadius:cornerRadius yRadius:cornerRadius]; @@ -58,8 +58,8 @@ - (void)drawRect:(NSRect)dirtyRect // Fill in with the Dark UI color NSRectFill(titlebarRect); - - + + NSFont *titleFont = [NSFont titleBarFontOfSize:titleTextHeight]; CGFloat stringWidth = [self widthOfString:titleString withFont:titleFont]; NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; @@ -67,7 +67,7 @@ - (void)drawRect:(NSRect)dirtyRect NSLayoutManager *lm = [[NSLayoutManager alloc] init]; int height = [lm defaultLineHeightForFont:titleFont]; - + // Draw the title text if (stringWidth) { diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 0488332ab..b63bb2db5 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -134,6 +134,7 @@ - (void)menuWillOpen:(NSMenu *)menu { @interface ClientWindowDelegate : NSObject { BOOL isReallyClosing; NSView* fullScreenButtonView; + NSView* trafficLightsView; BOOL isReentering; CustomTitlebarView *customTitlebar; } @@ -147,6 +148,7 @@ - (void)notifyConsoleMessage:(id)object; - (void)notifyDownloadComplete:(id)object; - (void)notifyDownloadError:(id)object; - (void)setFullScreenButtonView:(NSView*)view; +- (void)setTrafficLightsView:(NSView*)view; @end @implementation ClientWindowDelegate @@ -156,6 +158,7 @@ - (id) init { isReentering = NO; customTitlebar = nil; fullScreenButtonView = nil; + trafficLightsView = nil; return self; } @@ -201,13 +204,20 @@ - (IBAction)quit:(id)sender { } -- (void)setFullScreenButtonView:(NSView *)view { +-(void)setFullScreenButtonView:(NSView *)view { fullScreenButtonView = view; } + +-(void)setTrafficLightsView:(NSView *)view { + trafficLightsView = view; +} + -(void)windowTitleDidChange:(NSString*)title { #ifdef DARK_UI - [customTitlebar setTitleString:title]; + if (customTitlebar) { + [customTitlebar setTitleString:title]; + } #endif } @@ -250,12 +260,22 @@ -(void)windowDidResize:(NSNotification *)notification - (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI + if (fullScreenButtonView) { + [fullScreenButtonView removeFromSuperview]; + fullScreenButtonView = nil; + } + if (trafficLightsView) { + [trafficLightsView setHidden:YES]; + } + if (customTitlebar) { + [customTitlebar setHidden:YES]; + } + if ([self needsFullScreenActivateHack]) { [NSApp activateIgnoringOtherApps:YES]; [NSApp unhide:nil]; NSWindow* window = [notification object]; NSView* contentView = [window contentView]; - [contentView setNeedsDisplay:YES]; } #endif @@ -272,25 +292,39 @@ - (void)windowDidEnterFullScreen:(NSNotification *)notification { #endif } - -// BOBNOTE: Consider moving this into the customTitlebarView class in which case you won't need to -// repeat this work every time you exit full screen mode. -- (void)windowDidExitFullScreen:(NSNotification *)notification { - // TODO: Clean this up... - NSWindow* window = [notification object]; - NSView* contentView = [window contentView]; +-(void)initUI:(NSWindow*)mainWindow { + NSView* contentView = [mainWindow contentView]; NSView* themeView = [contentView superview]; - NSWindow* theWin = window; NSRect parentFrame = [themeView frame]; NSButton *windowButton = nil; - - if (fullScreenButtonView) { - [fullScreenButtonView removeFromSuperview]; - fullScreenButtonView = nil; + +#ifdef CUSTOM_TRAFFIC_LIGHTS + if (!trafficLightsView) { + windowButton = [mainWindow standardWindowButton:NSWindowCloseButton]; + [windowButton setHidden:YES]; + windowButton = [mainWindow standardWindowButton:NSWindowMiniaturizeButton]; + [windowButton setHidden:YES]; + windowButton = [mainWindow standardWindowButton:NSWindowZoomButton]; + [windowButton setHidden:YES]; + + TrafficLightsViewController *tvController = [[TrafficLightsViewController alloc] init]; + if ([NSBundle loadNibNamed: @"TrafficLights" owner: tvController]) + { + NSRect oldFrame = [tvController.view frame]; + NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position + parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position + oldFrame.size.width, // width + oldFrame.size.height); // height + [tvController.view setFrame:newFrame]; + [themeView addSubview:tvController.view]; + [self setTrafficLightsView:tvController.view]; + } } + +#endif #ifdef DARK_UI - if ([self isFullScreenSupported]) { - windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; + if ([self isFullScreenSupported] && !fullScreenButtonView) { + windowButton = [mainWindow standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; @@ -308,9 +342,28 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { } #endif + +} + +- (void)windowDidExitFullScreen:(NSNotification *)notification { + // This effectively recreates the full screen button in it's default \ + // state. Don't do this until after animation has completed or it will + // be in the wrong state and look funny... + NSWindow* window = [notification object]; + [self initUI:window]; } +-(void)windowWillExitFullScreen:(NSNotification *)notification { + // show the buttons and title bar so they appear during the + // transition from fullscreen back to normal + if (customTitlebar) { + [customTitlebar setHidden:NO]; + } + if (trafficLightsView) { + [trafficLightsView setHidden:NO]; + } +} - (void)alert:(NSString*)title withMessage:(NSString*)message { NSAlert *alert = [NSAlert alertWithMessageText:title @@ -497,16 +550,7 @@ - (void)createApp:(id)object { NSWindow* theWin = mainWnd; NSButton *windowButton; -// BOBNOTE: Consider moving this into the customTitlebarView class -#ifdef CUSTOM_TRAFFIC_LIGHTS - //hide buttons - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; -#endif + #ifdef DARK_UI NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; @@ -569,42 +613,7 @@ - (void)createApp:(id)object { CefBrowserHost::CreateBrowserSync(window_info, g_handler.get(), [str UTF8String], settings); - NSView *themeView = [[mainWnd contentView] superview]; - NSRect parentFrame = [themeView frame]; - - // BOBNOTE: Consider moving this into the customTitlebarView class -#ifdef CUSTOM_TRAFFIC_LIGHTS - TrafficLightsViewController *tvController = [[TrafficLightsViewController alloc] init]; - if ([NSBundle loadNibNamed: @"TrafficLights" owner: tvController]) - { - NSRect oldFrame = [tvController.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [tvController.view setFrame:newFrame]; - [themeView addSubview:tvController.view]; - } - -#endif - -#ifdef DARK_UI - if ([delegate isFullScreenSupported]) { - FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; - if ([NSBundle loadNibNamed: @"FullScreen" owner: fsController]) - { - NSRect oldFrame = [fsController.view frame]; - NSRect newFrame = NSMakeRect(parentFrame.size.width - oldFrame.size.width - 4, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [fsController.view setFrame:newFrame]; - [themeView addSubview:fsController.view]; - [delegate setFullScreenButtonView:fsController.view]; - } - } -#endif - + [delegate initUI:mainWnd]; // Show the window. [mainWnd display]; diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 69ee308a1..78bd996eb 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -96,8 +96,8 @@ @interface PopupClientWindowDelegate : NSObject { CefRefPtr clientHandler; NSWindow* window; NSView* fullScreenButtonView; + NSView* trafficLightsView; BOOL isReallyClosing; - BOOL isReentering; CustomTitlebarView *customTitlebar; } - (IBAction)quit:(id)sender; @@ -107,6 +107,7 @@ - (BOOL)windowShouldClose:(id)window; - (void)setClientHandler:(CefRefPtr)handler; - (void)setWindow:(NSWindow*)window; - (void)setFullScreenButtonView:(NSView*)view; +- (void)setTrafficLightsView:(NSView*)view; - (BOOL)isFullScreenSupported; - (void)makeDark; - (void)initUI; @@ -120,30 +121,12 @@ - (id) init { [super init]; isReallyClosing = NO; fullScreenButtonView = nil; - isReentering = NO; customTitlebar = nil; + trafficLightsView = nil; return self; } - (IBAction)quit:(id)sender { - /* - CefRefPtr browser; - - // If the main browser exists, send the command to that browser - if (clientHandler->GetBrowserId()) - browser = clientHandler->GetBrowser(); - - if (!browser) - browser = ClientHandler::GetBrowserForNativeWindow(window); - - // TODO: we should have a "get frontmost brackets window" command for this - - if (clientHandler && browser) { - clientHandler->SendJSCommand(browser, FILE_QUIT); - } else { - [NSApp terminate:nil]; - } - */ clientHandler->DispatchCloseToNextBrowser(); } @@ -195,18 +178,24 @@ -(BOOL)needsFullScreenActivateHack { return (version >= 0x1090); } -- (void)setFullScreenButtonView:(NSView *)view { +-(void)setFullScreenButtonView:(NSView *)view { fullScreenButtonView = view; } +-(void)setTrafficLightsView:(NSView *)view { + trafficLightsView = view; +} + -(void)windowTitleDidChange:(NSString*)title { #ifdef DARK_UI - [customTitlebar setTitleString:title]; + if (customTitlebar) { + [customTitlebar setTitleString:title]; + } #endif } -(void)makeDark { - if (!isReentering) + if (!customTitlebar) { NSView* contentView = [window contentView]; NSRect bounds = [[contentView superview] bounds]; @@ -217,10 +206,6 @@ -(void)makeDark { [customTitlebar setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [[contentView superview] addSubview:customTitlebar positioned:NSWindowBelow relativeTo:[[[contentView superview] subviews] objectAtIndex:0]]; - - NSButton *windowButton = [window standardWindowButton:NSWindowFullScreenButton]; - [windowButton setHidden:YES]; - isReentering = YES; } } @@ -228,7 +213,7 @@ -(void)makeDark { -(void)windowDidResize:(NSNotification *)notification { #ifdef DARK_UI - if ([self isFullScreenSupported]) { + if ([self isFullScreenSupported] && fullScreenButtonView) { NSView* themeView = [[window contentView] superview]; NSRect parentFrame = [themeView frame]; @@ -252,29 +237,32 @@ - (void)initUI { NSButton* windowButton = nil; #ifdef CUSTOM_TRAFFIC_LIGHTS - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; - - TrafficLightsViewController *controller = [[TrafficLightsViewController alloc] init]; - - if ([NSBundle loadNibNamed: @"TrafficLights" owner: controller]) - { - NSRect oldFrame = [controller.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - 4, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [controller.view setFrame:newFrame]; - [themeView addSubview:controller.view]; + if (!trafficLightsView) { + windowButton = [theWin standardWindowButton:NSWindowCloseButton]; + [windowButton setHidden:YES]; + windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; + [windowButton setHidden:YES]; + windowButton = [theWin standardWindowButton:NSWindowZoomButton]; + [windowButton setHidden:YES]; + + TrafficLightsViewController *tlController = [[TrafficLightsViewController alloc] init]; + + if ([NSBundle loadNibNamed: @"TrafficLights" owner: tlController]) + { + NSRect oldFrame = [tlController.view frame]; + NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position + parentFrame.size.height - oldFrame.size.height - 4, // y position + oldFrame.size.width, // width + oldFrame.size.height); // height + [tlController.view setFrame:newFrame]; + [themeView addSubview:tlController.view]; + [self setTrafficLightsView:tlController.view]; + } } #endif #ifdef DARK_UI - if ([self isFullScreenSupported]) { + if ([self isFullScreenSupported] && !fullScreenButtonView) { windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; @@ -297,20 +285,48 @@ - (void)initUI { } -- (void)windowDidExitFullScreen:(NSNotification *)notification { +-(void)windowWillExitFullScreen:(NSNotification *)notification { + // unhide these so they appear as the window + // transforms from full screen back to normal + if (customTitlebar) { + [customTitlebar setHidden:NO]; + } + if (trafficLightsView) { + [trafficLightsView setHidden:NO]; + } +} + + +-(void)windowDidExitFullScreen:(NSNotification *)notification { + // This effectively recreates the fs button + // but we have to wait until after the animation + // is complete to create the button. it will display + // in the wrong state if we do it sooner [self initUI]; } - (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI + // hide all of the elements so the os can make our + // window's content view can take up the entire display surface if (fullScreenButtonView) { [fullScreenButtonView removeFromSuperview]; fullScreenButtonView = nil; } + if (trafficLightsView) { + [trafficLightsView setHidden:YES]; + } + if (customTitlebar) { + [customTitlebar setHidden:YES]; + } if ([self needsFullScreenActivateHack]) { + // HACK to make sure that window is activate + // when going into full screen mode [NSApp activateIgnoringOtherApps:YES]; [NSApp unhide:nil]; + NSView* contentView = [window contentView]; + [contentView setNeedsDisplay:YES]; } #endif } @@ -319,6 +335,8 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { - (void)windowDidEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI if ([self needsFullScreenActivateHack]) { + // HACK to make sure that window is activate + // when going into full screen mode NSView* contentView = [window contentView]; [contentView setNeedsDisplay:YES]; } From 10e3626e5e80e7d744a05d1528fc07379693bacb Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Wed, 13 Nov 2013 11:55:14 -0800 Subject: [PATCH 11/12] fudge --- appshell/CustomTitlebarView.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index f7cd6ceb7..51dc34efd 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -24,6 +24,7 @@ #import "client_colors_mac.h" #define titleTextHeight 13 +#define fudge 4 @implementation CustomTitlebarView @@ -72,7 +73,7 @@ - (void)drawRect:(NSRect)dirtyRect if (stringWidth) { NSRect textRect = NSMakeRect(titlebarRect.origin.x + ((titlebarRect.size.width / 2) - (stringWidth / 2)), - titlebarRect.origin.y + ((titlebarRect.size.height / 2) - (height / 2)) - 4, + titlebarRect.origin.y + ((titlebarRect.size.height / 2) - (height / 2)) - fudge, titlebarRect.size.width, titlebarRect.size.height); From 182fa08fe4aaa0b93553eb6b91fef59c2545cef1 Mon Sep 17 00:00:00 2001 From: JeffryBooher Date: Wed, 13 Nov 2013 11:59:26 -0800 Subject: [PATCH 12/12] code cleanup after refactoring --- appshell/cefclient_mac.mm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index b63bb2db5..4f86a374e 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -547,11 +547,6 @@ - (void)createApp:(id)object { backing:NSBackingStoreBuffered defer:NO]; - NSWindow* theWin = mainWnd; - NSButton *windowButton; - - - #ifdef DARK_UI NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; // Background fill, solid for now.