From 3d7dee72f28c4f97987aeba60396d5aa116a3b0b Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Tue, 13 May 2003 20:22:13 +0000 Subject: [PATCH] r=edburns Author: Ron Capelli The following files are updated to allow use of IBM Java 1.3.x JVMs on Linux. Instead of statically linking libjawt.lib, the code now dynamically links libjawt.so and then libawt.so only if needed (similar to previous change for win32). It should work on Solaris, but we couldn't test that here. mozilla/java/webclient/src_moz/Makefile.in mozilla/java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp The following files are changed to support the ant 'clean' target for src_ie. mozilla/java/webclient/build.xml mozilla/java/webclient/src_ie/Makefile.in The following files are changed to disable the CurrentPage(2) interface for IE, since it will be a while before that can be made to work. With these changes, IE embeds smoothly with Navigation and History interfaces working nicely to some degree. mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java The following file is changed so that it does not depend on Mozilla, allowing it to be shared cleanly for IE. mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.cpp The following file is changed to correct the list of makefiles that need to be configured for Webclient. mozilla/java/makefiles Finally, please delete the following files from CVS. mozilla/java/webclient/src_ie/build.xml mozilla/java/webclient/src_ie/Makefile.win git-svn-id: svn://10.0.0.236/trunk@142382 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/java/makefiles | 8 +- mozilla/java/webclient/build.xml | 6 + .../org/mozilla/webclient/test/EMWindow.java | 31 +- mozilla/java/webclient/src_ie/Makefile.in | 33 +- mozilla/java/webclient/src_ie/Makefile.win | 87 ------ .../webclient/src_ie/WrapperFactoryImpl.cpp | 4 +- mozilla/java/webclient/src_ie/build.xml | 281 ------------------ mozilla/java/webclient/src_moz/Makefile.in | 7 +- .../src_moz/gtk/GtkBrowserControlCanvas.cpp | 32 +- .../win32/Win32BrowserControlCanvas.cpp | 3 +- 10 files changed, 75 insertions(+), 417 deletions(-) delete mode 100644 mozilla/java/webclient/src_ie/Makefile.win delete mode 100644 mozilla/java/webclient/src_ie/build.xml diff --git a/mozilla/java/makefiles b/mozilla/java/makefiles index 9931e3fd74f..335449a342c 100644 --- a/mozilla/java/makefiles +++ b/mozilla/java/makefiles @@ -1,8 +1,6 @@ -java/build/Makefile -java/dom/Makefile -java/dom/classes/Makefile java/dom/jni/Makefile java/dom/src/Makefile -java/webclient/src_share/Makefile -java/webclient/src_moz/Makefile java/webclient/src_moz/gtk/Makefile +java/webclient/src_moz/Makefile +java/webclient/src_ie/Makefile +java/webclient/src_share/Makefile diff --git a/mozilla/java/webclient/build.xml b/mozilla/java/webclient/build.xml index c96ec370f8b..a8e619ebaf3 100644 --- a/mozilla/java/webclient/build.xml +++ b/mozilla/java/webclient/build.xml @@ -304,6 +304,12 @@ ${myenv.MOZ_JDKHOME}/bin/java ${debug.options} org.mozilla.webclient.test.Embedd + + + + + + diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java index 8b95439b915..5341ec4b536 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java @@ -59,7 +59,7 @@ import java.io.FileInputStream; * This is a test application for using the BrowserControl. * - * @version $Id: EMWindow.java,v 1.42 2003-05-13 15:21:54 edburns%acm.org Exp $ + * @version $Id: EMWindow.java,v 1.43 2003-05-13 20:22:07 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControlFactory @@ -196,10 +196,25 @@ public EMWindow (String title, String binDir, String url, int winnum, EmbeddedMo navigation = (Navigation2) browserControl.queryInterface(BrowserControl.NAVIGATION_NAME); navigation.setPrompt(this); + } + catch (Exception e) { + System.out.println(e.toString()); + } + try { currentPage = (CurrentPage2) browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME); + } + catch (Exception e) { + System.out.println(e.toString()); + } + try { history = (History) browserControl.queryInterface(BrowserControl.HISTORY_NAME); + } + catch (Exception e) { + System.out.println(e.toString()); + } + try { prefs = (Preferences) browserControl.queryInterface(BrowserControl.PREFERENCES_NAME); prefs.registerPrefChangedCallback(this, @@ -216,9 +231,6 @@ public EMWindow (String title, String binDir, String url, int winnum, EmbeddedMo System.setProperty("http.proxyHost", proxyHost); System.setProperty("http.proxyPort", proxyPort); } - - //prefsProps = prefs.getPrefs(); - //prefsProps.list(System.out); // This works, try it! } catch (Exception e) { System.out.println(e.toString()); @@ -723,12 +735,13 @@ public void eventDispatched(WebclientEvent event) populateHistoryMenu(); statusLabel.setText("Done."); urlStatusLabel.setText(""); - currentDocument = currentPage.getDOM(); - // add the new document to the domViewer - if (null != currentDocument && null != domViewer) { - domViewer.setDocument(currentDocument); + if (null != currentPage) { + currentDocument = currentPage.getDOM(); + // add the new document to the domViewer + if (null != currentDocument && null != domViewer) { + domViewer.setDocument(currentDocument); + } } - break; case ((int) DocumentLoadEvent.PROGRESS_URL_LOAD_EVENT_MASK): status = "Status: " + (String) event.getEventData(); diff --git a/mozilla/java/webclient/src_ie/Makefile.in b/mozilla/java/webclient/src_ie/Makefile.in index ba10c3cd1e2..bde6cc028df 100644 --- a/mozilla/java/webclient/src_ie/Makefile.in +++ b/mozilla/java/webclient/src_ie/Makefile.in @@ -25,8 +25,6 @@ VPATH = $(topsrcdir)/java/webclient/src_ie include $(DEPTH)/config/autoconf.mk -#DIST = $(topsrcdir)/dist - ifneq ($(BAL_INTERFACE),) LIBRARY_NAME = webclient_bal @@ -34,9 +32,6 @@ else LIBRARY_NAME = webclient endif -DLLNAME = webclient.dll - -PDBFILE = webclient.pdb CPPSRCS = \ ie_util.cpp \ @@ -56,31 +51,19 @@ CPPSRCS += \ ../src_moz/win32/Win32BrowserControlCanvas.cpp \ $(NULL) -_OBJS = $(CPPSRCS:.cpp=.obj) -OBJS = $(strip $(_OBJS)) - EXTRA_LIBS = $(DIST)/lib/wc_share.lib +# Do not copy modules to mozilla/dist +NO_DIST_INSTALL = 1 -# include $(topsrcdir)/config/rules.mk +include $(topsrcdir)/config/rules.mk -INCLUDES := -I$(MOZ_JDKHOME)/include -I$(MOZ_JDKHOME)/include/win32 \ - $(INCLUDES) \ - -I../src_share -I. +# Overrides eliminate dependencies on Mozilla -CPP_FLAGS = /nologo /MDd /Zi /W3 /TP /Gy /c $(INCLUDES) /Fd$(PDBFILE) - -#MKSHLIB = link /NOLOGO /DLL /OUT:$@ /PDB:$(PDBFILE) /SUBSYSTEM:WINDOWS -LDFLAGS = /DEBUG /DEBUGTYPE:CV - -%.obj: %.cpp - cl /Fo$@ $(CPP_FLAGS) $< - -all: webclient.dll - -$(DLLNAME): $(OBJS) Makefile Makefile.in - rm -f $@ - $(MKSHLIB) $(OBJS) $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) +INCLUDES = -I$(MOZ_JDKHOME)/include -I$(MOZ_JDKHOME)/include/win32 \ + -I../src_share -I. +DEFINES = +OS_COMPILE_CXXFLAGS = clobber_all:: clobber diff --git a/mozilla/java/webclient/src_ie/Makefile.win b/mozilla/java/webclient/src_ie/Makefile.win deleted file mode 100644 index fc06fd007ac..00000000000 --- a/mozilla/java/webclient/src_ie/Makefile.win +++ /dev/null @@ -1,87 +0,0 @@ -#!nmake -# -# The contents of this file are subject to the Mozilla 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/MPL/ -# -# 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 Sun Microsystems, -# Inc. Portions created by Sun are -# Copyright (C) 1999 Sun Microsystems, Inc. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\.. -IGNORE_MANIFEST=1 - -MAKE_OBJ_TYPE = DLL -DLLNAME = webclient -DLL=.\$(OBJDIR)\$(DLLNAME).dll - -MODULE=webclient - -OBJS = \ - .\$(OBJDIR)\ie_util.obj \ - .\$(OBJDIR)\ie_util_export.obj \ - .\$(OBJDIR)\CMyDialog.obj \ - .\$(OBJDIR)\BookmarksImpl.obj \ - .\$(OBJDIR)\CurrentPageImpl.obj \ - .\$(OBJDIR)\HistoryImpl.obj \ - .\$(OBJDIR)\ISupportsPeer.obj \ - .\$(OBJDIR)\NativeEventThread.obj \ - .\$(OBJDIR)\NavigationImpl.obj \ - .\$(OBJDIR)\WindowControlImpl.obj \ - .\$(OBJDIR)\WrapperFactoryImpl.obj \ - $(NULL) - -LCFLAGS = \ - -DDEBUG_RAPTOR_CANVAS \ - $(NULL) - -LLIBS = \ - $(DIST)\lib\wc_share.lib \ - $(NULL) - -WIN_LIBS = \ - version.lib - -include <$(DEPTH)\config\rules.mak> - -INCS = \ - -I$(JDKHOME)\include \ - -I$(JDKHOME)\include\win32 \ - -I..\src_share \ - $(INCS) \ - $(NULL) - -INCS=$(INCS) \ - -I$(WTLHOME)\include \ - $(NULL) - -!CMDSWITCHES -S - -buildRunems: -!ifdef BAL_INTERFACE -!else - @echo +++ Creating runem.bat. Use this to run the test browser. - rm -f runem.bat - @echo $(PERL) ..\src_share\runem.pl $(DIST)\bin org.mozilla.webclient.test.EmbeddedMozilla $(DEPTH) %1% >> runem.bat -!endif - -install:: $(DLL) buildRunems - $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin - $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib - -clobber_all:: clobber - -clobber:: - rm -f runem.bat - rm -f $(DIST)\bin\$(DLLNAME).dll diff --git a/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp b/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp index 67f97f07d13..11d2e2412ef 100644 --- a/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp +++ b/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp @@ -32,9 +32,11 @@ const char *gImplementedInterfaces[] = { "webclient.WindowControl", "webclient.Navigation", - "webclient.CurrentPage", +// "webclient.CurrentPage", "webclient.History", "webclient.EventRegistration", + "webclient.Bookmarks", +// "webclient.Preferences", 0 }; diff --git a/mozilla/java/webclient/src_ie/build.xml b/mozilla/java/webclient/src_ie/build.xml deleted file mode 100644 index b64937516d4..00000000000 --- a/mozilla/java/webclient/src_ie/build.xml +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/java/webclient/src_moz/Makefile.in b/mozilla/java/webclient/src_moz/Makefile.in index d48fdf1d431..795d6e3dc01 100644 --- a/mozilla/java/webclient/src_moz/Makefile.in +++ b/mozilla/java/webclient/src_moz/Makefile.in @@ -155,14 +155,11 @@ ifdef MOZ_ENABLE_GTK ifndef MOZ_MONOLITHIC_TOOLKIT CXXFLAGS += $(MOZ_GTK_CFLAGS) CFLAGS += $(MOZ_GTK_CFLAGS) -# Adding $(MOZ_JDKHOME)/jre/lib/sparc because we need to link against -# the libjawt.so shared library for the JAWT Native Interface -# functionality to work correctly. -EXTRA_DSO_LDOPTS += -lgtkxtbin -lgtksuperwin -lwc_share -lembed_base_s -L$(MOZ_JDKHOME)/jre/lib/sparc -L$(MOZ_JDKHOME)/jre/lib/i386 -ljawt -L/usr/X11R6/lib -lXt +EXTRA_DSO_LDOPTS += -lgtkxtbin -lgtksuperwin -lwc_share -lembed_base_s -L/usr/X11R6/lib -lXt else CXXFLAGS += $(TK_CFLAGS) CFLAGS += $(TK_CFLAGS) -EXTRA_DSO_LDOPTS += -lgtkxtbin -lgtksuperwin -lwc_share -lembed_base_s -L$(MOZ_JDKHOME)/jre/lib/sparc -L$(MOZ_JDKHOME)/jre/lib/i386 -ljawt -L/usr/X11R6/lib -lXt +EXTRA_DSO_LDOPTS += -lgtkxtbin -lgtksuperwin -lwc_share -lembed_base_s -L/usr/X11R6/lib -lXt endif endif diff --git a/mozilla/java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp b/mozilla/java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp index fed7469fbb5..3c3e6fbf074 100644 --- a/mozilla/java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp +++ b/mozilla/java/webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp @@ -42,6 +42,7 @@ #include +typedef jboolean (JNICALL *PJAWT_GETAWT)(JNIEnv*, JAWT*); #include "../ns_util.h" //for throwing Exceptions to Java @@ -186,19 +187,42 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowser * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowserControlCanvas_getHandleToPeer -(JNIEnv * env, jobject canvas) { + (JNIEnv *env, jobject canvas) { JAWT awt; JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo* dsi; JAWT_X11DrawingSurfaceInfo* dsi_x11; Drawable handle_x11; + void *_hAWT; // JAWT module handle jint lock; + PJAWT_GETAWT pJAWT_GetAWT; // JAWT_GetAWT function pointer + //Get the AWT + _hAWT = dlopen("libjawt.so", RTLD_NOW | RTLD_GLOBAL); + if (!_hAWT) { + printf(" +++ No libjawt.so... Trying libawt.so +++ \n"); + _hAWT = dlopen("libawt.so",RTLD_NOW | RTLD_GLOBAL); // IBM Java 1.3.x packages JAWT_GetAWT in awt.dll + } + if (!_hAWT) { + printf(" +++ JAWT DLL Not Found +++ \n"); + ::util_ThrowExceptionToJava(env, "Exception: JAWT DLL Not Found"); + return 0; + } + + pJAWT_GetAWT = (PJAWT_GETAWT)dlsym(_hAWT, "JAWT_GetAWT"); + if (!pJAWT_GetAWT) { + printf(" +++ JAWT_GetAWT Entry Not Found +++ \n"); + ::util_ThrowExceptionToJava(env, "Exception: JAWT_GetAWT Entry Not Found"); + dlclose(_hAWT); + return 0; + } + awt.version = JAWT_VERSION_1_3; - if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { + if (pJAWT_GetAWT(env, &awt) == JNI_FALSE) { printf(" +++ AWT Not Found +++ \n"); ::util_ThrowExceptionToJava(env, "Exception: AWT Not Found"); + dlclose(_hAWT); return 0; } @@ -207,6 +231,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowser if (ds == NULL) { printf(" +++ NULL Drawing Surface +++ \n"); ::util_ThrowExceptionToJava(env, "Exception: Null Drawing Surface"); + dlclose(_hAWT); return 0; } @@ -216,6 +241,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowser printf(" +++ Error Locking Surface +++ \n"); ::util_ThrowExceptionToJava(env, "Exception: Error Locking Surface"); awt.FreeDrawingSurface(ds); + dlclose(_hAWT); return 0; } @@ -226,6 +252,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowser ::util_ThrowExceptionToJava(env, "Exception: Error Getting Surface Info"); ds->Unlock(ds); awt.FreeDrawingSurface(ds); + dlclose(_hAWT); return 0; } @@ -239,6 +266,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_gtk_GtkBrowser ds->FreeDrawingSurfaceInfo(dsi); ds->Unlock(ds); awt.FreeDrawingSurface(ds); + dlclose(_hAWT); //return the native peer handle return (jint) handle_x11; diff --git a/mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.cpp b/mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.cpp index 0a96820d151..532ed08e5a5 100644 --- a/mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.cpp +++ b/mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.cpp @@ -33,7 +33,7 @@ typedef jboolean (JNICALL *PJAWT_GETAWT)(JNIEnv*, JAWT*); #include "Win32BrowserControlCanvas.h" -#include "ns_util.h" //for throwing Exceptions to Java +#include "jni_util.h" //for throwing Exceptions to Java /* @@ -66,7 +66,6 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32Bro } pJAWT_GetAWT = (PJAWT_GETAWT)GetProcAddress(_hAWT, "_JAWT_GetAWT@8"); - printf ("Debug (RBC): pJAWT_GetAWT: %08x\n", pJAWT_GetAWT); if (!pJAWT_GetAWT) { printf(" +++ JAWT_GetAWT Entry Not Found +++ \n"); ::util_ThrowExceptionToJava(env, "Exception: JAWT_GetAWT Entry Not Found");