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

Enable Yosemite Native Traffic Lights on OSX 10.10 #478

Merged
merged 3 commits into from
Oct 21, 2014
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
// this API returns nil prior to Yosemite
NSDictionary * dict = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think we should be consistent with the placement of the *.

return dict != nil;
}

- (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 {
// this API returns nil prior to Yosemite
NSDictionary * dict = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
return dict != nil;
}

- (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