mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +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
|
//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
|
* Obtain the native window handle for this
|
||||||
* component's peer.
|
* component's peer.
|
||||||
@ -56,27 +53,16 @@ public class CocoaBrowserControlCanvas extends BrowserControlCanvas {
|
|||||||
* @returns The native window handle.
|
* @returns The native window handle.
|
||||||
*/
|
*/
|
||||||
protected int getWindow() {
|
protected int getWindow() {
|
||||||
WCRunnable runner = new WCRunnable() {
|
Integer result = (Integer)
|
||||||
public Object run() {
|
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable(){
|
||||||
Integer result =
|
public Object run() {
|
||||||
new Integer(CocoaBrowserControlCanvas.this.getHandleToPeer(null));
|
Integer result =
|
||||||
return result;
|
new Integer(CocoaBrowserControlCanvas.this.getHandleToPeer());
|
||||||
}
|
return result;
|
||||||
};
|
}
|
||||||
Integer result = null;
|
});
|
||||||
|
return result.intValue();
|
||||||
this.setVisible(true);
|
|
||||||
repaint();
|
|
||||||
while (-1 == nativeWindow) {
|
|
||||||
result = (Integer) NativeEventThread.instance.pushBlockingWCRunnable(runner);
|
|
||||||
nativeWindow = result.intValue();
|
|
||||||
}
|
|
||||||
return nativeWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paint(Graphics graphics) {
|
|
||||||
nativeWindow = getHandleToPeer(graphics);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class CocoaBrowserControlCanvas {
|
|||||||
|
|
||||||
public:
|
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
|
#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");
|
printf("debug: edburns: in CocoaBrowserControlCanvas::nativeGetHandleToPeer\n");
|
||||||
JAWT awt;
|
JAWT awt;
|
||||||
JAWT_DrawingSurface* ds = NULL;
|
JAWT_DrawingSurface* ds = NULL;
|
||||||
@ -77,10 +77,9 @@ jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas
|
|||||||
printf("debug: edburns: acquired lock: %d\n", lock);
|
printf("debug: edburns: acquired lock: %d\n", lock);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if (NULL == lock) {
|
if ((lock & JAWT_LOCK_ERROR) != 0) {
|
||||||
util_ThrowExceptionToJava(env, "CocoaBrowserControlCanvas: can't lock drawing surface");
|
util_ThrowExceptionToJava(env, "CocoaBrowserControlCanvas: can't lock drawing surface");
|
||||||
}
|
}
|
||||||
assert((lock & JAWT_LOCK_ERROR) == 0);
|
|
||||||
|
|
||||||
// Get the drawing surface info
|
// Get the drawing surface info
|
||||||
dsi = ds->GetDrawingSurfaceInfo(ds);
|
dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||||
|
@ -37,12 +37,12 @@
|
|||||||
* Signature: ()I
|
* Signature: ()I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CocoaBrowserControlCanvas_getHandleToPeer
|
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");
|
printf("debug: edburns: in CocoaBrowserControlCanvasImpl->nativeGetHandleToPeer\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
jint result = -1;
|
jint result = -1;
|
||||||
|
|
||||||
result = CocoaBrowserControlCanvas::cocoaGetHandleToPeer(env, canvas, graphics);
|
result = CocoaBrowserControlCanvas::cocoaGetHandleToPeer(env, canvas);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user