mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Turns out the problem with the CocoaBrowserControlCanvas
was that I was incorrectly interpreting the return value from Lock(). This works. Next step is to solve the nsWindow.cpp problem.
This commit is contained in:
parent
26d416906e
commit
4e954005fe
@ -44,11 +44,8 @@ public class CocoaBrowserControlCanvas extends BrowserControlCanvas {
|
||||
}
|
||||
|
||||
//New method for obtaining access to the Native Peer handle
|
||||
private native int getHandleToPeer(Graphics graphics);
|
||||
private native int getHandleToPeer();
|
||||
|
||||
private int nativeWindow = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the native window handle for this
|
||||
* component's peer.
|
||||
@ -56,27 +53,16 @@ public class CocoaBrowserControlCanvas extends BrowserControlCanvas {
|
||||
* @returns The native window handle.
|
||||
*/
|
||||
protected int getWindow() {
|
||||
WCRunnable runner = new WCRunnable() {
|
||||
public Object run() {
|
||||
Integer result =
|
||||
new Integer(CocoaBrowserControlCanvas.this.getHandleToPeer(null));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
Integer result = null;
|
||||
|
||||
this.setVisible(true);
|
||||
repaint();
|
||||
while (-1 == nativeWindow) {
|
||||
result = (Integer) NativeEventThread.instance.pushBlockingWCRunnable(runner);
|
||||
nativeWindow = result.intValue();
|
||||
}
|
||||
return nativeWindow;
|
||||
Integer result = (Integer)
|
||||
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable(){
|
||||
public Object run() {
|
||||
Integer result =
|
||||
new Integer(CocoaBrowserControlCanvas.this.getHandleToPeer());
|
||||
return result;
|
||||
}
|
||||
});
|
||||
return result.intValue();
|
||||
}
|
||||
|
||||
public void paint(Graphics graphics) {
|
||||
nativeWindow = getHandleToPeer(graphics);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class CocoaBrowserControlCanvas {
|
||||
|
||||
public:
|
||||
|
||||
static jint cocoaGetHandleToPeer(JNIEnv *env, jobject canvas, jobject graphics);
|
||||
static jint cocoaGetHandleToPeer(JNIEnv *env, jobject canvas);
|
||||
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "jni_util.h" //for throwing Exceptions to Java
|
||||
|
||||
jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas, jobject graphics) {
|
||||
jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas) {
|
||||
printf("debug: edburns: in CocoaBrowserControlCanvas::nativeGetHandleToPeer\n");
|
||||
JAWT awt;
|
||||
JAWT_DrawingSurface* ds = NULL;
|
||||
@ -77,10 +77,9 @@ jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas
|
||||
printf("debug: edburns: acquired lock: %d\n", lock);
|
||||
fflush(stdout);
|
||||
|
||||
if (NULL == lock) {
|
||||
if ((lock & JAWT_LOCK_ERROR) != 0) {
|
||||
util_ThrowExceptionToJava(env, "CocoaBrowserControlCanvas: can't lock drawing surface");
|
||||
}
|
||||
assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||
|
||||
// Get the drawing surface info
|
||||
dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
|
@ -37,12 +37,12 @@
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CocoaBrowserControlCanvas_getHandleToPeer
|
||||
(JNIEnv *env, jobject canvas, jobject graphics) {
|
||||
(JNIEnv *env, jobject canvas) {
|
||||
printf("debug: edburns: in CocoaBrowserControlCanvasImpl->nativeGetHandleToPeer\n");
|
||||
fflush(stdout);
|
||||
|
||||
jint result = -1;
|
||||
|
||||
result = CocoaBrowserControlCanvas::cocoaGetHandleToPeer(env, canvas, graphics);
|
||||
result = CocoaBrowserControlCanvas::cocoaGetHandleToPeer(env, canvas);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user