зеркало из https://github.com/mozilla/gecko-dev.git
r=marklin
a=edburns bug=20659 Changes to bring webclient sort of up to working shape on unix.
This commit is contained in:
Родитель
8c0df8068f
Коммит
cc447ed81a
|
@ -43,7 +43,7 @@ import java.io.FileNotFoundException;
|
|||
* This is a static class, it is neven instantiated.
|
||||
|
||||
*
|
||||
* @version $Id: BrowserControlFactory.java,v 1.1 1999/12/03 01:55:28 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlFactory.java,v 1.2 1999/12/06 23:31:04 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.test.EmbeddedMozilla
|
||||
|
||||
|
@ -116,17 +116,30 @@ public static void setAppData(String absolutePathToNativeBrowserBinDir) throws F
|
|||
// none loads, then I return a error message.
|
||||
// If you think up of a better way, let me know.
|
||||
// -- Mark
|
||||
|
||||
Class win32DrawingSurfaceInfoClass;
|
||||
|
||||
Class win32DrawingSurfaceInfoClass =
|
||||
Class.forName("sun.awt.windows.WDrawingSurfaceInfo");
|
||||
try {
|
||||
win32DrawingSurfaceInfoClass =
|
||||
Class.forName("sun.awt.windows.WDrawingSurfaceInfo");
|
||||
}
|
||||
catch (Exception e) {
|
||||
win32DrawingSurfaceInfoClass = null;
|
||||
}
|
||||
|
||||
if (win32DrawingSurfaceInfoClass != null) {
|
||||
platformCanvasClassName = "org.mozilla.webclient.win32.Win32BrowserControlCanvas";
|
||||
}
|
||||
|
||||
if (null == platformCanvasClassName) {
|
||||
Class motifDrawingSurfaceInfoClass =
|
||||
Class.forName("sun.awt.motif.MDrawingSurfaceInfo");
|
||||
Class motifDrawingSurfaceInfoClass;
|
||||
try {
|
||||
motifDrawingSurfaceInfoClass =
|
||||
Class.forName("sun.awt.motif.MDrawingSurfaceInfo");
|
||||
}
|
||||
catch (Exception e) {
|
||||
motifDrawingSurfaceInfoClass = null;
|
||||
}
|
||||
|
||||
if (motifDrawingSurfaceInfoClass != null) {
|
||||
platformCanvasClassName = "org.mozilla.webclient.motif.MotifBrowserControlCanvas";
|
||||
|
@ -184,7 +197,7 @@ public static void main(String [] args)
|
|||
Assert.setEnabled(true);
|
||||
Log.setApplicationName("BrowserControlFactory");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlFactory.java,v 1.1 1999/12/03 01:55:28 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlFactory.java,v 1.2 1999/12/06 23:31:04 edburns%acm.org Exp $");
|
||||
|
||||
java.awt.Canvas canvas = null;
|
||||
BrowserControl control = null;
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.mozilla.util.ParameterCheck;
|
|||
|
||||
* There is one instance of the WebShellCanvas per top level awt Frame.
|
||||
|
||||
* @version $Id: MotifBrowserControlCanvas.java,v 1.4 1999/11/06 02:24:18 dmose%mozilla.org Exp $
|
||||
* @version $Id: MotifBrowserControlCanvas.java,v 1.5 1999/12/06 23:31:05 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlCanvasFactory
|
||||
*
|
||||
|
@ -57,6 +57,7 @@ public class MotifBrowserControlCanvas extends BrowserControlCanvas /* implement
|
|||
|
||||
static {
|
||||
System.loadLibrary("webclientstub");
|
||||
MotifBrowserControlCanvas.loadMainDll();
|
||||
}
|
||||
|
||||
static private boolean firstTime = true;
|
||||
|
@ -66,6 +67,7 @@ public class MotifBrowserControlCanvas extends BrowserControlCanvas /* implement
|
|||
private int gtkWinPtr;
|
||||
private MDrawingSurfaceInfo drawingSurfaceInfo;
|
||||
|
||||
static private native void loadMainDll();
|
||||
private native int createTopLevelWindow();
|
||||
private native int createContainerWindow(int parent, int width, int height);
|
||||
private native int getGTKWinID(int gtkWinPtr);
|
||||
|
@ -80,6 +82,7 @@ public class MotifBrowserControlCanvas extends BrowserControlCanvas /* implement
|
|||
this.canvasWinID = 0;
|
||||
this.gtkWinPtr = 0;
|
||||
this.drawingSurfaceInfo = null;
|
||||
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.mozilla.util.Assert;
|
|||
* This is a test application for using the BrowserControl.
|
||||
|
||||
*
|
||||
* @version $Id: EmbeddedMozilla.java,v 1.5 1999/12/03 01:55:30 edburns%acm.org Exp $
|
||||
* @version $Id: EmbeddedMozilla.java,v 1.6 1999/12/06 23:31:06 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlFactory
|
||||
|
||||
|
@ -77,7 +77,8 @@ public static void printUsage()
|
|||
|
||||
public EmbeddedMozilla (String title, String binDir, String url) {
|
||||
super(title);
|
||||
System.out.println("constructed with " + url);
|
||||
System.out.println("constructed with binDir: " + binDir + " url: " +
|
||||
url);
|
||||
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsRepository.h"
|
||||
#ifdef NECKO
|
||||
#include "nsNeckoUtil.h"
|
||||
#include "nsNetUtil.h"
|
||||
#else
|
||||
#include "nsINetService.h"
|
||||
#endif
|
||||
|
@ -69,6 +69,12 @@ nsMacMessageSink gMessageSink;
|
|||
#ifdef XP_UNIX
|
||||
#include <gtk/gtk.h>
|
||||
#include "motif/MozillaEventThread.h"
|
||||
|
||||
|
||||
// debug: edburns: start
|
||||
#include <unistd.h>
|
||||
// debug: edburns: end
|
||||
|
||||
#endif
|
||||
|
||||
#include "nsActions.h"
|
||||
|
@ -79,6 +85,10 @@ nsMacMessageSink gMessageSink;
|
|||
#include "DocumentObserver.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include "gtkmozarea.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
|
||||
#define APPSHELL_DLL "appshell.dll"
|
||||
|
@ -144,6 +154,26 @@ struct WebShellInitContext {
|
|||
int h;
|
||||
};
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
void edburnsDebugBreak(void)
|
||||
{
|
||||
pid_t curPid = -1;
|
||||
|
||||
if (-1 == (curPid = getpid())) {
|
||||
printf("can't get pid\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("dbx - %d\n\n", curPid);
|
||||
fflush(stdout);
|
||||
sleep(10);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void PostEvent (WebShellInitContext * initContext, PLEvent * event);
|
||||
void * PostSynchronousEvent (WebShellInitContext * initContext, PLEvent * event);
|
||||
|
||||
|
@ -334,7 +364,8 @@ EmbeddedEventHandler (void * arg) {
|
|||
printf("EmbeddedEventHandler(%lx): Init the WebShell...\n", initContext);
|
||||
#endif
|
||||
|
||||
rv = initContext->webShell->Init((nsNativeWidget *)initContext->parentHWnd,
|
||||
//rv = initContext->webShell->Init((nsNativeWidget *)initContext->parentHWnd,
|
||||
rv = initContext->webShell->Init((nsNativeWidget *) GTK_MOZAREA(initContext->parentHWnd)->superwin,
|
||||
initContext->x, initContext->y, initContext->w, initContext->h);
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kInitWebShellError;
|
||||
|
@ -414,6 +445,18 @@ EmbeddedEventHandler (void * arg) {
|
|||
void
|
||||
InitEmbeddedEventHandler (WebShellInitContext* initContext)
|
||||
{
|
||||
|
||||
// this used to be in nativeInitialize
|
||||
// PENDING, assert that the registryFile and component Dir are valid
|
||||
NS_InitXPCOM(NULL, &gRegistryFile, &gComponentDir);
|
||||
NS_SetupRegistry();
|
||||
nsComponentManager::RegisterComponentLib(kSessionHistoryCID, NULL,
|
||||
NULL, APPSHELL_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
NS_AutoregisterComponents();
|
||||
|
||||
|
||||
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("InitEmbeddedEventHandler(%lx): Creating embedded thread...\n", initContext);
|
||||
#endif
|
||||
|
@ -677,6 +720,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize(
|
|||
JNIEnv * pEnv = env;
|
||||
jobject jobj = obj;
|
||||
static PRBool gFirstTime = PR_TRUE;
|
||||
|
||||
if (gFirstTime)
|
||||
{
|
||||
// set the gRegistryFile and gComponentDir correctly
|
||||
|
@ -686,12 +730,6 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize(
|
|||
gComponentDir = nativePath;
|
||||
gComponentDir += "components";
|
||||
|
||||
NS_InitXPCOM(NULL, &gRegistryFile, &gComponentDir);
|
||||
NS_SetupRegistry();
|
||||
nsComponentManager::RegisterComponentLib(kSessionHistoryCID, NULL,
|
||||
NULL, APPSHELL_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
NS_AutoregisterComponents();
|
||||
gFirstTime = PR_FALSE;
|
||||
}
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize()
|
||||
|
@ -1978,6 +2016,10 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeDebugBreak(JNIEnv *jE
|
|||
{
|
||||
const char *charFileName = (char *) jEnv->GetStringUTFChars(fileName, 0);
|
||||
nsDebug::Break(charFileName, lineNumber);
|
||||
#ifdef XP_UNIX
|
||||
edburnsDebugBreak();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ DLLNAMESTUB = libwebclientstub.so
|
|||
MOZILLA_TOP = ../../..
|
||||
DIST = ${MOZILLA_TOP}/dist
|
||||
LIBDIR = ${DIST}/lib
|
||||
CC = gcc -g -gstabs
|
||||
MKSHLIB = c++ -G
|
||||
# WARNING: YOU NEED TO RUN 'gtk-config --cflags' and stick it in here
|
||||
GTKINCLUDES = -I/usr/openwin/include -I/opt/local/lib/glib/include -I/opt/local/include
|
||||
# WARNING: YOU NEED TO RUN 'gtk-config --libs' and stick it in here
|
||||
|
@ -23,10 +25,17 @@ STUBINCLUDE = ${JAVAINCLUDE}
|
|||
STUBLIBS = ${JAVALIBS} /usr/lib/libC.so.5
|
||||
# For the latest mozilla build
|
||||
LIBS = ${GTKLIBS} ${JAVALIBS} \
|
||||
-L${DIST}/bin -lraptorgfx -lexpat -lxmltok -ljsurl -lmozdbm -lmozjs -lsecfree -lmozutil -lnspr3 -lxp -ljpeg -lpng -lz -lpthread -lXm -lXt -L${DIST}/lib -lxpcom -limg -lplds3 -lgfx_gtk -lraptorwebwidget -lraptorhtmlpars -lraptorplugin -lpref -lplds3 -lplc3 -ljsdom -L${DIST}/lib -ltimer_gtk_s /usr/lib/libC.so.5
|
||||
-L${DIST}/bin -L${LIBDIR} -lraptorgfx -lexpat_s -lxmltok_s -lmozjs -lmozutil_s -lnspr3 -ljpeg -lpng -lzlib -lpthread -lXm -lXt -L${DIST}/lib -lxpcom -limg_s -lplds3 -lgfx_gtk -lraptorwebwidget -lraptorplugin -lgtksuperwin -lplds3 -lplc3 -ljsdom -L${DIST}/lib -ltimer_s /usr/lib/libC.so.5
|
||||
|
||||
#-L${DIST}/bin -L${LIBDIR} -lraptorgfx -lexpat_s -lxmltok_s -ljsurl -lmozdbm -lmozjs -lsecfree -lmozutil_s -lnspr3 -lxp -ljpeg -lpng -lz -lpthread -lXm -lXt -L${DIST}/lib -lxpcom -limg -lplds3 -lgfx_gtk -lgkwebwidget -lgkhtmlpars -lgkplugin -lpref -lplds3 -lplc3 -ljsdom -L${DIST}/lib -ltimer_gtk_s /usr/lib/libC.so.5
|
||||
LN = ln -f -s
|
||||
|
||||
all: libwebclientstub.so libwebclient.so component.reg components
|
||||
all: libwebclientstub.so libwebclient.so copy
|
||||
|
||||
copy:
|
||||
cp libwebclient*.so ${DIST}/bin
|
||||
|
||||
# component.reg components
|
||||
|
||||
component.reg:
|
||||
${LN} ${DIST}/bin/component.reg
|
||||
|
@ -35,37 +44,40 @@ components:
|
|||
${LN} ${DIST}/bin/components
|
||||
|
||||
libwebclientstub.so: BrowserControlMozillaShimStub.o MotifBrowserControlCanvasStub.o
|
||||
cc -G -o ${DLLNAMESTUB} BrowserControlMozillaShimStub.o MotifBrowserControlCanvasStub.o ${STUBLIBS}
|
||||
${MKSHLIB} -o ${DLLNAMESTUB} BrowserControlMozillaShimStub.o MotifBrowserControlCanvasStub.o ${STUBLIBS}
|
||||
|
||||
libwebclient.so: BrowserControlMozillaShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o
|
||||
cc -G -o ${DLLNAME} BrowserControlMozillaShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o ${LIBS}
|
||||
libwebclient.so: BrowserControlMozillaShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o DocumentObserver.o
|
||||
${MKSHLIB} -o ${DLLNAME} BrowserControlMozillaShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o DocumentObserver.o ${LIBS}
|
||||
|
||||
gtkmozilla.o: motif/gtkmozilla.cpp
|
||||
CC ${DEFINES} ${INCLUDE} -c motif/gtkmozilla.cpp
|
||||
${CC} ${DEFINES} ${INCLUDE} -c motif/gtkmozilla.cpp
|
||||
|
||||
MotifBrowserControlCanvasStub.o: motif/MotifBrowserControlCanvasStub.cpp
|
||||
CC ${STUBDEFINES} ${STUBINCLUDE} -c motif/MotifBrowserControlCanvasStub.cpp
|
||||
${CC} ${STUBDEFINES} ${STUBINCLUDE} -c motif/MotifBrowserControlCanvasStub.cpp
|
||||
|
||||
MotifBrowserControlCanvas.o: motif/MotifBrowserControlCanvas.cpp
|
||||
CC ${DEFINES} ${INCLUDE} -c motif/MotifBrowserControlCanvas.cpp
|
||||
${CC} ${DEFINES} ${INCLUDE} -c motif/MotifBrowserControlCanvas.cpp
|
||||
|
||||
BrowserControlMozillaShimStub.o: motif/BrowserControlMozillaShimStub.cpp
|
||||
CC ${STUBDEFINES} ${STUBINCLUDE} -c motif/BrowserControlMozillaShimStub.cpp
|
||||
${CC} ${STUBDEFINES} ${STUBINCLUDE} -c motif/BrowserControlMozillaShimStub.cpp
|
||||
|
||||
BrowserControlMozillaShim.o: BrowserControlMozillaShim.cpp
|
||||
CC ${DEFINES} ${INCLUDE} -c BrowserControlMozillaShim.cpp
|
||||
${CC} ${DEFINES} ${INCLUDE} -c BrowserControlMozillaShim.cpp
|
||||
|
||||
motif/nsSetupRegistry.cpp:
|
||||
cd motif
|
||||
${LN} ${MOZILLA_TOP}/../webshell/tests/viewer/nsSetupRegistry.cpp motif/nsSetupRegistry.cpp
|
||||
${LN} ${MOZILLA_TOP}/../xpfe/bootstrap/nsSetupRegistry.cpp motif/nsSetupRegistry.cpp
|
||||
cd ..
|
||||
|
||||
#PENDING(mark): I think we should use this for the Win32 version as well...
|
||||
nsSetupRegistry.o: motif/nsSetupRegistry.cpp
|
||||
CC ${DEFINES} ${INCLUDE} -c motif/nsSetupRegistry.cpp
|
||||
${CC} ${DEFINES} ${INCLUDE} -c motif/nsSetupRegistry.cpp
|
||||
|
||||
nsActions.o: nsActions.cpp
|
||||
CC ${DEFINES} ${INCLUDE} -c nsActions.cpp
|
||||
${CC} ${DEFINES} ${INCLUDE} -c nsActions.cpp
|
||||
|
||||
DocumentObserver.o: DocumentObserver.cpp
|
||||
${CC} ${DEFINES} ${INCLUDE} -c DocumentObserver.cpp
|
||||
|
||||
clean:
|
||||
rm -f component.reg components *.o *.so *~ motif/*~ motif/nsSetupRegistry.cpp
|
||||
|
|
|
@ -36,12 +36,15 @@
|
|||
// JNI Header
|
||||
#include "MozillaEventThread.h"
|
||||
|
||||
// allow code in webclientstub.so to load us
|
||||
#include "BrowserControlMozillaShimStub.h"
|
||||
|
||||
// Global reference to webclient dll
|
||||
void * webClientDll;
|
||||
|
||||
extern void locateMotifBrowserControlStubFunctions(void *);
|
||||
|
||||
void (* nativeInitialize) (JNIEnv *, jobject);
|
||||
void (* nativeInitialize) (JNIEnv *, jobject, jstring);
|
||||
void (* nativeTerminate) (JNIEnv *, jobject);
|
||||
void (* nativeSendKeyDownEvent) (JNIEnv *, jobject, jint, jchar, jint, jint, jint);
|
||||
void (* nativeSendKeyUpEvent) (JNIEnv *, jobject, jint, jchar, jint, jint, jint);
|
||||
|
@ -82,7 +85,7 @@ void (* processNativeEventQueue) (JNIEnv *, jobject, jint);
|
|||
|
||||
|
||||
void locateBrowserControlStubFunctions(void * dll) {
|
||||
nativeInitialize = (void (*) (JNIEnv *, jobject)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize");
|
||||
nativeInitialize = (void (*) (JNIEnv *, jobject, jstring)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize");
|
||||
if (!nativeInitialize) {
|
||||
printf("got dlsym error %s\n", dlerror());
|
||||
}
|
||||
|
@ -247,6 +250,19 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MozillaEventThread_proce
|
|||
(* processNativeEventQueue) (env, obj, gtkWinPtr);
|
||||
}
|
||||
|
||||
void loadMainDll(void)
|
||||
{
|
||||
webClientDll = dlopen("libwebclient.so", RTLD_LAZY | RTLD_GLOBAL);
|
||||
|
||||
if (webClientDll) {
|
||||
locateBrowserControlStubFunctions(webClientDll);
|
||||
locateMotifBrowserControlStubFunctions(webClientDll);
|
||||
} else {
|
||||
printf("Got Error: %s\n", dlerror());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Class: MozWebShellMozillaShim
|
||||
|
@ -256,19 +272,9 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MozillaEventThread_proce
|
|||
JNIEXPORT void JNICALL
|
||||
Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize (
|
||||
JNIEnv * env,
|
||||
jobject obj)
|
||||
jobject obj, jstring verifiedBinDirAbsolutePath)
|
||||
{
|
||||
webClientDll = dlopen("libwebclient.so", RTLD_LAZY | RTLD_GLOBAL);
|
||||
|
||||
if (webClientDll) {
|
||||
locateBrowserControlStubFunctions(webClientDll);
|
||||
locateMotifBrowserControlStubFunctions(webClientDll);
|
||||
|
||||
(* nativeInitialize) (env, obj);
|
||||
} else {
|
||||
printf("Got Error: %s\n", dlerror());
|
||||
}
|
||||
|
||||
(* nativeInitialize) (env, obj, verifiedBinDirAbsolutePath);
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize()
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* BrowserControlMozillaShimStub.h
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
* This file exports a function that allows the code in
|
||||
* MotifBrowserControlCanvasStub to load the real webclient dll.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
* Called by loadMainDll() in MotifBrowserControlCanvasStub.cpp
|
||||
|
||||
* simply loads the webclient dll and copies all the right function
|
||||
* pointers.
|
||||
|
||||
*/
|
||||
|
||||
void loadMainDll(void);
|
|
@ -33,6 +33,7 @@
|
|||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkmozilla.h"
|
||||
#include "gtkmozarea.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include <dlfcn.h>
|
||||
|
@ -48,37 +49,8 @@ extern "C" {
|
|||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow
|
||||
(JNIEnv * env, jobject obj) {
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *mShell = NULL;
|
||||
|
||||
// PENDING(mark): This is a hack needed in order to get those error
|
||||
// messages about:
|
||||
/***************************************************
|
||||
*nsComponentManager: Load(/disk4/mozilla/mozilla/dist/bin/components/librdf.so)
|
||||
*FAILED with error: libsunwjdga.so: cannot open shared object file:
|
||||
*No such file or directory
|
||||
****************************************************/
|
||||
// But the weird thing is, libhistory.so isn't linked with libsunwjdga.so.
|
||||
// In fact, libsunwjdga.so doesn't even exist anywhere! I know it's
|
||||
// a JDK library, but I think it is only supposed to get used on
|
||||
// Solaris, not Linux. And why the hell is nsComponentManager trying
|
||||
// to open this JDK library anyways? I need to try and get my stuff
|
||||
// building on Solaris. Also, I will have to scan the Linux
|
||||
// JDK1.2 sources and figure out what's going on. In the meantime....
|
||||
//
|
||||
// -Mark
|
||||
void * dll;
|
||||
|
||||
dll = dlopen("components/libhistory.so", RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!dll) {
|
||||
printf("Got Error: %s\n", dlerror());
|
||||
}
|
||||
dll = dlopen("components/librdf.so", RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!dll) {
|
||||
printf("Got Error: %s\n", dlerror());
|
||||
}
|
||||
|
||||
NS_SetupRegistry();
|
||||
|
||||
/* Initialise GTK */
|
||||
gtk_set_locale ();
|
||||
|
||||
|
@ -86,11 +58,11 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanva
|
|||
|
||||
gdk_rgb_init();
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Simple browser");
|
||||
|
||||
return (jint) window;
|
||||
mShell = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_default_size(GTK_WINDOW(mShell), 300, 300);
|
||||
gtk_window_set_title(GTK_WINDOW(mShell), "Simple browser");
|
||||
|
||||
return (jint) mShell;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -101,25 +73,21 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanva
|
|||
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createContainerWindow
|
||||
(JNIEnv * env, jobject obj, jint parent, jint screenWidth, jint screenHeight) {
|
||||
GtkWidget * window = (GtkWidget *) parent;
|
||||
GtkWidget * vbox;
|
||||
GtkWidget * mozilla;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
mozilla = gtk_mozilla_new();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), mozilla, TRUE, TRUE, 0);
|
||||
GtkWidget *mMozArea = NULL;
|
||||
|
||||
mMozArea = gtk_mozarea_new();
|
||||
gtk_container_add(GTK_CONTAINER(window), mMozArea);
|
||||
gtk_widget_realize(GTK_WIDGET(mMozArea));
|
||||
|
||||
// HACK: javaMake sure this window doesn't appear onscreen!!!!
|
||||
gtk_widget_set_uposition(window, screenWidth + 20, screenHeight + 20);
|
||||
gtk_widget_show(mozilla);
|
||||
gtk_widget_show(mMozArea);
|
||||
|
||||
gtk_widget_show(window);
|
||||
|
||||
//gtk_main();
|
||||
|
||||
return (jint) mozilla;
|
||||
return (jint) mMozArea;
|
||||
}
|
||||
|
||||
int getWinID(GtkWidget * gtkWidgetPtr) {
|
||||
|
@ -179,9 +147,19 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanva
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
|
||||
* Method: loadMainDll
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_loadMainDll
|
||||
(JNIEnv *, jclass)
|
||||
{
|
||||
printf("incorrect loadMainDll called\n\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // End extern "C"
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <jni.h>
|
||||
#include "MotifBrowserControlCanvas.h"
|
||||
|
||||
#include "BrowserControlMozillaShimStub.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
extern void locateBrowserControlStubFunctions(void *);
|
||||
|
@ -132,3 +134,14 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanva
|
|||
(JNIEnv * env, jobject obj, jint xwinID, jint width, jint height) {
|
||||
(* setGTKWindowSize) (env, obj, xwinID, width, height);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
|
||||
* Method: loadMainDll
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_loadMainDll
|
||||
(JNIEnv *, jclass)
|
||||
{
|
||||
loadMainDll();
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
|||
echo "===================================================================="
|
||||
echo
|
||||
# For debugging...
|
||||
#${JAVA} -native -verbose:jni -Xcheck:jni -classpath ${CLASSES} ${CLASSNAME} $1
|
||||
echo ${JAVA} -native -classpath ${CLASSES} ${CLASSNAME} $1 $2 $3 $4 $5
|
||||
${JAVA} -native -classpath ${CLASSES} ${CLASSNAME} $1 $2 $3 $4 $5
|
||||
#${JAVA} -native -verbose:jni -Xcheck:jni -classpath ${CLASSES} ${CLASSNAME} ${MOZILLA_FIVE_HOME} $1
|
||||
echo ${JAVA} -native -classpath ${CLASSES} ${CLASSNAME} ${MOZILLA_FIVE_HOME} $1 $2 $3 $4 $5
|
||||
${JAVA} -native -classpath ${CLASSES} ${CLASSNAME} ${MOZILLA_FIVE_HOME} $1 $2 $3 $4 $5
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче