diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java
index 51e091c8f5e..776b23b47ca 100644
--- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java
+++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java
@@ -35,13 +35,15 @@ import org.mozilla.util.ParameterCheck;
import java.awt.Rectangle;
import java.awt.Canvas;
+import org.mozilla.webclient.motif.*;
+
/**
*
* BrowserControlImpl provides the implementation for BrowserControl
*
* Lifetime And Scope
*
- * @version $Id: BrowserControlImpl.java,v 1.7 1999-12-23 04:09:27 edburns%acm.org Exp $
+ * @version $Id: BrowserControlImpl.java,v 1.8 2000-02-18 19:16:26 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControl
*
@@ -98,7 +100,7 @@ protected BrowserControlImpl(Canvas yourCanvas)
public void createWindow(int windowPtr, Rectangle bounds) throws Exception
{
- nativeWebShell = BrowserControlNativeShim.webShellCreate(windowPtr, bounds);
+ nativeWebShell = BrowserControlNativeShim.webShellCreate(windowPtr, bounds, this);
}
public Canvas getCanvas()
@@ -281,7 +283,7 @@ public static void main(String [] args)
// BrowserControlImpl me = new BrowserControlImpl();
Log.setApplicationName("BrowserControlImpl");
Log.setApplicationVersion("0.0");
- Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.7 1999-12-23 04:09:27 edburns%acm.org Exp $");
+ Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.8 2000-02-18 19:16:26 edburns%acm.org Exp $");
}
diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlNativeShim.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlNativeShim.java
index db334ff7b86..3a4597e3d8f 100644
--- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlNativeShim.java
+++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlNativeShim.java
@@ -48,7 +48,7 @@ import java.awt.*;
* There is one instance of this class and all of the exposed methods
* are static.
- * @version $Id: BrowserControlNativeShim.java,v 1.1 1999-12-23 04:09:29 edburns%acm.org Exp $
+ * @version $Id: BrowserControlNativeShim.java,v 1.2 2000-02-18 19:16:26 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlImpl
@@ -72,6 +72,8 @@ private static BrowserControlNativeShim instance = null;
private static Object lock = null;
+ //private static int myGtkwinptr;
+
//
// Instance Variables
@@ -127,14 +129,15 @@ public static void terminate () throws Exception
//
public static int webShellCreate (int windowPtr,
- Rectangle bounds) throws Exception
+ Rectangle bounds, BrowserControlImpl abrowsercontrolimpl) throws Exception
{
synchronized(lock) {
if (initialized) {
- return(instance.nativeWebShellCreate(windowPtr,
+ return(instance.nativeWebShellCreate(windowPtr,
bounds.x, bounds.y,
bounds.width + 1,
- bounds.height + 1));
+ bounds.height + 1,
+ abrowsercontrolimpl));
}
else {
throw new Exception("Error: unable to create native nsIWebShell");
@@ -371,8 +374,10 @@ private native void nativeTerminate () throws Exception;
// WebShell interface
//
+private native void nativeDummy (BrowserControlNativeShim testShim);
+
private native int nativeWebShellCreate (int windowPtr,
- int x, int y, int width, int height) throws Exception;
+ int x, int y, int width, int height, BrowserControlImpl abrowsercontrolimpl) throws Exception;
private native void nativeWebShellDelete (int webShellPtr) throws Exception;
private native void nativeWebShellLoadURL (int webShellPtr, String urlString) throws Exception;
private native void nativeWebShellStop (int webShellPtr) throws Exception;
@@ -416,7 +421,7 @@ public static void main(String [] args)
BrowserControlNativeShim me = new BrowserControlNativeShim();
Log.setApplicationName("BrowserControlNativeShim");
Log.setApplicationVersion("0.0");
- Log.setApplicationVersionDate("$Id: BrowserControlNativeShim.java,v 1.1 1999-12-23 04:09:29 edburns%acm.org Exp $");
+ Log.setApplicationVersionDate("$Id: BrowserControlNativeShim.java,v 1.2 2000-02-18 19:16:26 edburns%acm.org Exp $");
}
diff --git a/mozilla/java/webclient/src/BrowserControlNativeShim.cpp b/mozilla/java/webclient/src/BrowserControlNativeShim.cpp
index 68fc2ef14d1..5c6f80f0f1e 100644
--- a/mozilla/java/webclient/src/BrowserControlNativeShim.cpp
+++ b/mozilla/java/webclient/src/BrowserControlNativeShim.cpp
@@ -82,6 +82,13 @@ nsMacMessageSink gMessageSink;
#include "nsCOMPtr.h"
#include "nsIBaseWindow.h"
+#include
+
+#ifdef XP_UNIX
+#include "gdksuperwin.h"
+#include "gtkmozarea.h"
+#endif
+
#ifdef XP_PC
@@ -145,6 +152,7 @@ struct WebShellInitContext {
int y;
int w;
int h;
+ int gtkPtr;
};
void PostEvent (WebShellInitContext * initContext, PLEvent * event);
@@ -332,11 +340,20 @@ EmbeddedEventHandler (void * arg) {
}
#if DEBUG_RAPTOR_CANVAS
- printf("EmbeddedEventHandler(%lx): Init the WebShell...\n", initContext);
+ printf("EmbeddedEventHandler(%lx): Init the WebShell...%p\n", initContext, initContext->env);
#endif
-
+
+#ifdef XP_UNIX
+ GdkSuperWin * superwin;
+ GtkMozArea * mozarea;
+ mozarea = (GtkMozArea *) initContext->gtkPtr;
+ superwin = mozarea->superwin;
+ rv = initContext->webShell->Init((nsNativeWidget *)superwin, initContext->x, initContext->y, initContext->w, initContext->h);
+#else
rv = initContext->webShell->Init((nsNativeWidget *)initContext->parentHWnd,
initContext->x, initContext->y, initContext->w, initContext->h);
+#endif
+
if (NS_FAILED(rv)) {
initContext->initFailCode = kInitWebShellError;
return;
@@ -723,6 +740,22 @@ Java_org_mozilla_webclient_BrowserControlNativeShim_nativeTerminate (
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeTerminate()
+JNIEXPORT void JNICALL
+Java_org_mozilla_webclient_BrowserControlNativeShim_nativeDummy (
+ JNIEnv * env,
+ jobject obj,
+ jobject shimObj)
+{
+ printf("Inside C++ - before GetObjectClass call\n");
+ jclass cls = env->GetObjectClass(shimObj);
+ jfieldID fid = env->GetFieldID(cls, "initialized", "Z");
+ jboolean ans = env->GetBooleanField(cls, fid);
+ printf("Inside C++ - value of Initialized is %b\n", ans);
+ return;
+}
+
+
+
/*
* Class: BrowserControlNativeShim
* Method: raptorWebShellCreate
@@ -736,7 +769,8 @@ Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate (
jint x,
jint y,
jint width,
- jint height)
+ jint height,
+ jobject implObj)
{
jobject jobj = obj;
#ifdef XP_MAC
@@ -769,6 +803,32 @@ Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate (
initContext->w = width;
initContext->h = height;
+#ifdef XP_UNIX
+ jclass cls = env->GetObjectClass(implObj); // Get Class for BrowserControlImpl object
+ // Get myCanvas IVar
+ jfieldID fid = env->GetFieldID(cls, "myCanvas", "Ljava/awt/Canvas;");
+ if (NULL == fid) {
+ ::ThrowExceptionToJava(env, "Exception: field myCanvas not found in the jobject for BrowserControlImpl");
+ return (jint) 0;
+ }
+ jobject canvasObj = env->GetObjectField(implObj, fid);
+ jclass canvasCls = env->GetObjectClass(canvasObj);
+ if (NULL == canvasCls) {
+ ::ThrowExceptionToJava(env, "Exception: ");
+ return (jint) 0;
+ }
+ jfieldID gtkfid = env->GetFieldID(canvasCls, "gtkWinPtr", "I");
+ if (NULL == gtkfid) {
+ ::ThrowExceptionToJava(env, "Exception: field gtkWinPtr not found in the jobject for BrowserControlCanvas");
+ return (jint) 0;
+ }
+ jint mozPtr = env->GetIntField(canvasObj, gtkfid);
+ initContext->gtkPtr = (int) mozPtr;
+#else
+ initContext->gtkPtr = NULL;
+#endif
+
+
#ifdef XP_UNIX
// This probably needs some explaining...
// On Unix, instead of using a NSPR thread to manage our Mozilla event loop, we
@@ -1598,3 +1658,4 @@ PostSynchronousEvent (WebShellInitContext * initContext, PLEvent * event)
// EOF
+
diff --git a/mozilla/java/webclient/src/motif/BrowserControlNativeShimStub.cpp b/mozilla/java/webclient/src/motif/BrowserControlNativeShimStub.cpp
index 443e3783cb8..acbbac1fd19 100644
--- a/mozilla/java/webclient/src/motif/BrowserControlNativeShimStub.cpp
+++ b/mozilla/java/webclient/src/motif/BrowserControlNativeShimStub.cpp
@@ -44,9 +44,10 @@ void * webClientDll;
extern void locateMotifBrowserControlStubFunctions(void *);
+void (* nativeDummy) (JNIEnv *, jobject, jobject);
void (* nativeInitialize) (JNIEnv *, jobject, jstring);
void (* nativeTerminate) (JNIEnv *, jobject);
-jint (* nativeWebShellCreate) (JNIEnv *, jobject, jint, jint, jint, jint, jint);
+jint (* nativeWebShellCreate) (JNIEnv *, jobject, jint, jint, jint, jint, jint, jobject);
void (* nativeWebShellDelete) (JNIEnv *, jobject, jint);
void (* nativeWebShellLoadURL) (JNIEnv *, jobject, jint, jstring);
void (* nativeWebShellStop) (JNIEnv *, jobject, jint);
@@ -72,6 +73,10 @@ void (* processNativeEventQueue) (JNIEnv *, jobject, jint);
void locateBrowserControlStubFunctions(void * dll) {
+ nativeDummy = (void (*) (JNIEnv *, jobject, jobject)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeDummy");
+ if (!nativeDummy) {
+ printf("got dlsym error %s\n", dlerror());
+ }
nativeInitialize = (void (*) (JNIEnv *, jobject, jstring)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeInitialize");
if (!nativeInitialize) {
printf("got dlsym error %s\n", dlerror());
@@ -80,7 +85,7 @@ void locateBrowserControlStubFunctions(void * dll) {
if (!nativeTerminate) {
printf("got dlsym error %s\n", dlerror());
}
- nativeWebShellCreate = (jint (*) (JNIEnv *, jobject, jint, jint, jint, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate");
+ nativeWebShellCreate = (jint (*) (JNIEnv *, jobject, jint, jint, jint, jint, jint, jobject)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate");
if (!nativeWebShellCreate) {
printf("got dlsym error %s\n", dlerror());
}
@@ -175,6 +180,18 @@ void locateBrowserControlStubFunctions(void * dll) {
}
}
+
+JNIEXPORT void JNICALL
+Java_org_mozilla_webclient_BrowserControlNativeShim_nativeDummy (
+ JNIEnv * env,
+ jobject obj,
+ jobject shimObj)
+{
+ (* nativeDummy) (env, obj, shimObj);
+}
+
+
+
/*
* Class: org_mozilla_webclient_motif_MotifNativeEventQueue
* Method: processNativeEventQueue
@@ -240,9 +257,10 @@ Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate (
jint x,
jint y,
jint width,
- jint height)
+ jint height,
+ jobject abrowsercontrolimpl)
{
- return (* nativeWebShellCreate) (env, obj, windowPtr, x, y, width, height);
+ return (* nativeWebShellCreate) (env, obj, windowPtr, x, y, width, height, abrowsercontrolimpl);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate()