Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for compiling on 10.6 #269

Merged
merged 1 commit into from

2 participants

@silasb

Some fixes to compile under 10.6

I haven't tested compiling under any other version than 10.6 so there might be some breakage there.

I also added some documentation on how to build in the BUILDING.md file. Again these instructions are strictly for 10.6, but could work with other versions.

@milani milani merged commit 4f5d1a8 into appjs:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2012
  1. @silasb

    Fix for compiling on 10.6

    silasb authored
This page is out of date. Refresh to see the latest.
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];
}
Something went wrong with that request. Please try again.