Permalink
Browse files

Fix for compiling on 10.6

  • Loading branch information...
1 parent 26c51de commit e088f697cfb2760e61cb3413b8ddde33cf728acc @silasb silasb committed Dec 8, 2012
Showing with 38 additions and 19 deletions.
  1. +17 −0 BUILDING.md
  2. +1 −1 binding.gyp
  3. +20 −18 src/native_window/native_window_mac.mm
View
17 BUILDING.md
@@ -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
View
2 binding.gyp
@@ -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'
]
}
View
38 src/native_window/native_window_mac.mm
@@ -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;
@@ -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;
@@ -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]) {
@@ -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];
}

0 comments on commit e088f69

Please sign in to comment.