-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from CodeBrig/version-69
macOS support + variable CEF native version
- Loading branch information
Showing
17 changed files
with
778 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,5 +49,4 @@ deploy: | |
draft: false | ||
prerelease: false | ||
on: | ||
branch: master | ||
APPVEYOR_REPO_TAG: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
git clone https://bitbucket.org/chromiumembedded/java-cef.git jcef | ||
cd jcef | ||
git checkout d348788e3347fa4d2a421773463f7dd62da60991 | ||
cd jcef/jcef_build/native/Release | ||
install_name_tool -change "@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "@loader_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" ./jcef_app.app/Contents/Java/libjcef.dylib | ||
install_name_tool -change "@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "@executable_path/../../../Chromium Embedded Framework.framework/Chromium Embedded Framework" "./jcef_app.app/Contents/Frameworks/jcef Helper.app/Contents/MacOS/jcef Helper" | ||
cd ../../../../ | ||
|
||
mkdir jcef_build && cd jcef_build | ||
cmake -G "Unix Makefiles" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Release .. | ||
make -j4 | ||
#xcodebuild -project jcef.xcodeproj -configuration Release -target ALL_BUILD | ||
cd ../tools && ./make_distrib.sh macosx64 | ||
cd jcef/tools && ./make_distrib.sh macosx64 | ||
cd ../binary_distrib | ||
zip -r jcef-distrib-macintosh64.zip macosx64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package org.cef.browser.mac; | ||
|
||
import org.cef.browser.CefBrowserWindow; | ||
|
||
import java.awt.*; | ||
import java.awt.peer.ComponentPeer; | ||
import java.lang.reflect.InvocationHandler; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Proxy; | ||
|
||
@SuppressWarnings("unused") | ||
public class CefBrowserWindowMac implements CefBrowserWindow { | ||
|
||
private static long[] result; | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public long getWindowHandle(Component comp) { | ||
result = new long[1]; | ||
|
||
Class LWComponentPeer; | ||
Class CPlatformWindow; | ||
Class CFNativeAction; | ||
Method execute; | ||
Method getPlatformWindow; | ||
try { | ||
LWComponentPeer = Class.forName("sun.lwawt.LWComponentPeer"); | ||
CPlatformWindow = Class.forName("sun.lwawt.macosx.CPlatformWindow"); | ||
CFNativeAction = Class.forName("sun.lwawt.macosx.CFRetainedResource$CFNativeAction"); | ||
execute = CPlatformWindow.getMethod("execute", CFNativeAction); | ||
getPlatformWindow = LWComponentPeer.getMethod("getPlatformWindow"); | ||
} catch (ClassNotFoundException | NoSuchMethodException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
|
||
while (comp != null) { | ||
if (comp.isLightweight()) { | ||
comp = comp.getParent(); | ||
continue; | ||
} | ||
@SuppressWarnings("deprecation") | ||
ComponentPeer peer = comp.getPeer(); | ||
|
||
if (LWComponentPeer.isInstance(peer)) { | ||
Object pWindow; | ||
try { | ||
pWindow = getPlatformWindow.invoke(peer); | ||
} catch (IllegalAccessException | InvocationTargetException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
if (CPlatformWindow.isInstance(pWindow)) { | ||
try { | ||
Object nativeActionProxy = Proxy.newProxyInstance(getClass().getClassLoader(), | ||
new Class[]{CFNativeAction}, new InvocationHandler() { | ||
@Override | ||
public Object invoke(Object o, Method method, Object[] args) { | ||
if ("run".equals(method.getName())) { | ||
result[0] = (long) args[0]; | ||
} | ||
return o; | ||
} | ||
}); | ||
execute.invoke(pWindow, nativeActionProxy); | ||
} catch (IllegalAccessException | InvocationTargetException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
break; | ||
} | ||
} | ||
comp = comp.getParent(); | ||
} | ||
return result[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
git clone https://bitbucket.org/chromiumembedded/java-cef.git jcef | ||
./gradlew checkoutJCEF | ||
./gradlew patchJCEF | ||
|
||
cd jcef && mkdir jcef_build && cd jcef_build | ||
cmake -G "Xcode" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Release .. | ||
xcodebuild -project jcef.xcodeproj -configuration Release -target ALL_BUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.