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 #482 from adobe/jeff/yosemite-traffic-lights
Browse files Browse the repository at this point in the history
Turn off custom Traffic Lights on Yosemite
  • Loading branch information
RaymondLim committed Oct 24, 2014
2 parents 3907765 + 601f207 commit 69b15e8
Show file tree
Hide file tree
Showing 3 changed files with 65 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
11 changes: 11 additions & 0 deletions appshell/client_handler_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ bool ClientHandler::OnKeyEvent(CefRefPtr<CefBrowser> browser,

void ClientHandler::ComputePopupPlacement(CefWindowInfo& windowInfo)
{
// both must be set to work
if (windowInfo.width == CW_USEDEFAULT ||
windowInfo.height == CW_USEDEFAULT) {
// force both vals to be CW_USEDEFAULT in this
// case because Windows doesn't correctly handle
// only one value being is supplied on input
windowInfo.width = CW_USEDEFAULT;
windowInfo.height = CW_USEDEFAULT;
return;
}

RECT rectMainWnd;
gMainWnd->GetWindowRect(&rectMainWnd);

Expand Down

0 comments on commit 69b15e8

Please sign in to comment.