At long last, I have webclient running on Mac OSX. I only have a
PowerBook G4, so the only binary I can produce is for the PowerPC.
Perhaps someone lucky enough to own a MacBookPro can produce a binary
for me on that processor architecture.
Many thanks to the generous folks on #developers, in particular,
timeless,
cbarrett, sdwilsh, and jhpedemonte.
Here are the changes.
SECTION: Changes
M dist/build.xml
- propogate clean on mac os x
- On mac os x, there is .jnilib and also .dylib
M dom/build.xml
- propogate make on mac os x
M webclient/build.xml
- new file for javah on mac
- propogate clobber_all on mac
M webclient/classes_spec/org/mozilla/webclient/
BrowserControlCanvas.java
- get the tree lock before calling to native code to get the native
window
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/
CocoaAppKitThreadDelegatingNativeEventThread.java
- Allows running arbitrary code on the AppKit thread. Prevents Thread
Safety assertions.
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/
CocoaBrowserControlCanvas.java
- adhere to informal protocol to create NativeEventThread
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/
ImplObjectNative.java
- use NativeEventThread.instance.isNativeEventThread()
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/
NativeEventThread.java
- implement isNativeEventThread()
M webclient/src_moz/Makefile.in
- turn on objc-exceptions on mac os x
M webclient/src_moz/NativeBrowserControl.cpp
M webclient/src_moz/NativeBrowserControl.h
- work with cocoa
M webclient/src_moz/NativeEventThread.cpp
M webclient/src_moz/cocoa/CocoaBrowserControlCanvas.h
M webclient/src_moz/cocoa/CocoaBrowserControlCanvasImpl.cpp
- two methods to run arbitrary code on the AppKit thread
M webclient/src_moz/cocoa/CocoaBrowserControlCanvas.mm
M webclient/test/manual/src/classes/org/mozilla/webclient/test/
TestBrowser.java
SECTION: Diffs
Index: dist/build.xml
===================================================================
RCS file: /cvsroot/mozilla/java/dist/build.xml,v
retrieving revision 1.24
diff -u -r1.24 build.xml
--- dist/build.xml 4 Jun 2007 17:10:02 -0000 1.24
+++ dist/build.xml 10 Jun 2007 16:11:31 -0000
@@ -97,6 +97,25 @@
</target>
<target name="clean">
+ <condition property="platform" value="win32">
+ <and>
+ <os family="windows" />
+ </and>
+ </condition>
+
+ <condition property="platform" value="macosx-ppc">
+ <and>
+ <os name="Mac OS X" />
+ </and>
+ </condition>
+
+
+ <condition property="platform" value="linux">
+ <and>
+ <os family="unix" />
+ </and>
+ </condition>
+
<delete file="${objdir}/${name}_${version}_${platform}.zip" />
<delete dir="${dist.base}" />
</target>
@@ -249,7 +268,7 @@
<copy todir="${dist.home}/bin"
file="${objdir}/java/dom/jni/${so.prefix}javadomjni.$
{jni.extension}" />
<copy todir="${dist.home}/bin"
- file="${objdir}/java/webclient/src_moz/${so.prefix}${name}.$
{so.extension}" />
+ file="${objdir}/java/webclient/src_moz/${so.prefix}${name}.$
{jni.extension}" />
</target>
Index: dom/build.xml
===================================================================
RCS file: /cvsroot/mozilla/java/dom/build.xml,v
retrieving revision 1.9
diff -u -r1.9 build.xml
--- dom/build.xml 24 May 2007 04:16:58 -0000 1.9
+++ dom/build.xml 10 Jun 2007 16:11:32 -0000
@@ -107,7 +107,7 @@
executable="make"/>
<exec os="Windows 2000" dir="${objdir.native.path}/jni"
executable="make"
failonerror="yes"/>
- <exec os="Mac OS X" dir="${objdir.native.path}/src"
failonerror="yes"
+ <exec os="Mac OS X" dir="${objdir.native.path}/jni"
failonerror="yes"
executable="make"/>
</target>
@@ -176,6 +176,12 @@
<arg line="clobber_all"/>
</exec>
+ <exec os="Mac OS X" dir="${objdir.native.path}/jni"
failonerror="yes"
+ executable="make">
+ <arg line="clobber_all"/>
+ </exec>
+
+
<delete>
<fileset dir="" includes="**/*.ilk"/>
</delete>
Index: webclient/build.xml
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/build.xml,v
retrieving revision 1.34
diff -u -r1.34 build.xml
--- webclient/build.xml 24 May 2007 04:16:58 -0000 1.34
+++ webclient/build.xml 10 Jun 2007 16:11:32 -0000
@@ -194,7 +194,7 @@
<mkdir dir="${objdir.native.path}/src_moz/cocoa" />
<javah destdir="${objdir.native.path}/src_moz/cocoa"
-
class="org.mozilla.webclient.impl.wrapper_native.CocoaBrowserControlCanvas" >
+
class="org.mozilla.webclient.impl.wrapper_native.CocoaBrowserControlCanvas, org.mozilla.webclient.impl.wrapper_native.CocoaAppKitThreadDelegatingNative EventThread">
<classpath refid="compile.classpath"/>
</javah>
@@ -343,6 +343,12 @@
failonerror="yes">
<arg line="clobber_all"/>
</exec>
+
+ <exec os="Mac OS X" dir="${objdir.native.path}/src_moz"
executable="make"
+ failonerror="yes">
+ <arg line="clobber_all"/>
+ </exec>
+
<exec os="Windows 2000" dir="${objdir.native.path}/src_ie"
executable="make"
failonerror="yes">
<arg line="clobber_all"/>
Index: webclient/classes_spec/org/mozilla/webclient/
BrowserControlCanvas.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/
webclient/BrowserControlCanvas.java,v
retrieving revision 1.9
diff -u -r1.9 BrowserControlCanvas.java
--- webclient/classes_spec/org/mozilla/webclient/
BrowserControlCanvas.java 1 Dec 2004 03:21:22 -0000 1.9
+++ webclient/classes_spec/org/mozilla/webclient/
BrowserControlCanvas.java 10 Jun 2007 16:11:32 -0000
@@ -141,25 +141,30 @@
super.addNotify();
windowRelativeBounds = new Rectangle();
+ if (0 != nativeWindow) {
+ return;
+ }
+
+ synchronized (getTreeLock()) {
+ //Create the Native gtkWindow and it's container and
+ //get a handle to this widget
+ nativeWindow = getWindow();
+
+ try {
+ Rectangle r = new
Rectangle(getBoundsRelativeToWindow());
+ Assert.assert_it(null != webShell);
- //Create the Native gtkWindow and it's container and
- //get a handle to this widget
- nativeWindow = getWindow();
-
- try {
- Rectangle r = new Rectangle(getBoundsRelativeToWindow());
- Assert.assert_it(null != webShell);
-
- WindowControl wc = (WindowControl)
-
webShell.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
- //This createWindow call sets in motion the creation of the
- //nativeInitContext and the creation of the Mozilla embedded
- //webBrowser
- wc.createWindow(nativeWindow, r);
- } catch (Exception e) {
- System.out.println(e.toString());
- return;
- }
+ WindowControl wc = (WindowControl)
+
webShell.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
+ //This createWindow call sets in motion the creation
of the
+ //nativeInitContext and the creation of the Mozilla
embedded
+ //webBrowser
+ wc.createWindow(nativeWindow, r);
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ return;
+ }
+ }
initializeOK = true;
webShellCount++;
Index: webclient/classes_spec/org/mozilla/webclient/impl/
wrapper_native/CocoaBrowserControlCanvas.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/
webclient/impl/wrapper_native/CocoaBrowserControlCanvas.java,v
retrieving revision 1.5
diff -u -r1.5 CocoaBrowserControlCanvas.java
--- webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/
CocoaBrowserControlCanvas.java 12 Mar 2007 20:39:22 -0000 1.5
+++ webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/
CocoaBrowserControlCanvas.java 10 Jun 2007 16:11:32 -0000
@@ -28,10 +28,11 @@
import org.mozilla.webclient.BrowserControlCanvas;
-import org.mozilla.util.ReturnRunnable;
-import org.mozilla.webclient.impl.wrapper_native.NativeEventThread;
-
import java.awt.*;
+import java.util.logging.Logger;
+import org.mozilla.util.Log;
+import org.mozilla.util.ReturnRunnable;
+import org.mozilla.webclient.impl.WrapperFactory;
/**
*
@@ -39,13 +40,20 @@
*/
public class CocoaBrowserControlCanvas extends BrowserControlCanvas {
+ public static final String LOG =
"org.mozilla.webclient.impl.wrapper_native.CocoaBrowserControlCanvas";
+
+ public static final Logger LOGGER = Log.getLogger(LOG);
+
+
/** Creates a new instance of CocoaBrowserControlCanvas */
public CocoaBrowserControlCanvas() {
}
//New method for obtaining access to the Native Peer handle
private native int getHandleToPeer();
- private native void paintMe(Graphics g);
+
+ private boolean didGetWindow = false;
+ private int nativeView = 0;
/**
* Obtain the native window handle for this
@@ -54,40 +62,29 @@
* @returns The native window handle.
*/
protected int getWindow() {
- Integer result = (Integer)
- NativeEventThread.instance.pushBlockingReturnRunnable(new
ReturnRunnable(){
- public Object run() {
- Integer result =
- new Integer(CocoaBrowserControlCanvas.this.getHandleToPeer());
- return result;
- }
- public String toString() {
- return "WCRunnable.getHandleToPeer";
- }
+ if (!didGetWindow) {
+ Integer result = (Integer)
+ NativeEventThread.instance.pushBlockingReturnRunnable(new
ReturnRunnable(){
+ public Object run() {
+ Integer result =
+ new
...