Skip to content

Commit

Permalink
Merge pull request appjs#269 from silasb/fix-for-compiling-on-mac-10_6
Browse files Browse the repository at this point in the history
Fix for compiling on 10.6
  • Loading branch information
milani committed Dec 8, 2012
2 parents 26c51de + e088f69 commit 4f5d1a8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
17 changes: 17 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## To Build

### Mac

These instructions work on 10.6

clone the repository

cd appjs

npm install mime

Download `node-v0.8.15-darwin-x86.tar.gz`

extract and grab the `bin/node` executable and stick it in `data/mac/node-bin/`

node-gyp rebuild --arch i386 -j 4 # the space matters after the -j
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
'link_settings': {
'libraries': [
'<(module_root_dir)/deps/cef/Release/lib.target/libcef.dylib',
'<(module_root_dir)/build/Release/cef_dll_wrapper.node',
'<(module_root_dir)/build/Release/cef_dll_wrapper.a',
'-lobjc'
]
}
Expand Down
38 changes: 20 additions & 18 deletions src/native_window/native_window_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#include "includes/cef_handler.h"
#include "native_window/native_window.h"

#define MAC_OS_X_VERSION MAC_OS_X_VERSION_MAX_ALLOWED

// Make sure the version number defines exist; when compiling on 10.6, NSAppKitVersionNumber10_6 isn't defined
#ifndef NSAppKitVersionNumber10_6
#define NSAppKitVersionNumber10_6 1038
#endif

// The global ClientHandler reference.
extern CefRefPtr<ClientHandler> g_handler;

Expand Down Expand Up @@ -495,11 +502,7 @@ void AddWebView(CefWindowHandle parent, char* url, Settings* settings) {

if ( fullscreen_ ) {

//#ifdef NSAppKitVersionNumber10_6
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
[win toggleFullScreen: nil];
} else {
//#endif
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_6) {
NSUInteger styles = NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask;
Expand All @@ -508,11 +511,13 @@ void AddWebView(CefWindowHandle parent, char* url, Settings* settings) {
NSRect window_rect = { {rect_.left, rect_.top} , {rect_.width, rect_.height} };
[win setFrame:[win frameRectForContentRect: window_rect] display:YES];
this->Emit("restore");
//#ifdef NSAppKitVersionNumber10_6
} else {
#if MAC_OS_X_VERSION >= 1070 // Allows you to build on 10.6
[win toggleFullScreen: nil];
#endif
}
//#endif
fullscreen_ = false;

fullscreen_ = false;
}

if( [win isMiniaturized]) {
Expand All @@ -531,23 +536,20 @@ void AddWebView(CefWindowHandle parent, char* url, Settings* settings) {
fullscreen_ = true;
NSWindow* win = [handle_ window];

//#ifdef NSAppKitVersionNumber10_6
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
[win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
[win toggleFullScreen: nil];
} else {
//#endif

if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_6) {
NSUInteger styles = NSBorderlessWindowMask;
[win setStyleMask:(styles)];
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar];

if(this->GetBrowser().get())
this->Emit("fullscreen");

//#ifdef NSAppKitVersionNumber10_6
} else {
#if MAC_OS_X_VERSION >= 1070 // Allows you to build on 10.6
[win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
[win toggleFullScreen: nil];
#endif
}
//#endif

[win setFrame:[win frameRectForContentRect:[[NSScreen mainScreen] frame]] display:YES];
}

Expand Down

0 comments on commit 4f5d1a8

Please sign in to comment.