Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #478 from adobe/jeff/yosemite-traffic-lights
Browse files Browse the repository at this point in the history
Enable Yosemite Native Traffic Lights on OSX 10.10
  • Loading branch information
ingorichter committed Oct 21, 2014
2 parents 0736837 + 2452e1d commit dc6e67e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 15 deletions.
33 changes: 26 additions & 7 deletions appshell/cefclient_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,35 @@ -(void)windowTitleDidChange:(NSString*)title {
#endif
}

-(BOOL)isRunningOnYosemite {
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSString* version = [dict objectForKey:@"ProductVersion"];
return [version hasPrefix:@"10.10"];
}

- (BOOL)isFullScreenSupported {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1070);
// Return False on Yosemite so we
// don't draw our own full screen button
// and handle full screen mode
if (![self isRunningOnYosemite]) {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1070);
}
return false;
}

-(BOOL)needsFullScreenActivateHack {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1090);
if (![self isRunningOnYosemite]) {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1090);
}
return false;
}

-(BOOL)useSystemTrafficLights {
return [self isRunningOnYosemite];
}

-(void)windowDidResize:(NSNotification *)notification
Expand Down Expand Up @@ -299,7 +318,7 @@ -(void)initUI:(NSWindow*)mainWindow {
NSButton *windowButton = nil;

#ifdef CUSTOM_TRAFFIC_LIGHTS
if (!trafficLightsView) {
if (![self useSystemTrafficLights] && !trafficLightsView) {
windowButton = [mainWindow standardWindowButton:NSWindowCloseButton];
[windowButton setHidden:YES];
windowButton = [mainWindow standardWindowButton:NSWindowMiniaturizeButton];
Expand Down
36 changes: 28 additions & 8 deletions appshell/client_handler_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,35 @@ - (void)setIsReallyClosing {
isReallyClosing = true;
}

- (BOOL)isFullScreenSupported {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1070);
-(BOOL)isRunningOnYosemite {
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSString* version = [dict objectForKey:@"ProductVersion"];
return [version hasPrefix:@"10.10"];
}

- (BOOL)isFullScreenSupported {
// Return False on Yosemite so we
// don't draw our own full screen button
// and handle full screen mode
if (![self isRunningOnYosemite]) {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1070);
}
return false;
}

-(BOOL)needsFullScreenActivateHack {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1090);
if (![self isRunningOnYosemite]) {
SInt32 version;
Gestalt(gestaltSystemVersion, &version);
return (version >= 0x1090);
}
return false;
}

-(BOOL)useSystemTrafficLights {
return [self isRunningOnYosemite];
}

-(void)setFullScreenButtonView:(NSView *)view {
Expand All @@ -186,6 +204,8 @@ -(void)setTrafficLightsView:(NSView *)view {
trafficLightsView = view;
}



-(void)windowTitleDidChange:(NSString*)title {
#ifdef DARK_UI
if (customTitlebar) {
Expand Down Expand Up @@ -237,7 +257,7 @@ - (void)initUI {
NSButton* windowButton = nil;

#ifdef CUSTOM_TRAFFIC_LIGHTS
if (!trafficLightsView) {
if (![self useSystemTrafficLights] && !trafficLightsView) {
windowButton = [theWin standardWindowButton:NSWindowCloseButton];
[windowButton setHidden:YES];
windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton];
Expand Down

0 comments on commit dc6e67e

Please sign in to comment.