From cbb77ee500c3f32e8f589bbc110e6bcae4b66e10 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Tue, 8 Dec 2015 17:16:15 +0530 Subject: [PATCH 1/8] [MAC] Changes required for upgrading CEF to 2357 on MAC --- Gruntfile.js | 2 +- appshell.gyp | 2 +- appshell/FullScreenButton.mm | 10 +--------- appshell/TrafficLightButton.mm | 16 +--------------- appshell/client_colors_mac.h | 10 +++++++++- appshell/client_handler.cpp | 18 ++++++++++-------- appshell/client_handler.h | 20 +++++++++++--------- appshell_paths.gypi | 7 ++++--- 8 files changed, 38 insertions(+), 47 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2c4a9bf29..1d7622041 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -224,7 +224,7 @@ module.exports = function (grunt) { }, "cef": { "url" : "http://s3.amazonaws.com/files.brackets.io/cef", - "version" : "3.2171.1902" + "version" : "3.2357.1291" }, "node": { "version" : "0.10.24" diff --git a/appshell.gyp b/appshell.gyp index 64e343668..18c89cd91 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -33,7 +33,7 @@ 'SDKROOT': '', 'CLANG_CXX_LANGUAGE_STANDARD' : 'c++0x', 'COMBINE_HIDPI_IMAGES': 'YES', - 'ARCHS': "$(ARCHS_STANDARD_32_BIT)", + 'ARCHS': "$(ARCHS_STANDARD_64_BIT)", 'FRAMEWORK_SEARCH_PATHS': [ '$(inherited)', '$(CONFIGURATION)' diff --git a/appshell/FullScreenButton.mm b/appshell/FullScreenButton.mm index 7b0698425..c88fd0fe9 100644 --- a/appshell/FullScreenButton.mm +++ b/appshell/FullScreenButton.mm @@ -23,15 +23,7 @@ #import "FullScreenButton.h" //these are defined in MainMainu.xib file -@implementation FullScreenButton { - NSImage *inactive; - NSImage *active; - NSImage *hover; - NSImage *pressed; - BOOL activeState; - BOOL hoverState; - BOOL pressedState; -} +@implementation FullScreenButton -(id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; diff --git a/appshell/TrafficLightButton.mm b/appshell/TrafficLightButton.mm index 0e64faa6e..d5088418e 100644 --- a/appshell/TrafficLightButton.mm +++ b/appshell/TrafficLightButton.mm @@ -27,21 +27,7 @@ static const int MINIMIZE_BUTTON_TAG = 1001; static const int ZOOM_BUTTON_TAG = 1002; -@implementation TrafficLightButton { - NSImage *inactive; - NSImage *active; - NSImage *hover; - NSImage *pressed; - NSImage *dirtyInactive; - NSImage *dirtyActive; - NSImage *dirtyHover; - NSImage *dirtyPressed; - BOOL activeState; - BOOL hoverState; - BOOL pressedState; - BOOL dirtyState; - BOOL closeButton; -} +@implementation TrafficLightButton -(id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; diff --git a/appshell/client_colors_mac.h b/appshell/client_colors_mac.h index ea022cba9..bf9eb252f 100644 --- a/appshell/client_colors_mac.h +++ b/appshell/client_colors_mac.h @@ -22,7 +22,15 @@ */ //title bar background -static const float fillComp[4] = {0.23137255f, 0.24705882f, 0.25490196f, 1.0}; + +#ifndef CLIENT_COLORS +#define CLIENT_COLORS + +static CGFloat fillComp[4] = {0.23137255f, 0.24705882f, 0.25490196f, 1.0}; + //title text color static const float activeComp[4] = {0.77254902f, 0.77254902f, 0.77254902f, 1.0}; static const float inactiveComp[4] = {0.50f, 0.50f, 0.50f, 1.0}; + +#endif + diff --git a/appshell/client_handler.cpp b/appshell/client_handler.cpp index 50a0fe231..07c64c1e0 100644 --- a/appshell/client_handler.cpp +++ b/appshell/client_handler.cpp @@ -109,14 +109,16 @@ static void ParseParams(const std::string& params, CefWindowInfo& windowInfo) { #endif bool ClientHandler::OnBeforePopup(CefRefPtr browser, - CefRefPtr frame, - const CefString& target_url, - const CefString& target_frame_name, - const CefPopupFeatures& popupFeatures, - CefWindowInfo& windowInfo, - CefRefPtr& client, - CefBrowserSettings& settings, - bool* no_javascript_access) { + CefRefPtr frame, + const CefString& target_url, + const CefString& target_frame_name, + CefLifeSpanHandler::WindowOpenDisposition target_disposition, + bool user_gesture, + const CefPopupFeatures& popupFeatures, + CefWindowInfo& windowInfo, + CefRefPtr& client, + CefBrowserSettings& settings, + bool* no_javascript_access){ #ifndef OS_LINUX std::string address = target_url.ToString(); std::string url; diff --git a/appshell/client_handler.h b/appshell/client_handler.h index 225c02cb8..215543c4e 100644 --- a/appshell/client_handler.h +++ b/appshell/client_handler.h @@ -106,15 +106,17 @@ class ClientHandler : public CefClient, } // CefLifeSpanHandler methods - virtual bool OnBeforePopup(CefRefPtr browser, - CefRefPtr frame, - const CefString& target_url, - const CefString& target_frame_name, - const CefPopupFeatures& popupFeatures, - CefWindowInfo& windowInfo, - CefRefPtr& client, - CefBrowserSettings& settings, - bool* no_javascript_access) OVERRIDE; +virtual bool OnBeforePopup(CefRefPtr browser, + CefRefPtr frame, + const CefString& target_url, + const CefString& target_frame_name, + CefLifeSpanHandler::WindowOpenDisposition target_disposition, + bool user_gesture, + const CefPopupFeatures& popupFeatures, + CefWindowInfo& windowInfo, + CefRefPtr& client, + CefBrowserSettings& settings, + bool* no_javascript_access) OVERRIDE; virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; diff --git a/appshell_paths.gypi b/appshell_paths.gypi index 131af8ec2..8a90b03fa 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -69,10 +69,10 @@ 'include/wrapper/cef_closure_task.h', 'include/wrapper/cef_helpers.h', 'include/wrapper/cef_message_router.h', + 'include/wrapper/cef_resource_manager.h', 'include/wrapper/cef_stream_resource_handler.h', 'include/wrapper/cef_xml_object.h', 'include/wrapper/cef_zip_archive.h', - ], 'includes_win': [ 'include/base/internal/cef_atomicops_x86_msvc.h', @@ -100,7 +100,7 @@ 'libcef_dll/libcef_dll.cc', 'libcef_dll/libcef_dll2.cc', 'libcef_dll/resource.h', - 'libcef_dll/transfer_util.cpp', + 'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.h', '<@(autogen_library_side)', ], @@ -121,12 +121,13 @@ 'libcef_dll/cpptoc/cpptoc.h', 'libcef_dll/ctocpp/base_ctocpp.h', 'libcef_dll/ctocpp/ctocpp.h', - 'libcef_dll/transfer_util.cpp', + 'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.h', 'libcef_dll/wrapper/cef_browser_info_map.h', 'libcef_dll/wrapper/cef_byte_read_handler.cc', 'libcef_dll/wrapper/cef_closure_task.cc', 'libcef_dll/wrapper/cef_message_router.cc', + 'libcef_dll/wrapper/cef_resource_manager.cc', 'libcef_dll/wrapper/cef_stream_resource_handler.cc', 'libcef_dll/wrapper/cef_xml_object.cc', 'libcef_dll/wrapper/cef_zip_archive.cc', From 11d66b7e044c2752685d61a50b6e37a9fdbc250b Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Tue, 22 Dec 2015 12:40:18 +0530 Subject: [PATCH 2/8] Chancing cef binary name from macosx32 to macosx64 --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1d7622041..9e82ce241 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -63,7 +63,7 @@ module.exports = function (grunt) { /* mac */ "cef-mac": { "dest" : "<%= downloads %>", - "src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_macosx32.zip" + "src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_macosx64.zip" }, "cef-mac-symbols": { "src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_macosx32_release_symbols.zip", From 25ddc3ab70d21aba9edeb7ccaa441e111d01e24d Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Tue, 19 Apr 2016 22:46:59 +0530 Subject: [PATCH 3/8] CEF upgrade related changes. Fixed the following issues --- appshell.gyp | 3 +++ appshell/client_handler_mac.mm | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/appshell.gyp b/appshell.gyp index 18c89cd91..db470c6df 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -77,6 +77,7 @@ # Target build path. 'SYMROOT': 'xcodebuild', 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', }, 'conditions': [ @@ -381,6 +382,7 @@ # Target build path. 'SYMROOT': 'xcodebuild', 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', }, 'conditions': [ @@ -472,6 +474,7 @@ 'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'], 'SYMROOT': 'xcodebuild', 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 'FRAMEWORK_SEARCH_PATHS': [ '$(inherited)', diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 80262c041..cfee9b906 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -520,7 +520,7 @@ - (void)windowDidResignKey:(NSNotification *)notification { // CEF 1750 -- We need to not handle keys for the DevTools Window. - if (browser->GetFocusedFrame()->GetURL() == "chrome-devtools://devtools/devtools.html") { + if (browser->GetFocusedFrame()->GetURL() == "chrome-devtools://devtools/inspector.html") { return false; } From c32ee49c68090d26b14a760b8d817304008f3ceb Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Wed, 4 May 2016 00:52:31 +0530 Subject: [PATCH 4/8] Changes required for upgrading to CEF 2623 --- Gruntfile.js | 2 +- appshell_paths.gypi | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9e82ce241..e3fb67bf7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -224,7 +224,7 @@ module.exports = function (grunt) { }, "cef": { "url" : "http://s3.amazonaws.com/files.brackets.io/cef", - "version" : "3.2357.1291" + "version" : "3.2623.1397" }, "node": { "version" : "0.10.24" diff --git a/appshell_paths.gypi b/appshell_paths.gypi index 8a90b03fa..a9f348076 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -96,12 +96,15 @@ ], 'libcef_sources_common': [ 'libcef_dll/cpptoc/cpptoc.h', + 'libcef_dll/ctocpp/base_ctocpp.cc', + 'libcef_dll/ctocpp/base_ctocpp.h', 'libcef_dll/ctocpp/ctocpp.h', 'libcef_dll/libcef_dll.cc', 'libcef_dll/libcef_dll2.cc', 'libcef_dll/resource.h', 'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.h', + 'libcef_dll/wrapper_types.h', '<@(autogen_library_side)', ], 'libcef_dll_wrapper_sources_common': [ @@ -117,12 +120,13 @@ 'libcef_dll/base/cef_thread_checker_impl.cc', 'libcef_dll/base/cef_thread_collision_warner.cc', 'libcef_dll/base/cef_weak_ptr.cc', + 'libcef_dll/cpptoc/base_cpptoc.cc', 'libcef_dll/cpptoc/base_cpptoc.h', 'libcef_dll/cpptoc/cpptoc.h', - 'libcef_dll/ctocpp/base_ctocpp.h', 'libcef_dll/ctocpp/ctocpp.h', 'libcef_dll/transfer_util.cc', 'libcef_dll/transfer_util.h', + 'libcef_dll/wrapper_types.h', 'libcef_dll/wrapper/cef_browser_info_map.h', 'libcef_dll/wrapper/cef_byte_read_handler.cc', 'libcef_dll/wrapper/cef_closure_task.cc', From adc91b8a6d0610eb74b3704d48e1ae23404c9cfc Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Fri, 6 May 2016 02:55:01 +0530 Subject: [PATCH 5/8] Fixing Title drawing issue. Resurrected Traffic lights view,as the default toolbar, provided by OS, is not allowing for any custom drawing of the window title --- appshell/CustomTitlebarView.m | 3 ++- appshell/appshell_extensions_mac.mm | 25 ++++++++++++++++++++++++- appshell/cefclient_mac.mm | 6 +++--- appshell/client_colors_mac.h | 4 ++-- appshell/client_handler_mac.mm | 2 +- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index 44473b110..8f4fec125 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -32,6 +32,7 @@ @implementation CustomTitlebarView - (void)drawRect:(NSRect)dirtyRect { + [NSGraphicsContext saveGraphicsState]; 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]]; @@ -45,7 +46,7 @@ - (void)drawRect:(NSRect)dirtyRect [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; diff --git a/appshell/appshell_extensions_mac.mm b/appshell/appshell_extensions_mac.mm index 84ff24dae..61b86620b 100644 --- a/appshell/appshell_extensions_mac.mm +++ b/appshell/appshell_extensions_mac.mm @@ -407,8 +407,31 @@ int32 ShowOpenDialog(bool allowMulitpleSelection, [openPanel setDirectoryURL:[NSURL URLWithString:[NSString stringWithUTF8String:initialDirectory.c_str()]]]; [openPanel setAllowedFileTypes:allowedFileTypes]; - [openPanel beginSheetModalForWindow:[NSApp mainWindow] completionHandler:nil]; + + /* + [openPanel beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(NSInteger result){ + if (result == NSFileHandlingPanelOKButton) { + NSArray* urls = [openPanel URLs]; + for (NSUInteger i = 0; i < [urls count]; i++) { + NSURL *theURL = [urls objectAtIndex:i]; + NSString *theString = [theURL absoluteString]; + selectedFiles->SetString(i, [[[urls objectAtIndex:i] path] UTF8String]); + } + + NSUInteger i = 0; + for (NSURL *url in urls) + { + NSString *theString = [NSString stringWithFormat:@"%@", [url absoluteString]]; + selectedFiles->SetString(i, [theString UTF8String]); + i++; + } + + // Use the URLs to build a list of items to import. + } + + }]; */ + if ([openPanel runModal] == NSOKButton) { NSArray* urls = [openPanel URLs]; diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 5c20dd1c4..e47381b13 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -295,7 +295,7 @@ -(BOOL)needsFullScreenActivateHack { } -(BOOL)useSystemTrafficLights { - return [self isRunningOnYosemiteOrLater]; + return true; //[self isRunningOnYosemiteOrLater]; } -(void)windowDidResize:(NSNotification *)notification @@ -601,7 +601,7 @@ - (void)createApp:(id)object { NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | - NSTexturedBackgroundWindowMask ); + NSUnifiedTitleAndToolbarWindowMask ); // Get the available screen space NSRect screen_rect = [[NSScreen mainScreen] visibleFrame]; @@ -650,7 +650,7 @@ - (void)createApp:(id)object { content_rect = [mainWnd contentRectForFrameRect:[mainWnd frame]]; // Configure the rest of the window - [mainWnd setTitle:WINDOW_TITLE]; + //[mainWnd setTitle:WINDOW_TITLE]; [mainWnd setDelegate:self.delegate]; [mainWnd setCollectionBehavior: (1 << 7) /* NSWindowCollectionBehaviorFullScreenPrimary */]; diff --git a/appshell/client_colors_mac.h b/appshell/client_colors_mac.h index bf9eb252f..0e98176d9 100644 --- a/appshell/client_colors_mac.h +++ b/appshell/client_colors_mac.h @@ -29,8 +29,8 @@ static CGFloat fillComp[4] = {0.23137255f, 0.24705882f, 0.25490196f, 1.0}; //title text color -static const float activeComp[4] = {0.77254902f, 0.77254902f, 0.77254902f, 1.0}; -static const float inactiveComp[4] = {0.50f, 0.50f, 0.50f, 1.0}; +static CGFloat activeComp[4] = {0.77254902f, 0.77254902f, 0.77254902f, 1.0}; +static CGFloat inactiveComp[4] = {0.50f, 0.50f, 0.50f, 1.0}; #endif diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index cfee9b906..605e3b597 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -56,7 +56,7 @@ NSWindow* window = [view window]; std::string titleStr(title); NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; - [window setTitle:str]; + //[window setTitle:str]; NSObject* delegate = [window delegate]; [delegate performSelectorOnMainThread:@selector(windowTitleDidChange:) withObject:str waitUntilDone:NO]; From 165ffb18e9fc9cfe8c9241e0d79f3cd8460c2073 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Wed, 11 May 2016 19:19:28 +0530 Subject: [PATCH 6/8] [MAC] Avoiding setTitle on mainWnd, as text getting drawn twice in the toolbar --- appshell/cefclient_mac.mm | 18 +++++++++++++++--- appshell/client_handler_mac.mm | 5 ++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index e47381b13..43305a829 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -295,7 +295,7 @@ -(BOOL)needsFullScreenActivateHack { } -(BOOL)useSystemTrafficLights { - return true; //[self isRunningOnYosemiteOrLater]; + return [self isRunningOnYosemiteOrLater]; } -(void)windowDidResize:(NSNotification *)notification @@ -334,7 +334,14 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { } if (customTitlebar) { [customTitlebar setHidden:YES]; - } + NSWindow *window = [notification object]; + + // Since we have nuked the title, we will have + // to set the string back as we are hiding the + // custom title bar. + if([self useSystemTrafficLights]) + [window setTitle:[customTitlebar titleString]]; + } if ([self needsFullScreenActivateHack]) { [NSApp activateIgnoringOtherApps:YES]; @@ -343,6 +350,7 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { NSView* contentView = [window contentView]; [contentView setNeedsDisplay:YES]; } + #endif } @@ -424,6 +432,11 @@ -(void)windowWillExitFullScreen:(NSNotification *)notification { // transition from fullscreen back to normal if (customTitlebar) { [customTitlebar setHidden:NO]; + + // Nuke the OS title as the title + // string is now done by customTitleBar. + NSWindow *window = [notification object]; + [window setTitle:@""]; } if (trafficLightsView) { [trafficLightsView setHidden:NO]; @@ -650,7 +663,6 @@ - (void)createApp:(id)object { content_rect = [mainWnd contentRectForFrameRect:[mainWnd frame]]; // Configure the rest of the window - //[mainWnd setTitle:WINDOW_TITLE]; [mainWnd setDelegate:self.delegate]; [mainWnd setCollectionBehavior: (1 << 7) /* NSWindowCollectionBehaviorFullScreenPrimary */]; diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 605e3b597..c6291f1d8 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -56,9 +56,12 @@ NSWindow* window = [view window]; std::string titleStr(title); NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; - //[window setTitle:str]; NSObject* delegate = [window delegate]; + if ([window styleMask] & NSFullScreenWindowMask) { + [window setTitle:str]; + } + [delegate performSelectorOnMainThread:@selector(windowTitleDidChange:) withObject:str waitUntilDone:NO]; } From d3cd41c8fb964cd5634b3babdeec9dd25e681861 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Thu, 12 May 2016 00:08:16 +0530 Subject: [PATCH 7/8] Cleaned up some unwanted code. --- appshell/CustomTitlebarView.m | 3 +-- appshell/appshell_extensions_mac.mm | 25 +------------------------ appshell/cefclient_mac.mm | 17 ++++++++--------- appshell/client_handler_mac.mm | 4 ++-- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m index 8f4fec125..44473b110 100644 --- a/appshell/CustomTitlebarView.m +++ b/appshell/CustomTitlebarView.m @@ -32,7 +32,6 @@ @implementation CustomTitlebarView - (void)drawRect:(NSRect)dirtyRect { - [NSGraphicsContext saveGraphicsState]; 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]]; @@ -46,7 +45,7 @@ - (void)drawRect:(NSRect)dirtyRect [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; diff --git a/appshell/appshell_extensions_mac.mm b/appshell/appshell_extensions_mac.mm index 61b86620b..84ff24dae 100644 --- a/appshell/appshell_extensions_mac.mm +++ b/appshell/appshell_extensions_mac.mm @@ -407,31 +407,8 @@ int32 ShowOpenDialog(bool allowMulitpleSelection, [openPanel setDirectoryURL:[NSURL URLWithString:[NSString stringWithUTF8String:initialDirectory.c_str()]]]; [openPanel setAllowedFileTypes:allowedFileTypes]; - [openPanel beginSheetModalForWindow:[NSApp mainWindow] completionHandler:nil]; - - /* - [openPanel beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(NSInteger result){ - if (result == NSFileHandlingPanelOKButton) { - NSArray* urls = [openPanel URLs]; - for (NSUInteger i = 0; i < [urls count]; i++) { - NSURL *theURL = [urls objectAtIndex:i]; - NSString *theString = [theURL absoluteString]; - selectedFiles->SetString(i, [[[urls objectAtIndex:i] path] UTF8String]); - } - - NSUInteger i = 0; - for (NSURL *url in urls) - { - NSString *theString = [NSString stringWithFormat:@"%@", [url absoluteString]]; - selectedFiles->SetString(i, [theString UTF8String]); - i++; - } - - // Use the URLs to build a list of items to import. - } - - }]; */ + [openPanel beginSheetModalForWindow:[NSApp mainWindow] completionHandler:nil]; if ([openPanel runModal] == NSOKButton) { NSArray* urls = [openPanel URLs]; diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 43305a829..7884e3528 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -334,15 +334,15 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { } if (customTitlebar) { [customTitlebar setHidden:YES]; - NSWindow *window = [notification object]; - + NSWindow *window = [notification object]; + // Since we have nuked the title, we will have // to set the string back as we are hiding the // custom title bar. - if([self useSystemTrafficLights]) - [window setTitle:[customTitlebar titleString]]; - } - + [window setTitle:[customTitlebar titleString]]; + } + + if ([self needsFullScreenActivateHack]) { [NSApp activateIgnoringOtherApps:YES]; [NSApp unhide:nil]; @@ -350,7 +350,6 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { NSView* contentView = [window contentView]; [contentView setNeedsDisplay:YES]; } - #endif } @@ -433,8 +432,8 @@ -(void)windowWillExitFullScreen:(NSNotification *)notification { if (customTitlebar) { [customTitlebar setHidden:NO]; - // Nuke the OS title as the title - // string is now done by customTitleBar. + // Nuke the OS title as the title string is going to + // drawn by customTitleBar. NSWindow *window = [notification object]; [window setTitle:@""]; } diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index c6291f1d8..4ea2e6a6a 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -56,12 +56,12 @@ NSWindow* window = [view window]; std::string titleStr(title); NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; - + NSObject* delegate = [window delegate]; if ([window styleMask] & NSFullScreenWindowMask) { [window setTitle:str]; } - + [delegate performSelectorOnMainThread:@selector(windowTitleDidChange:) withObject:str waitUntilDone:NO]; } From 25a643cc8867db9dee9f6c987d9684bb3ef29f25 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Fri, 13 May 2016 08:54:06 +0530 Subject: [PATCH 8/8] Fixing the title drawing issue for popup window. This was fixed for the main window and the fix had to be migrated to popup window as well --- appshell/client_handler_mac.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 4ea2e6a6a..46881fb67 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -326,6 +326,13 @@ -(void)windowWillExitFullScreen:(NSNotification *)notification { // transforms from full screen back to normal if (customTitlebar) { [customTitlebar setHidden:NO]; + + NSWindow *popUpWindow = [notification object]; + + // Since we have nuked the title, we will have + // to set the string back as we are hiding the + // custom title bar. + [popUpWindow setTitle:@""]; } if (trafficLightsView) { [trafficLightsView setHidden:NO]; @@ -355,6 +362,13 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { } if (customTitlebar) { [customTitlebar setHidden:YES]; + + NSWindow *popUpWindow = [notification object]; + + // Since we have nuked the title, we will have + // to set the string back as we are hiding the + // custom title bar. + [popUpWindow setTitle:[customTitlebar titleString]]; } if ([self needsFullScreenActivateHack]) { // HACK to make sure that window is activate