Have browser window visible, but no content pane.
This commit is contained in:
edburns%acm.org 2005-05-17 13:12:45 +00:00
Родитель 1b4635414b
Коммит 307d596df4
3 изменённых файлов: 8 добавлений и 26 удалений

Просмотреть файл

@ -132,6 +132,7 @@ NativeBrowserControl::Realize(jobject javaBrowserControl,
void *parentWinPtr, PRBool *aAlreadyRealized,
PRUint32 width, PRUint32 height)
{
nsresult rv = NS_OK;
mJavaBrowserControl = javaBrowserControl;
// Create our session history object and tell the navigation object
@ -153,7 +154,11 @@ NativeBrowserControl::Realize(jobject javaBrowserControl,
#endif
// create the window
mWindow->CreateWindow_(width, height);
rv = mWindow->CreateWindow_(width, height);
if (NS_FAILED(rv)) {
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
::util_ThrowExceptionToJava(env, "Can't CreateWindow");
}
// bind the progress listener to the browser object
nsCOMPtr<nsISupportsWeakReference> supportsWeak;
@ -311,6 +316,7 @@ jobject NativeBrowserControl::QueryInterfaceJava(WEBCLIENT_INTERFACES interface)
{
PR_ASSERT(nsnull != mJavaBrowserControl);
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
env->ExceptionClear();
jobject result = nsnull;
jstring interfaceJStr = ::util_NewStringUTF(env,
@ -319,6 +325,7 @@ jobject NativeBrowserControl::QueryInterfaceJava(WEBCLIENT_INTERFACES interface)
jclass clazz = env->GetObjectClass(mJavaBrowserControl);
jmethodID mid = env->GetMethodID(clazz, "queryInterface",
"(Ljava/lang/String;)Ljava/lang/Object;");
if (nsnull != mid) {
result = env->CallObjectMethod(mJavaBrowserControl, mid,
interfaceJStr);

Просмотреть файл

@ -36,7 +36,6 @@
#include "jni_util.h" //for throwing Exceptions to Java
jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas) {
printf("debug: edburns: in CocoaBrowserControlCanvas::nativeGetHandleToPeer\n");
JAWT awt;
JAWT_DrawingSurface* ds = NULL;
JAWT_DrawingSurfaceInfo* dsi = NULL;
@ -47,39 +46,23 @@ jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas
NSWindow *win = NULL;
void * windowPtr = NULL;
printf("debug: edburns: about to get AWT\n");
// get the AWT
awt.version = JAWT_VERSION_1_4;
printf("debug: edburns: set awt version: ok\n");
result = JAWT_GetAWT(env, &awt);
printf("debug: edburns: got awt: result: %d\n",result);
printf("debug: edburns: additional printf\n");
printf("debug: edburns: got AWT\n");
printf("debug: edburns: about to get drawing surface\n");
fflush(stdout);
// Get the drawing surface. This can be safely cached.
// Anything below the DS (DSI, contexts, etc)
// can possibly change/go away and should not be cached.
ds = awt.GetDrawingSurface(env, canvas);
printf("debug: edburns: got drawing surface: %d\n", ds);
fflush(stdout);
if (NULL == ds) {
util_ThrowExceptionToJava(env, "CocoaBrowserControlCanvas: can't get drawing surface");
}
printf("debug: edburns: about to lock drawing surface: %d\n", ds);
fflush(stdout);
// Lock the drawing surface
// You must lock EACH TIME before drawing
lock = ds->Lock(ds);
printf("debug: edburns: acquired lock: %d\n", lock);
fflush(stdout);
if ((lock & JAWT_LOCK_ERROR) != 0) {
util_ThrowExceptionToJava(env, "CocoaBrowserControlCanvas: can't lock drawing surface");
@ -102,14 +85,8 @@ jint CocoaBrowserControlCanvas::cocoaGetHandleToPeer(JNIEnv *env, jobject canvas
// Get the corresponding peer from the caller canvas
view = dsi_mac->cocoaViewRef;
printf("debug: edburns: view: %p\n", view);
fflush(stdout);
win = [view window];
printf("debug: edburns: win: %p\n", win);
fflush(stdout);
windowPtr = [win windowRef];
printf("debug: edburns: windowPtr: %p\n", windowPtr);
fflush(stdout);
// Free the DrawingSurfaceInfo
ds->FreeDrawingSurfaceInfo(dsi);
}

Просмотреть файл

@ -38,8 +38,6 @@
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_CocoaBrowserControlCanvas_getHandleToPeer
(JNIEnv *env, jobject canvas) {
printf("debug: edburns: in CocoaBrowserControlCanvasImpl->nativeGetHandleToPeer\n");
fflush(stdout);
jint result = -1;