The current webclient only works with M13, and the

old webclient, in classes and src, works with pre M13.

This change removes the old webclient.
This commit is contained in:
ashuk%eng.sun.com 2000-06-29 23:59:12 +00:00
parent 0e9eac5b3d
commit 241f6b261c
45 changed files with 0 additions and 7192 deletions

View File

@ -35,15 +35,9 @@ IGNORE_MANIFEST=1
#//------------------------------------------------------------------------
DEPTH = ..\..
!if defined(WEBCLIENT_PRE_SPEC)
DIRS = classes \
src \
$(NULL)
!else
DIRS = classes_spec \
src_moz \
$(NULL)
!endif
!if defined(BAL_INTERFACE)
DIRS = classes_spec \

View File

@ -1,66 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = java-util
JMODS = org/mozilla/webclient org/mozilla/webclient/test org/mozilla/webclient/motif
#
# JDIRS is dependant on JAVA_DESTPATH in config/rules.m[a]k.
# Be sure to touch that directory if you add a new directory to
# JDIRS, or else it will not build. FIXME
#
JDIRS = $(JMODS)
JAR_JSJ = jsj10.jar
JAR_JSJ_CLASSES = $(JMODS)
#
# jars to build at install time
#
JARS = $(JAR_JSJ)
JAVA_OR_NSJVM = 1
include $(topsrcdir)/config/rules.mk
JAVA_SOURCEPATH = $(topsrcdir)/java/webclient/classes
doc::
$(JAVADOC) -d $(DIST)/doc org.mozilla.util
natives_list:: FORCE
rm -rf $@
find . -name "*.class" -print | sed 's@\./\(.*\)\.class$$@\1@' | \
sed 's@/@.@g' | xargs $(JVH) -natives | sort > $@
check_natives:: natives_list
rm -f found_natives
nm -B ../$(OBJDIR)/*.o \
| egrep "Java.*_stub" | awk '{ print $$3; }' | sort > found_natives
diff found_natives natives_list
FORCE:

View File

@ -1,24 +0,0 @@
# PENDING(mark): I need to make this makefile a little smarter. Right now
# it javac's all the java files each time you do a 'make'
#
# If you're using JDK 1.2
JDK_LOCATION = ${JDKHOME}
JAVAC = ${JDK_LOCATION}/bin/javac
JAVAH = ${JDK_LOCATION}/bin/javah
OUTPUT_DIR = ../../../dist/classes
# If you're using JDK 1.2
CLASSES = ${OUTPUT_DIR}:${JDK_LOCATION}/lib/tools.jar:${JDK_LOCATION}/lib/rt.jar
JAVA_FILES = ./org/mozilla/webclient/*.java ./org/mozilla/webclient/motif/*.java ./org/mozilla/webclient/test/*.java
JAVAH_OUTPUT_DIR = ../src
CP = cp
MKDIR = mkdir -p
all:
${MKDIR} ${OUTPUT_DIR}
${JAVAC} -g -classpath ${CLASSES} -d ${OUTPUT_DIR} ${JAVA_FILES}
${JAVAH} -jni -classpath ${CLASSES} \
-o ${JAVAH_OUTPUT_DIR}/motif/MotifBrowserControlCanvas.h org.mozilla.webclient.motif.MotifBrowserControlCanvas
${JAVAH} -jni -classpath ${CLASSES} \
-o ${JAVAH_OUTPUT_DIR}/motif/NativeEventThread.h org.mozilla.webclient.motif.NativeEventThread
${JAVAH} -jni -classpath ${CLASSES} \
-o ${JAVAH_OUTPUT_DIR}/BrowserControlNativeShim.h org.mozilla.webclient.BrowserControlNativeShim

View File

@ -1,64 +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):
IGNORE_MANIFEST=1
#//------------------------------------------------------------------------
#//
#// Makefile to build the java portion of the java wrapper to mozilla
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..\..
# PENDING(edburns): find out where this should really get defined
JAVA_OR_NSJVM=1
NO_CAFE=1
include <$(DEPTH)\config\config.mak>
# for compatibility
include <$(DEPTH)\java\config\localdefs.mak>
JAR_WEBCLIENT_CLASSES = org\mozilla\webclient \
org\mozilla\webclient\test org\mozilla\webclient\win32 org\mozilla\webclient\test\swing
!ifdef JAVA_OR_NSJVM
JDIRS = $(JAR_WEBCLIENT_CLASSES)
!endif
WEBCLIENT_JAR_NAME=webclient(VERSION_NUMBER).jar
JAVAC_PROG=$(JDKHOME)\bin\javac
export::
@echo +++ Checking that org.mozilla.util classes have been built...
if not exist $(MOZ_SRC)\mozilla\dist\classes\org\mozilla\util\Assert.class \
stopbuild.exe
include <$(DEPTH)\config\rules.mak>

View File

@ -1,48 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Ann Sunhachawee
*/
package org.mozilla.webclient;
// BrowserControl.java
/**
*
* <B>BrowserControl</B> simply declares the composition of the core and extended
* interfaces.
*
* @version $Id: BrowserControl.java,v 1.3 1999/11/06 02:24:16 dmose%mozilla.org Exp $
*
* @see org.mozilla.webclient.BrowserControlCore
* @see org.mozilla.webclient.BrowserControlExtended
*
*/
public interface BrowserControl extends BrowserControlCore, BrowserControlExtended
{
public EventRegistration getEventRegistration();
} // end of interface BrowserControl

View File

@ -1,254 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Ed Burns <edburns@acm.org>
*/
package org.mozilla.webclient;
// BrowserControlCanvas.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import java.awt.*;
/**
*
* BrowserControlCanvas is the principal class for embedding
* the Mozilla WebShell into the Java framework.
* This component represents the proxy for the native
* WebShell class as provided by the nsIWebShell
* interface.
*
* @see org.mozilla.webclient.BrowserControl
*
* @author Kirk Baker
* @author Ian Wilkinson
* <P>
* <B>Lifetime And Scope</B> <P>
* See concrete subclasses for scope info.
* @version $Id: BrowserControlCanvas.java,v 1.6 1999/12/06 23:42:13 edburns%acm.org Exp $
* @see org.mozilla.webclient.win32.Win32BrowserControlCanvas
* @see org.mozilla.webclient.motif.MotifBrowserControlCanvas
*/
import java.awt.*;
import java.awt.Canvas;
import java.awt.event.*;
import sun.awt.*;
public abstract class BrowserControlCanvas extends Canvas
{
//
// Class Variables
//
private static int webShellCount = 0;
//
// Instance Variables
//
// Attribute Instance Variables
private boolean initializeOK;
private boolean boundsValid;
private boolean hasFocus;
// Relationship Instance Variables
private BrowserControl webShell;
private int nativeWindow;
private Rectangle windowRelativeBounds;
// PENDING(edburns): Is this needed: // private BrowserControlIdleThread idleThread;
//
// Constructors and Initializers
//
/**
* just initialize all the ivars. the initialize() method must be called
* before an instance of this class can be used. Instances are created
* in BrowserControlFactory.newBrowserControl().
*/
protected BrowserControlCanvas ()
{
nativeWindow = 0;
webShell = null;
initializeOK = false;
boundsValid = false;
hasFocus = false;
} // BrowserControlCanvas() ctor
protected void initialize(BrowserControl controlImpl)
{
ParameterCheck.nonNull(controlImpl);
webShell = controlImpl;
}
/**
* Obtain the native window handle for this component's
* peer.
*/
abstract protected int getWindow(DrawingSurfaceInfo dsi);
//
// Methods from Canvas
//
/**
* Instantiate the Mozilla WebShell container.
*/
public void addNotify ()
{
super.addNotify();
DrawingSurface ds = (DrawingSurface)this.getPeer();
DrawingSurfaceInfo dsi = ds.getDrawingSurfaceInfo();
windowRelativeBounds = new Rectangle();
// We must lock() the DrawingSurfaceInfo before
// accessing its native window handle.
dsi.lock();
nativeWindow = getWindow(dsi);
try {
Rectangle r = new Rectangle(getBoundsRelativeToWindow());
Assert.assert(null != webShell);
webShell.createWindow(nativeWindow, r);
} catch (Exception e) {
dsi.unlock();
System.out.println(e.toString());
return;
}
dsi.unlock();
initializeOK = true;
webShellCount++;
/*
requestFocus();
*/
} // addNotify()
public BrowserControl getWebShell ()
{
return webShell;
} // getWebShell()
protected Point getEventCoordsLocalToWindow(MouseEvent evt)
{
Rectangle localBounds = getBoundsRelativeToWindow();
int windowLocalX = evt.getX() + localBounds.x;
int windowLocalY = evt.getY() + localBounds.y;
return new Point(windowLocalX, windowLocalY);
} // getEventCoordsLocalToWindow()
protected Rectangle getWindowBounds ()
{// Throw an Exception?
Container parent = getParent();
if (parent != null) {
do {
// if the parent is a window, then return its bounds
if (parent instanceof Window == true) {
return parent.getBounds();
}
parent = parent.getParent();
} while (parent != null);
}
return new Rectangle();
} // getWindowBounds()
protected Rectangle getBoundsRelativeToWindow ()
{
if (boundsValid) {
return windowRelativeBounds;
}
Container parent = getParent();
Point ourLoc = getLocation();
Rectangle ourBounds = getBounds();
if (parent != null) {
do {
// if the parent is a window, then don't adjust to its offset
// and look no further
if (parent instanceof Window == true) {
break;
}
Point parentLoc = parent.getLocation();
ourLoc.translate(-parentLoc.x, -parentLoc.y);
parent = parent.getParent();
} while (parent != null);
}
windowRelativeBounds.setBounds(-ourLoc.x, -ourLoc.y, ourBounds.width, ourBounds.height);
boundsValid = true;
return windowRelativeBounds;
} // getBoundsRelativeToWindow()
public void setBounds(int x, int y, int w, int h)
{
super.setBounds(x, y, w, h);
if (webShell != null) {
System.out.println("in BrowserControlCanvas setBounds: x = " + x + " y = " + y + " w = " + w + " h = " + h);
try {
webShell.setBounds(new Rectangle(0, 0, w - 1, h - 1));
}
catch(Exception ex) {
}
}
}
public void setBounds(Rectangle rect)
{
super.setBounds(rect);
}
} // class BrowserControlCanvas
// EOF

View File

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
*/
package org.mozilla.webclient;
// BrowserControlCore.java
import java.awt.Canvas;
import java.awt.Rectangle;
/**
*
* <B>BrowserControlCore</B> Defines the core methods for browsing
*
* @version $Id: BrowserControlCore.java,v 1.4 1999/12/03 01:55:28 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlExtended
* @see org.mozilla.webclient.BrowserControl
*
*/
public interface BrowserControlCore
{
public void loadURL(String urlString) throws Exception;
public void stop() throws Exception;
public boolean canBack() throws Exception;
public boolean canForward() throws Exception;
public boolean back() throws Exception;
public boolean forward() throws Exception;
// added by Mark Goddard OTMP 9/2/1999
public boolean refresh() throws Exception;
public int getNativeWebShell();
public void createWindow(int windowPtr, Rectangle bounds) throws Exception;
public Canvas getCanvas();
} // end of interface BrowserControlCore

View File

@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
*/
package org.mozilla.webclient;
// BrowserControlExtended.java
import java.awt.Rectangle;
/**
*
* <B>BrowserControlExtended</B> defines the interface for extended browser
* functionality
*
* @version $Id: BrowserControlExtended.java,v 1.2 1999/11/06 02:24:17 dmose%mozilla.org Exp $
*
* @see org.mozilla.webclient.BrowserControlCore
* */
public interface BrowserControlExtended
{
public void show () throws Exception;
public void hide () throws Exception;
public void setBounds (Rectangle bounds) throws Exception;
public void moveTo (int x, int y) throws Exception;
public void setFocus () throws Exception;
public void removeFocus () throws Exception;
public void repaint (boolean forceRepaint) throws Exception;
public boolean goTo (int historyIndex) throws Exception;
public int getHistoryLength () throws Exception;
public int getHistoryIndex () throws Exception;
public String getURL (int historyIndex) throws Exception;
} // end of interface BrowserControlExtended

View File

@ -1,218 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Ed Burns <edburns@acm.org>
*/
package org.mozilla.webclient;
// BrowserControlFactory.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import java.io.File;
import java.io.FileNotFoundException;
/**
*
* <B>BrowserControlFactory</B> creates concrete instances of BrowserControl
* <B>Lifetime And Scope</B> <P>
* This is a static class, it is neven instantiated.
*
* @version $Id: BrowserControlFactory.java,v 1.3 1999/12/23 04:09:27 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.test.EmbeddedMozilla
*/
public class BrowserControlFactory extends Object
{
//
// Protected Constants
//
//
// Class Variables
//
private static boolean appDataHasBeenSet = false;
private static Class browserControlCanvasClass = null;
private static String platformCanvasClassName = null;
//
// Instance Variables
//
// Attribute Instance Variables
// Relationship Instance Variables
//
// Constructors and Initializers
//
public BrowserControlFactory()
{
Assert.assert(false, "This class shouldn't be constructed.");
}
//
// Class methods
//
/**
* This method is used to set per-application instance data, such as
* the location of the browser binary.
* @param absolutePathToNativeBrowserBinDir the path to the bin dir
* of the native browser, including the bin. ie:
* "D:\Projects\mozilla\dist\win32_d.obj\bin"
*/
public static void setAppData(String absolutePathToNativeBrowserBinDir) throws FileNotFoundException, ClassNotFoundException
{
if (!appDataHasBeenSet) {
ParameterCheck.nonNull(absolutePathToNativeBrowserBinDir);
// verify that the directory exists:
File binDir = new File(absolutePathToNativeBrowserBinDir);
if (!binDir.exists()) {
throw new FileNotFoundException("Directory " + absolutePathToNativeBrowserBinDir + " is not found.");
}
// cause the native library to be loaded
// PENDING(edburns): do some magic to determine the right kind of
// MozWebShellCanvas to instantiate
// How about this:
// I try loading sun.awt.windows.WDrawingSurfaceInfo. If it doesn't
// load, then I try loading sun.awt.motif.MDrawingSufaceInfo. If
// none loads, then I return a error message.
// If you think up of a better way, let me know.
// -- Mark
Class win32DrawingSurfaceInfoClass;
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;
try {
motifDrawingSurfaceInfoClass =
Class.forName("sun.awt.motif.MDrawingSurfaceInfo");
}
catch (Exception e) {
motifDrawingSurfaceInfoClass = null;
}
if (motifDrawingSurfaceInfoClass != null) {
platformCanvasClassName = "org.mozilla.webclient.motif.MotifBrowserControlCanvas";
}
}
if (platformCanvasClassName != null) {
browserControlCanvasClass = Class.forName(platformCanvasClassName);
}
else {
throw new ClassNotFoundException("Could not determine WebShellCanvas class to load\n");
}
try {
BrowserControlNativeShim.initialize(absolutePathToNativeBrowserBinDir);
}
catch (Exception e) {
throw new ClassNotFoundException("Can't initialize native browser: " +
e.getMessage());
}
appDataHasBeenSet = true;
}
}
public static BrowserControl newBrowserControl() throws InstantiationException, IllegalAccessException, IllegalStateException
{
if (!appDataHasBeenSet) {
throw new IllegalStateException("Can't create BrowserControlCanvasInstance: setAppData() has not been called.");
}
Assert.assert(null != browserControlCanvasClass);
BrowserControlCanvas newCanvas = null;
BrowserControl result = null;
newCanvas = (BrowserControlCanvas) browserControlCanvasClass.newInstance();
if (null != newCanvas &&
null != (result = new BrowserControlImpl(newCanvas))) {
newCanvas.initialize(result);
}
return result;
}
//
// General Methods
//
// ----UNIT_TEST_START
//
// Test methods
//
public static void main(String [] args)
{
System.out.println("doing asserts");
Assert.setEnabled(true);
Log.setApplicationName("BrowserControlFactory");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: BrowserControlFactory.java,v 1.3 1999/12/23 04:09:27 edburns%acm.org Exp $");
java.awt.Canvas canvas = null;
BrowserControl control = null;
try {
BrowserControlFactory.setAppData(args[0]);
control = BrowserControlFactory.newBrowserControl();
Assert.assert(control != null);
canvas = control.getCanvas();
Assert.assert(canvas != null);
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
// ----UNIT_TEST_END
} // end of class BrowserControlFactory

View File

@ -1,290 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
* Ann Sunhachawee
*/
package org.mozilla.webclient;
// BrowserControlImpl.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import java.awt.Rectangle;
import java.awt.Canvas;
/**
*
* <B>BrowserControlImpl</B> provides the implementation for BrowserControl
*
* <B>Lifetime And Scope</B> <P>
*
* @version $Id: BrowserControlImpl.java,v 1.9 2000/02/18 19:32:22 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControl
*
*/
public class BrowserControlImpl extends Object implements BrowserControl, EventRegistration
{
//
// Protected Constants
//
//
// Class Variables
//
//
// Instance Variables
//
// Attribute Instance Variables
// Relationship Instance Variables
/**
* a handle to the actual mozilla webShell
*/
private int nativeWebShell;
private Canvas myCanvas;
//
// Constructors and Initializers
//
protected BrowserControlImpl(Canvas yourCanvas)
{
ParameterCheck.nonNull(yourCanvas);
myCanvas = yourCanvas;
}
//
// Class methods
//
//
// General Methods
//
//
// Methods from BrowserControl
//
public void createWindow(int windowPtr, Rectangle bounds) throws Exception
{
nativeWebShell = BrowserControlNativeShim.webShellCreate(windowPtr, bounds, this);
}
public Canvas getCanvas()
{
return myCanvas;
}
public void loadURL(String urlString) throws Exception
{
BrowserControlNativeShim.webShellLoadURL(nativeWebShell, urlString);
}
public void stop() throws Exception
{
BrowserControlNativeShim.webShellStop(nativeWebShell);
}
public void show () throws Exception
{
BrowserControlNativeShim.webShellShow(nativeWebShell);
}
public void hide () throws Exception
{
BrowserControlNativeShim.webShellHide(nativeWebShell);
}
public void setBounds (Rectangle bounds) throws Exception
{
BrowserControlNativeShim.webShellSetBounds(nativeWebShell, bounds);
}
public void moveTo (int x, int y) throws Exception
{
BrowserControlNativeShim.webShellMoveTo(nativeWebShell, x, y);
}
/**
*
*/
public void setFocus () throws Exception
{
BrowserControlNativeShim.webShellSetFocus(nativeWebShell);
}
/**
*
*/
public void removeFocus () throws Exception
{
BrowserControlNativeShim.webShellRemoveFocus(nativeWebShell);
}
/**
*
*/
public void repaint (boolean forceRepaint) throws Exception
{
BrowserControlNativeShim.webShellRepaint(nativeWebShell, forceRepaint);
}
/**
*
*/
public boolean canBack () throws Exception
{
return BrowserControlNativeShim.webShellCanBack(nativeWebShell);
}
/**
*
*/
public boolean canForward () throws Exception
{
return BrowserControlNativeShim.webShellCanForward(nativeWebShell);
}
/**
*
*/
public boolean back () throws Exception
{
return BrowserControlNativeShim.webShellBack(nativeWebShell);
}
/**
*
*/
public boolean forward () throws Exception
{
return BrowserControlNativeShim.webShellForward(nativeWebShell);
}
/**
*
*/
public boolean goTo (int historyIndex) throws Exception
{
return BrowserControlNativeShim.webShellGoTo(nativeWebShell, historyIndex);
}
/**
*
*/
public int getHistoryLength () throws Exception
{
return BrowserControlNativeShim.webShellGetHistoryLength(nativeWebShell);
}
/**
*
*/
public int getHistoryIndex () throws Exception
{
return BrowserControlNativeShim.webShellGetHistoryIndex(nativeWebShell);
}
/**
*
*/
public String getURL (int historyIndex) throws Exception
{
return BrowserControlNativeShim.webShellGetURL(nativeWebShell, historyIndex);
}
/**
* Added by Mark Goddard OTMP 9/2/1999
*/
public boolean refresh() throws Exception
{
return BrowserControlNativeShim.webShellRefresh(nativeWebShell);
}
/**
* get EventRegistration object
*/
public EventRegistration getEventRegistration() {
return this;
}
/**
* add document load event listener
*/
public boolean addDocumentLoadListener(DocumentLoadListener dll) throws Exception {
return BrowserControlNativeShim.webShellAddDocListener(nativeWebShell, dll);
}
/**
*
*/
public int getNativeWebShell ()
{
return nativeWebShell;
}
/**
*
*/
public void finalize ()
{
try {
BrowserControlNativeShim.webShellDelete(nativeWebShell);
}
catch (Exception ex) {
System.out.println(ex.toString());
}
nativeWebShell = 0;
}
// ----UNIT_TEST_START
//
// Test methods
//
public static void main(String [] args)
{
Assert.setEnabled(true);
// BrowserControlImpl me = new BrowserControlImpl();
Log.setApplicationName("BrowserControlImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.9 2000/02/18 19:32:22 edburns%acm.org Exp $");
}
// ----UNIT_TEST_END
} // end of class BrowserControlImpl

View File

@ -1,430 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Ed Burns <edburns@acm.org>
* Mark Goddard
* Ann Sunhachawee
*/
package org.mozilla.webclient;
// MWebShellMozillaShim.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import java.awt.*;
/**
*
* <B>MWebShellMozillaShim</B> is a class with native methods that
* provides the glue between MWebShell and nsIWebShell. <P>
* WAS: instance <P>
* <B>Lifetime And Scope</B> <P>
* There is one instance of this class and all of the exposed methods
* are static.
* @version $Id: BrowserControlNativeShim.java,v 1.2 2000/02/18 19:16:26 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlImpl
*
*/
public class BrowserControlNativeShim extends Object
{
//
// Protected Constants
//
//
// Class Variables
//
private static boolean initialized = false;
private static BrowserControlNativeShim instance = null;
private static Object lock = null;
//private static int myGtkwinptr;
//
// Instance Variables
//
// Attribute Instance Variables
// Relationship Instance Variables
//
// Constructors and Initializers
//
public BrowserControlNativeShim()
{
super();
lock = new Object();
}
//
// Class methods
//
/**
* it is safe to call this method multiple times, it is guaranteed
* to only actually do something once.
*/
public static void initialize(String verifiedBinDirAbsolutePath) throws Exception
{
if (!initialized) {
instance = new BrowserControlNativeShim();
instance.nativeInitialize(verifiedBinDirAbsolutePath);
initialized = true;
}
}
public static void terminate () throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeTerminate();
initialized = false;
}
}
}
//
// WebShell methods
//
public static int webShellCreate (int windowPtr,
Rectangle bounds, BrowserControlImpl abrowsercontrolimpl) throws Exception
{
synchronized(lock) {
if (initialized) {
return(instance.nativeWebShellCreate(windowPtr,
bounds.x, bounds.y,
bounds.width + 1,
bounds.height + 1,
abrowsercontrolimpl));
}
else {
throw new Exception("Error: unable to create native nsIWebShell");
}
}
}
public static void webShellDelete (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellDelete(webShellPtr);
}
}
}
public static boolean webShellAddDocListener(int webShellPtr, DocumentLoadListener dl) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellAddDocListener(webShellPtr, dl);
} else {
throw new Exception ("instance is not initialized");
}
}
}
public static void webShellLoadURL (int webShellPtr,
String urlString) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellLoadURL(webShellPtr, urlString);
}
}
}
public static void webShellStop (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellStop(webShellPtr);
}
}
}
public static void webShellShow (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellShow(webShellPtr);
}
}
}
public static void webShellHide (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellHide(webShellPtr);
}
}
}
public static void webShellSetBounds (int webShellPtr,
Rectangle bounds) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellSetBounds(webShellPtr, bounds.x, bounds.y, bounds.width + 1, bounds.height + 1);
}
}
}
public static void webShellMoveTo (int webShellPtr,
int x, int y) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellMoveTo(webShellPtr, x, y);
}
}
}
public static void webShellSetFocus (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellSetFocus(webShellPtr);
}
}
}
public static void webShellRemoveFocus (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellRemoveFocus(webShellPtr);
}
}
}
public static void webShellRepaint (int webShellPtr,
boolean forceRepaint) throws Exception
{
synchronized(lock) {
if (initialized) {
instance.nativeWebShellRepaint(webShellPtr, forceRepaint);
}
}
}
public static boolean webShellCanBack (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellCanBack(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static boolean webShellCanForward (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellCanForward(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static boolean webShellBack (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellBack(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static boolean webShellForward (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellForward(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static boolean webShellGoTo (int webShellPtr,
int historyIndex) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellGoTo(webShellPtr, historyIndex);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static int webShellGetHistoryLength (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellGetHistoryLength(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static int webShellGetHistoryIndex (int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellGetHistoryIndex(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
public static String webShellGetURL(int webShellPtr,
int historyIndex) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellGetURL(webShellPtr, historyIndex);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
/**
* Added by Mark Goddard OTMP 9/2/1999
*/
public static boolean webShellRefresh(int webShellPtr) throws Exception
{
synchronized(lock) {
if (initialized) {
return instance.nativeWebShellRefresh(webShellPtr);
}
else {
throw new Exception("instance is not initialized.");
}
}
}
//
// Native interfaces
//
private native void nativeInitialize (String verifiedBinDirAbsolutePath) throws Exception;
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, 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;
private native void nativeWebShellShow (int webShellPtr) throws Exception;
private native void nativeWebShellHide (int webShellPtr) throws Exception;
private native void nativeWebShellSetBounds (int webShellPtr, int x, int y, int width, int height) throws Exception;
private native void nativeWebShellMoveTo (int webShellPtr, int x, int y) throws Exception;
private native void nativeWebShellSetFocus (int webShellPtr) throws Exception;
private native void nativeWebShellRemoveFocus (int webShellPtr) throws Exception;
private native void nativeWebShellRepaint (int webShellPtr, boolean forceRepaint) throws Exception;
private native boolean nativeWebShellCanBack (int webShellPtr) throws Exception;
private native boolean nativeWebShellCanForward (int webShellPtr) throws Exception;
private native boolean nativeWebShellBack (int webShellPtr) throws Exception;
private native boolean nativeWebShellForward (int webShellPtr) throws Exception;
private native boolean nativeWebShellGoTo (int webShellPtr, int aHistoryIndex) throws Exception;
private native int nativeWebShellGetHistoryLength (int webShellPtr) throws Exception;
private native int nativeWebShellGetHistoryIndex (int webShellPtr) throws Exception;
private native String nativeWebShellGetURL (int webShellPtr, int aHistoryIndex) throws Exception;
/**
* Added by Mark Goddard OTMP 9/2/1999
*/
private native boolean nativeWebShellRefresh (int webShellPtr) throws Exception;
private native boolean nativeWebShellAddDocListener(int webShellPtr, DocumentLoadListener dl);
public static native void nativeDebugBreak(String fileName, int lineNumber);
//
// General Methods
//
// ----UNIT_TEST_START
//
// Test methods
//
public static void main(String [] args)
{
Assert.setEnabled(true);
BrowserControlNativeShim me = new BrowserControlNativeShim();
Log.setApplicationName("BrowserControlNativeShim");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: BrowserControlNativeShim.java,v 1.2 2000/02/18 19:16:26 edburns%acm.org Exp $");
}
// ----UNIT_TEST_END
} // end of class BrowserControlNativeShim

View File

@ -1,7 +0,0 @@
package org.mozilla.webclient;
public interface DocListener {
public void handleDocLoaderEvent();
}

View File

@ -1,7 +0,0 @@
package org.mozilla.webclient;
public interface DocumentLoadListener {
public void docEventPerformed(String event);
}

View File

@ -1,8 +0,0 @@
package org.mozilla.webclient;
public interface EventRegistration {
public boolean addDocumentLoadListener(DocumentLoadListener dll) throws Exception;
}

View File

@ -1,142 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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):
*/
package org.mozilla.webclient.motif;
// MotifBrowserControlCanvas.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
/**
* MotifBrowserControlCanvas provides a concrete realization
* of the RaptorCanvas for Motif.
* <B>Lifetime And Scope</B> <P>
* There is one instance of the WebShellCanvas per top level awt Frame.
* @version $Id: MotifBrowserControlCanvas.java,v 1.6 1999/12/23 04:09:30 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlCanvasFactory
*
*/
import sun.awt.*;
import sun.awt.motif.*;
import java.awt.*;
import org.mozilla.webclient.*;
/**
* MotifBrowserControlCanvas provides a concrete realization
* of the RaptorCanvas.
*/
public class MotifBrowserControlCanvas extends BrowserControlCanvas /* implements ActionListener*/ {
static {
System.loadLibrary("webclientstub");
MotifBrowserControlCanvas.loadMainDll();
}
static private boolean firstTime = true;
private int gtkWinID;
private int gtkTopWindow;
private int canvasWinID;
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);
private native void reparentWindow(int child, int parent);
private native void processEvents();
private native void setGTKWindowSize(int gtkWinPtr, int width, int height);
public MotifBrowserControlCanvas() {
super();
this.gtkWinID = 0;
this.canvasWinID = 0;
this.gtkWinPtr = 0;
this.drawingSurfaceInfo = null;
}
public void paint(Graphics g) {
super.paint(g);
if (firstTime) {
synchronized(getTreeLock()) {
canvasWinID = this.drawingSurfaceInfo.getDrawable();
this.reparentWindow(this.gtkWinID, this.canvasWinID);
firstTime = false;
}
}
}
public void setBounds(int x, int y, int width, int height) {
super.setBounds(x, y, width, height);
synchronized(getTreeLock()) {
this.setGTKWindowSize(this.gtkTopWindow, width, height);
}
}
/**
* Needed for the hashtable look up of gtkwinid <-> WebShellInitContexts
*/
public int getGTKWinPtr() {
return this.gtkWinPtr;
}
/**
* Obtain the native window handle for this
* component's peer.
*
* @returns The native window handle.
*/
protected int getWindow(DrawingSurfaceInfo dsi) {
synchronized(getTreeLock()) {
this.drawingSurfaceInfo = (MDrawingSurfaceInfo) dsi;
this.gtkTopWindow = this.createTopLevelWindow();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.gtkWinPtr =
this.createContainerWindow(this.gtkTopWindow, screenSize.width,
screenSize.height);
this.gtkWinID = this.getGTKWinID(gtkWinPtr);
Thread nativeEventThread = new NativeEventThread(this);
nativeEventThread.start();
}
return this.gtkWinPtr;
}
}

View File

@ -1,98 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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):
*/
package org.mozilla.webclient.motif;
/**
* This is NativeEventThread. It's job is to process any pending mozilla events
* which have been queued up.
*
* It also contains a private static hashtable mapping of GTK window to
* WebShellInitContexts (see BrowserControllMozillaShim.cpp). It needs this
* because in order to process any GTK / Mozilla events, it needs a pointer
* to the native event queue, the native web shell, as well as native pointers
* to other things which it can't readily access.
* So what we do is when the WebShellInitContext for a GTK Window first gets
* created, it gets stored in the webShellContextMapping hashtable below. Then
* we can now easily lookup the appropriate WebShellInitContext when it is needed.
*
* <B>Lifetime And Scope</B> <P>
* There will be one of these per BrowserControlCanvas (but hasn't been tested yet)
*
* @version $Id: NativeEventThread.java,v 1.1 1999/12/23 04:09:31 edburns%acm.org Exp $
* @see org.mozilla.webclient.motif.NativeEventThread
*
*/
import java.util.*;
public class NativeEventThread extends Thread {
static private int eventQueueCount = 0;
// A mapping of gtkWindowID <-> WebShellInitContext structs
static private Hashtable webShellContextMapping = null;
protected MotifBrowserControlCanvas browserCanvas;
// Calling this will process any GTK / Mozilla events which have been pending
public native void processNativeEventQueue(int nativeWebShellContext);
public static void storeContext(int gtkWinID, int nativeWebShellContext) {
if (webShellContextMapping == null) {
webShellContextMapping = new Hashtable();
}
webShellContextMapping.put(new Integer(gtkWinID), new Integer(nativeWebShellContext));
}
public static int getContext(int gtkWinID) {
Integer result = (Integer) webShellContextMapping.get(new Integer(gtkWinID));
if (result != null) {
return result.intValue();
}
System.out.println("Requested invalid NativeWebShellInitContext!\n");
return 0;
}
public NativeEventThread(MotifBrowserControlCanvas canvas) {
super("Mozilla-Event-Thread-" + eventQueueCount);
this.browserCanvas = canvas;
eventQueueCount++;
this.setPriority(Thread.MAX_PRIORITY);
}
public void run() {
// Infinite loop to eternity.
while (true) {
// PENDING(mark): Do we need to yield?
// Thread.currentThread().yield();
synchronized(this.browserCanvas.getTreeLock()) {
this.processNativeEventQueue(getContext(this.browserCanvas.getGTKWinPtr()));
}
}
}
}

View File

@ -1,218 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
*/
package org.mozilla.webclient.test;
/*
* EmbeddedMozilla.java
*/
import java.awt.*;
import java.awt.event.*;
import org.mozilla.webclient.*;
import org.mozilla.util.Assert;
/**
*
* This is a test application for using the BrowserControl.
*
* @version $Id: EmbeddedMozilla.java,v 1.6 1999/12/06 23:31:06 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
*/
public class EmbeddedMozilla extends Frame implements ActionListener {
static final int defaultWidth = 640;
static final int defaultHeight = 480;
private TextField urlField;
private BrowserControl browserControl;
private Panel controlPanel;
private Panel buttonsPanel;
public static void printUsage()
{
System.out.println("usage: java org.mozilla.webclient.test.EmbeddedMozilla <path> [url]");
System.out.println(" <path> is the absolute path to the native browser bin directory, ");
System.out.println(" including the bin.");
}
public static void main (String[] arg) {
if (1 > arg.length) {
printUsage();
System.exit(-1);
}
String urlArg =(2 == arg.length) ? arg[1] : "http://www.mozilla.org/";
EmbeddedMozilla gecko =
new EmbeddedMozilla("Embedded Mozilla", arg[0], urlArg);
} // main()
public EmbeddedMozilla (String title, String binDir, String url) {
super(title);
System.out.println("constructed with binDir: " + binDir + " url: " +
url);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
// should close the BrowserControlCanvas
}
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
setSize(defaultWidth, defaultHeight);
// Create the URL field
urlField = new TextField("", 30);
urlField.addActionListener(this);
// Create the buttons sub panel
buttonsPanel = new Panel();
buttonsPanel.setLayout(new GridBagLayout());
// Add the buttons
makeItem(buttonsPanel, "Back", 0, 0, 1, 1, 0.0, 0.0);
makeItem(buttonsPanel, "Forward", 1, 0, 1, 1, 0.0, 0.0);
makeItem(buttonsPanel, "Stop", 2, 0, 1, 1, 0.0, 0.0);
makeItem(buttonsPanel, "Refresh", 3, 0, 1, 1, 0.0, 0.0);
// Create the control panel
controlPanel = new Panel();
controlPanel.setLayout(new BorderLayout());
// Add the URL field, and the buttons panel
controlPanel.add(urlField, BorderLayout.CENTER);
controlPanel.add(buttonsPanel, BorderLayout.WEST);
// Create the browser
Canvas browserCanvas = null;
try {
BrowserControlFactory.setAppData(binDir);
browserControl = BrowserControlFactory.newBrowserControl();
}
catch(Exception e) {
System.out.println("Can't create BrowserControl: " +
e.getMessage());
}
browserCanvas = browserControl.getCanvas();
Assert.assert(null != browserCanvas);
browserCanvas.setSize(defaultWidth, defaultHeight);
// Add the control panel and the browserCanvas
add(controlPanel, BorderLayout.NORTH);
add(browserCanvas, BorderLayout.CENTER);
pack();
show();
toFront();
try {
browserControl.loadURL(url);
urlField.setText(url);
}
catch (Exception e) {
System.out.println(e.toString());
}
} // EmbeddedMozilla() ctor
public void actionPerformed (ActionEvent evt) {
String command = evt.getActionCommand();
try {
if (command.equals("Back")) {
if (browserControl.canBack()) {
browserControl.back();
int index = browserControl.getHistoryIndex();
String newURL = browserControl.getURL(index);
System.out.println(newURL);
urlField.setText(newURL);
}
}
else if (command.equals("Forward")) {
if (browserControl.canForward()) {
browserControl.forward();
int index = browserControl.getHistoryIndex();
String newURL = browserControl.getURL(index);
System.out.println(newURL);
urlField.setText(newURL);
}
}
else if (command.equals("Stop")) {
browserControl.stop();
}
else if (command.equals("Refresh")) {
browserControl.refresh();
}
else {
browserControl.loadURL(urlField.getText());
}
}
catch (Exception e) {
System.out.println(e.toString());
}
} // actionPerformed()
private void makeItem (Panel p, Object arg, int x, int y, int w, int h, double weightx, double weighty) {
GridBagLayout gbl = (GridBagLayout) p.getLayout();
GridBagConstraints c = new GridBagConstraints();
Component comp;
c.fill = GridBagConstraints.BOTH;
c.gridx = x;
c.gridy = y;
c.gridwidth = w;
c.gridheight = h;
c.weightx = weightx;
c.weighty = weighty;
if (arg instanceof String) {
Button b;
comp = b = new Button((String) arg);
b.addActionListener(this);
p.add(comp);
gbl.setConstraints(comp, c);
}
} // makeItem()
}
// EOF

View File

@ -1,22 +0,0 @@
package org.mozilla.webclient.test.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
class BackAction extends AbstractAction {
private SwingEmbeddedMozilla em;
public BackAction(SwingEmbeddedMozilla em) {
super ("Back");
this.em = em;
}
public void actionPerformed(ActionEvent evt) {
System.out.println("Back was pressed!!");
em.back();
}
}

View File

@ -1,93 +0,0 @@
package org.mozilla.webclient.test.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
public class CommandPanel extends JPanel implements ActionListener {
private JToolBar urltool;
private JToolBar navtool;
private JTextField urlfield;
private JComboBox cb;
private SwingEmbeddedMozilla em;
public CommandPanel(SwingEmbeddedMozilla em) {
super();
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
setLayout(gbl);
this.em = em;
navtool = createNavToolBar();
urltool = createURLToolBar();
// Layout of the toolbars.
gbc.anchor = GridBagConstraints.NORTHWEST;
add(navtool, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
add(Box.createHorizontalGlue(), gbc);
gbc.gridwidth = 1;
add(urltool, gbc);
}
private JButton makeButton(String arg) {
JButton button = new JButton(arg);
return button;
}
private JToolBar createURLToolBar() {
JToolBar tb = new JToolBar();
// Ann - commented out the combobox for demo purposes. 9/20/99
// String temp[] = {"Fee", "Fi", "Fo", "Fum"};
//cb = new JComboBox(temp);
//cb.setEditable(true);
//cb.setLightWeightPopupEnabled(false);
urlfield = new JTextField(25);
tb.add(urlfield);
//tb.add(cb);
//cb.addActionListener(this);
urlfield.addActionListener(this);
return tb;
}
private JToolBar createNavToolBar() {
JToolBar tb = new JToolBar();
tb.add(new BackAction(em));
tb.add(new ForwardAction(em));
tb.add(new StopAction(em));
tb.add(new RefreshAction(em));
tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
return tb;
}
public JTextField getURLField() {
return urlfield;
}
public JToolBar getNavToolBar() {
return navtool;
}
public void actionPerformed (ActionEvent evt) {
String command = evt.getActionCommand();
String url = null;
System.out.println( "ActionComand is "+ command);
if ("comboBoxChanged".equals(command)) {
url = (String) cb.getSelectedItem();
} else {
url = urlfield.getText();
}
em.loadURL(url);
}
}

View File

@ -1,22 +0,0 @@
package org.mozilla.webclient.test.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
class ForwardAction extends AbstractAction {
private SwingEmbeddedMozilla em;
public ForwardAction(SwingEmbeddedMozilla em) {
super ("Forward");
this.em = em;
}
public void actionPerformed(ActionEvent evt) {
System.out.println("Forwardwas pressed!!");
em.forward();
}
}

View File

@ -1,22 +0,0 @@
package org.mozilla.webclient.test.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
class RefreshAction extends AbstractAction {
private SwingEmbeddedMozilla em;
public RefreshAction(SwingEmbeddedMozilla em) {
super ("Refresh");
this.em = em;
}
public void actionPerformed(ActionEvent evt) {
System.out.println("Refresh was pressed!!");
em.refresh();
}
}

View File

@ -1,32 +0,0 @@
package org.mozilla.webclient.test.swing;
/*
* StatusPanel.java
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
public class StatusTextField extends JTextField implements DocumentLoadListener {
public StatusTextField(BrowserControl bc) {
super();
setEditable(false);
try {
bc.getEventRegistration().addDocumentLoadListener(this);
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
public void docEventPerformed(String event) {
if (event.equals("startdocumentload")) {
this.setText("Loading document...");
} else if (event.equals("enddocumentload")) {
this.setText("Finished loading document.");
}
}
}

View File

@ -1,22 +0,0 @@
package org.mozilla.webclient.test.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
class StopAction extends AbstractAction {
private SwingEmbeddedMozilla em;
public StopAction(SwingEmbeddedMozilla em) {
super ("Stop");
this.em = em;
}
public void actionPerformed(ActionEvent evt) {
System.out.println("Stop was pressed!!");
em.stop();
}
}

View File

@ -1,251 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Ann Sunhachawee
*/
package org.mozilla.webclient.test.swing;
/*
* SwingEmbeddedMozilla.java
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.mozilla.webclient.*;
import org.mozilla.util.Assert;
/**
*
* This is a test application for using the BrowserControl.
*
* @version $Id: SwingEmbeddedMozilla.java,v 1.3 1999/12/03 01:55:31 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
*/
public class SwingEmbeddedMozilla extends JFrame
{
static final int defaultWidth = 640;
static final int defaultHeight = 480;
static String binDir = null;
private TextField urlField;
private BrowserControl browserControl;
private CommandPanel controlPanel;
public static void printUsage()
{
System.out.println("usage: java org.mozilla.webclient.test.SwingEmbeddedMozilla <path> [url]");
System.out.println(" <path> is the absolute path to the native browser bin directory, ");
System.out.println(" including the bin.");
}
public static void main (String[] arg) {
if (1 > arg.length) {
printUsage();
System.exit(-1);
}
String urlArg =(2 == arg.length) ? arg[1] : "http://www.mozilla.org/";
SwingEmbeddedMozilla.binDir = arg[0];
SwingEmbeddedMozilla gecko =
new SwingEmbeddedMozilla("Embedded Mozilla", arg[0], urlArg);
} // main()
public SwingEmbeddedMozilla (String title, String binDir, String url)
{
super(title);
Container contentPane = getContentPane();
JMenuBar menubar = createMenuBar();
System.out.println("constructed with " + url);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
// should close the BrowserControlCanvas
}
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
setSize(defaultWidth, defaultHeight);
// Create the browser
Canvas browserCanvas = null;
try {
BrowserControlFactory.setAppData(binDir);
browserControl = BrowserControlFactory.newBrowserControl();
}
catch(Exception e) {
System.out.println("Can't create BrowserControlCanvas: " +
e.getMessage());
}
browserCanvas = browserControl.getCanvas();
Assert.assert(null != browserCanvas);
browserCanvas.setSize(defaultWidth, defaultHeight);
// Add the control panel and the browser
contentPane.add(browserCanvas, BorderLayout.CENTER);
controlPanel = new CommandPanel(this);
contentPane.add(controlPanel, BorderLayout.NORTH);
getRootPane().setMenuBar(menubar);
pack();
show();
toFront();
// DocumentLoadListener dll;
try {
// dll = new DocumentLoadListener();
// browserControl.getEventRegistration().addDocumentLoadListener(dll);
contentPane.add(new StatusTextField(browserControl), BorderLayout.SOUTH);
} catch (Exception ex) {
System.out.println(ex.toString());
}
try {
browserControl.loadURL(url);
controlPanel.getURLField().setText(url);
}
catch (Exception e) {
System.out.println(e.toString());
}
} // SwingEmbeddedMozilla() ctor
private JMenuBar createMenuBar()
{
JMenuBar menubar = new JMenuBar();
JMenu menu = new JMenu("File");
JMenuItem exitItem = new JMenuItem("Exit");
JMenuItem newItem = new JMenuItem("New Window");
KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK);
KeyStroke ks_new = KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK);
menu.getPopupMenu().setLightWeightPopupEnabled(false);
newItem.setAccelerator(ks_new);
newItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new SwingEmbeddedMozilla("New Window", SwingEmbeddedMozilla.binDir,
controlPanel.getURLField().getText());
}
});
exitItem.setAccelerator(ks);
exitItem.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
menu.setMnemonic('F');
exitItem.setMnemonic(KeyEvent.VK_X);
newItem.setMnemonic(KeyEvent.VK_N);
menu.add(newItem);
menu.add(exitItem);
menubar.add(menu);
return menubar;
}
public void back()
{
try {
if (browserControl.canBack()) {
browserControl.back();
int index = browserControl.getHistoryIndex();
String newURL = browserControl.getURL(index);
System.out.println(newURL);
controlPanel.getURLField().setText(newURL);
}
} catch (Exception e) {
System.out.println( "anns: exception in back "+ e.toString());
}
}
public void forward()
{
try {
if (browserControl.canForward()) {
browserControl.forward();
int index = browserControl.getHistoryIndex();
String newURL = browserControl.getURL(index);
System.out.println(newURL);
controlPanel.getURLField().setText(newURL);
}
} catch (Exception e) {
System.out.println( "anns: exception in forward "+ e.toString());
}
}
public void stop()
{
try {
browserControl.stop();
} catch (Exception e) {
System.out.println("anns: exception in stop "+ e.toString());
}
}
public void refresh()
{
try {
browserControl.refresh();
} catch (Exception e) {
System.out.println("anns: exception in refresh" + e.toString());
}
}
public void loadURL(String url)
{
try {
browserControl.loadURL(url);
} catch (Exception e) {
System.out.println("anns: exception in load "+ e.toString());
}
}
}
// EOF

View File

@ -1,73 +0,0 @@
/* -*- 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):
*/
package org.mozilla.webclient.win32;
// Win32BrowserControlCanvas.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
/**
* Win32RaptorCanvas provides a concrete realization
* of the RaptorCanvas.
* <B>Lifetime And Scope</B> <P>
* There is one instance of the BrowserControlCanvas per top level awt Frame.
* @version $Id: Win32BrowserControlCanvas.java,v 1.2 1999/11/06 02:24:19 dmose%mozilla.org Exp $
*
* @see org.mozilla.webclient.BrowserControlCanvasFactory
*
*/
import sun.awt.*;
import sun.awt.windows.*;
import org.mozilla.webclient.*;
/**
* Win32BrowserControlCanvas provides a concrete realization
* of the RaptorCanvas.
*/
public class Win32BrowserControlCanvas extends BrowserControlCanvas {
static {
System.loadLibrary("webclient");
}
/**
* Obtain the native window handle for this
* component's peer.
*
* @returns The native window handle.
*/
protected int getWindow(DrawingSurfaceInfo dsi) {
WDrawingSurfaceInfo ds = (WDrawingSurfaceInfo)dsi;
return ds.getHWnd();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,144 +0,0 @@
#include "nsString.h"
#include "DocumentObserver.h"
#include "nsIDocumentLoaderObserver.h"
#include "nsISupportsUtils.h"
#include<stdio.h>
#include "jni_util.h"
#include <jni.h>
void fireDocumentLoadEvent(char *);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_IID);
NS_IMPL_ADDREF(DocumentObserver);
NS_IMPL_RELEASE(DocumentObserver);
jobject peer;
JavaVM *vm = NULL;
DocumentObserver::DocumentObserver(){
}
DocumentObserver::DocumentObserver(JNIEnv *env, jobject obj,
jint webShellPtr,
jobject doclistener) {
env->GetJavaVM(&vm); // save this vm reference away for the callback!
peer = env->NewGlobalRef(doclistener);
}
NS_IMETHODIMP DocumentObserver::QueryInterface(REFNSIID aIID, void** aInstance)
{
if (NULL == aInstance)
return NS_ERROR_NULL_POINTER;
*aInstance = NULL;
if (aIID.Equals(kIDocumentLoaderObserverIID)) {
*aInstance = (void*) ((nsIDocumentLoaderObserver*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
/* nsIDocumentLoaderObserver methods */
NS_IMETHODIMP DocumentObserver::OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand)
{
printf("DocumentObserver.cpp: OnStartDocumentLoad\n");
fireDocumentLoadEvent("startdocumentload");
return NS_OK;
}
NS_IMETHODIMP DocumentObserver::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus) {
printf("!!DocumentObserver.cpp: OnEndDocumentLoad\n");
fireDocumentLoadEvent("enddocumentload");
return NS_OK;
}
void fireDocumentLoadEvent(char *eventname) {
JNIEnv *env = (JNIEnv *) JNU_GetEnv(vm, JNI_VERSION_1_2);
if (env == NULL) {
return;
}
jclass clazz = env->GetObjectClass(peer);
jmethodID mid = env->GetMethodID(clazz, "docEventPerformed", "(Ljava/lang/String;)V");
jstring testmsg = env->NewStringUTF(eventname);
if ( mid != NULL) {
env->CallVoidMethod(peer, mid, testmsg);
} else {
printf("cannot call the Java Method!\n");
}
}
NS_IMETHODIMP DocumentObserver::OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel) {
printf("!DocumentObserver: OnStartURLLoad\n");
fireDocumentLoadEvent("startURLload");
return NS_OK;}
NS_IMETHODIMP DocumentObserver::OnProgressURLLoad(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
#else
nsIURI* aURL,
#endif
PRUint32 aProgress,
PRUint32 aProgressMax) {
printf("!DocumentObserver: OnProgressURLLoad\n");
fireDocumentLoadEvent("progressURLload");
return NS_OK;}
NS_IMETHODIMP DocumentObserver::OnStatusURLLoad(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
#else
nsIURI* aURL,
#endif
nsString& aMsg) {
printf("!DocumentObserver: OnStatusURLLoad\n");
fireDocumentLoadEvent("statusURLload");
return NS_OK;}
NS_IMETHODIMP DocumentObserver::OnEndURLLoad(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
nsresult aStatus) {
printf("!DocumentObserver: OnEndURLLoad\n");
fireDocumentLoadEvent("onendURLload");
return NS_OK;}
#else
nsIURI* aURL,
PRInt32 aStatus) {return NS_OK;}
#endif
NS_IMETHODIMP DocumentObserver::HandleUnknownContentType(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
#else
nsIURI* aURL,
#endif
const char *aContentType,
const char *aCommand) {
printf("!DocumentObserver: HandleUnknownContentType\n");
fireDocumentLoadEvent("handleunknown content");
return NS_OK;}

View File

@ -1,92 +0,0 @@
/*
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):
*/
#include "nsISupports.h"
#include "nsISupportsUtils.h"
#include "nsString.h"
#include "nsIDocumentLoaderObserver.h"
#include "jni.h"
class nsIURI;
class DocumentObserver : public nsIDocumentLoaderObserver {
NS_DECL_ISUPPORTS
public:
DocumentObserver::DocumentObserver(JNIEnv *env, jobject obj,
jint webShellPtr,
jobject doclistener);
DocumentObserver::DocumentObserver();
/* nsIDocumentLoaderObserver methods */
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader,
nsIURI* aURL,
const char* aCommand);
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIChannel* channel,
nsresult aStatus);
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader,
nsIChannel* channel);
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
#else
nsIURI* aURL,
#endif
PRUint32 aProgress,
PRUint32 aProgressMax);
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
#else
nsIURI* aURL,
#endif
nsString& aMsg);
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
nsresult aStatus);
#else
nsIURI* aURL,
PRInt32 aStatus);
#endif
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
#ifdef NECKO
nsIChannel* channel,
#else
nsIURI* aURL,
#endif
const char *aContentType,
const char *aCommand);
};

View File

@ -1,101 +0,0 @@
#//------------------------------------------------------------------------
#//
#// Makefile to build the native portion of webclient
#//
#//------------------------------------------------------------------------
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
#//------------------------------------------------------------------------
#//
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
#// (these must come before the common makefiles are included)
#//
#// DIRS - There are subdirectories to process
#//
#//------------------------------------------------------------------------
DIRS= motif
include $(topsrcdir)/config/config.mk
MODULE = webclient
LIBRARY_NAME = webclient
NO_LD_ARCHIVE_FLAGS = 1
CPPSRCS = nsActions.cpp \
BrowserControlNativeShim.cpp
ifeq ($(OS_TARGET),SunOS)
JDK_PLATFORM_PATH=jre/lib/sparc
else
JDK_PLATFORM_PATH=jre/lib/i386
endif
GTKLIBS = -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -lgmodule -lglib -ldl -lXext -lX11 -lm
JAVALIBS = -L${JDKHOME}/$(JDK_PLATFORM_PATH) -L${JDKHOME}/$(JDK_PLATFORM_PATH)/classic -L${JDKHOME}/$(JDK_PLATFORM_PATH)/native_threads -ljava
EXTRA_DSO_LDOPTS = \
$(GTKLIBS) \
$(JAVALIBS) \
$(NULL)
EXTRA_LIBS = \
raptorgfx \
expat \
xmltok \
jsurl \
mozdbm \
mozjs \
secfree \
mozutil \
nspr3 \
xp \
jpeg \
png \
z \
pthread \
xpcom \
img \
plds3 \
gfx_gtk \
raptorwebwidget \
raptorhtmlpars \
raptorplugin \
pref \
jsdom \
timer_gtk_s \
$(DEPTH)/xpfe/bootstrap/nsSetupRegistry.o \
$(NULL)
SHARED_LIBRARY_LIBS = $(DIST)/lib/libwebclient_motif.a
ifeq ($(NSPR_INCLUDE_DIR),)
INCLUDES += -I$(DIST)/include/private
else
INCLUDES += -I$(NSPR_INCLUDE_DIR)/private
endif
include $(topsrcdir)/config/rules.mk
#ifndef MOZ_MONOLITHIC_TOOLKIT
CXXFLAGS += $(MOZ_GTK_CFLAGS)
CFLAGS += $(MOZ_GTK_CFLAGS)
#else
CXXFLAGS += $(TK_CFLAGS)
CFLAGS += $(TK_CFLAGS)
#endif
DEFINES += -D_REENTRANT -DNECKO -DXP_UNIX -DDEBUG_RAPTOR_CANVAS
export:: BrowserControlNativeShim.h
BrowserControlMozillaShim.h:
@echo Assuming class org.mozilla.webclient.BrowserControlNativeShim is in $(JAVAH_FLAGS)
$(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.BrowserControlNativeShim

View File

@ -1,83 +0,0 @@
#
# PENDING(mark): I need to use gtk-config to find the libraries and
# include files
# For JDK1.2
JAVADIR = ${JDKHOME}
DLLNAME = libwebclient.so
DLLNAMESTUB = libwebclientstub.so
MOZILLA_TOP = ../../..
DIST = ${MOZILLA_TOP}/dist
LIBDIR = ${DIST}/lib
CC = gcc -g
MKSHLIB = cc -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
GTKLIBS = -L/opt/local/lib -L/usr/openwin/lib -R/usr/openwin/lib -lgtk -lgdk -lgmodule -lglib -ldl -lintl -lXext -lX11 -lsocket -lnsl -lm -L/usr/dt/lib
JAVAINCLUDE = -I${JAVADIR}/include -I${JAVADIR}/include/solaris
# For JDK1.2
# For Solaris
JAVALIBS = -L${JAVADIR}/jre/lib/sparc -ljava
INCLUDE = ${JAVAINCLUDE} -I${DIST}/include -I${MOZILLA_TOP}/widget/src/gtk ${GTKINCLUDES} ${GTKMOZILLAINCLUDE}
DEFINES = -D_REENTRANT -DNECKO -DXP_UNIX -DNS_DEBUG -DDEBUG_RAPTOR_CANVAS -DMOZ_DLL_SUFFIX=\".so\"
STUBDEFINES = -D_REENTRANT
STUBINCLUDE = ${JAVAINCLUDE}
STUBLIBS = ${JAVALIBS} /usr/lib/libC.so.5
# For the latest mozilla build
LIBS = ${GTKLIBS} ${JAVALIBS} \
-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 -lwidget_gtk -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 -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 copy
copy:
cp libwebclient*.so ${DIST}/bin
# component.reg components
component.reg:
${LN} ${DIST}/bin/component.reg
components:
${LN} ${DIST}/bin/components
libwebclientstub.so: BrowserControlNativeShimStub.o MotifBrowserControlCanvasStub.o
${MKSHLIB} -o ${DLLNAMESTUB} BrowserControlNativeShimStub.o MotifBrowserControlCanvasStub.o ${STUBLIBS}
libwebclient.so: BrowserControlNativeShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o DocumentObserver.o
${MKSHLIB} -o ${DLLNAME} BrowserControlNativeShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o DocumentObserver.o ${LIBS}
gtkmozilla.o: motif/gtkmozilla.cpp
${CC} ${DEFINES} ${INCLUDE} -c motif/gtkmozilla.cpp
MotifBrowserControlCanvasStub.o: motif/MotifBrowserControlCanvasStub.cpp
${CC} ${STUBDEFINES} ${STUBINCLUDE} -c motif/MotifBrowserControlCanvasStub.cpp
MotifBrowserControlCanvas.o: motif/MotifBrowserControlCanvas.cpp
${CC} ${DEFINES} ${INCLUDE} -c motif/MotifBrowserControlCanvas.cpp
BrowserControlNativeShimStub.o: motif/BrowserControlNativeShimStub.cpp
${CC} ${STUBDEFINES} ${STUBINCLUDE} -c motif/BrowserControlNativeShimStub.cpp
BrowserControlNativeShim.o: BrowserControlNativeShim.cpp
${CC} ${DEFINES} ${INCLUDE} -c BrowserControlNativeShim.cpp
motif/nsSetupRegistry.cpp:
cd motif
${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
nsActions.o: 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

View File

@ -1,72 +0,0 @@
#
# PENDING(mark): I need to use gtk-config to find the libraries and
# include files
# For JDK1.2
JAVADIR = ${JDKHOME}
DLLNAME = libwebclient.so
DLLNAMESTUB = libwebclientstub.so
MOZILLA_TOP = ../../..
DIST = ${MOZILLA_TOP}/dist
LIBDIR = ${DIST}/lib
# WARNING: YOU NEED TO RUN 'gtk-config --cflags' and stick it in here
GTKINCLUDES = -I/usr/X11R6/include -I/usr/lib/glib/include
# WARNING: YOU NEED TO RUN 'gtk-config --libs' and stick it in here
GTKLIBS = -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXext -lX11 -lm
JAVAINCLUDE = -I${JAVADIR}/include -I${JAVADIR}/include/genunix -I${JAVADIR}/include/linux
# For JDK1.2
# Native threads
JAVALIBS = -L${JAVADIR}/jre/lib/i386 -L${JAVADIR}/jre/lib/i386/classic -L${JAVADIR}/jre/lib/i386/native_threads -ljava
INCLUDE = ${JAVAINCLUDE} -I${DIST}/include ${GTKINCLUDES} ${GTKMOZILLAINCLUDE}
DEFINES = -D_REENTRANT -DNECKO -DXP_UNIX -DDEBUG_RAPTOR_CANVAS -DMOZ_DLL_SUFFIX=\".so\"
STUBDEFINES = -D_REENTRANT
STUBINCLUDE = ${JAVAINCLUDE}
STUBLIBS = ${JAVALIBS}
# For the latest mozilla build
LIBS = ${GTKLIBS} ${JAVALIBS} \
-L${DIST}/bin -lraptorgfx -lmozjs -lsecfree -lnspr3 -ljpeg -lpng -lz -lpthread -lXm -lXt -L${DIST}/lib -lxpcom -lplds3 -lgfx_gtk -lraptorwebwidget -lraptorhtmlpars -lraptorplugin -lpref -lplds3 -lplc3 -ljsdom -L${DIST}/lib -ltimer_s
LN = ln -f -s
all: libwebclientstub.so libwebclient.so component.reg components
component.reg:
${LN} ${DIST}/bin/component.reg
components:
${LN} ${DIST}/bin/components
libwebclientstub.so: BrowserControlMozillaShimStub.o MotifBrowserControlCanvasStub.o
g++ -shared -Wl,-h -Wl,${DLLNAMESTUB} -o ${DLLNAMESTUB} BrowserControlMozillaShimStub.o MotifBrowserControlCanvasStub.o -Wl,--whole-archive ${STUBLIBS} -Wl,--no-whole-archive
libwebclient.so: BrowserControlMozillaShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o
g++ -shared -Wl,-h -Wl,${DLLNAME} -o ${DLLNAME} BrowserControlMozillaShim.o MotifBrowserControlCanvas.o gtkmozilla.o nsActions.o nsSetupRegistry.o -Wl,--whole-archive ${LIBS} -Wl,--no-whole-archive
gtkmozilla.o: motif/gtkmozilla.cpp
g++ ${DEFINES} ${INCLUDE} -c motif/gtkmozilla.cpp
MotifBrowserControlCanvasStub.o: motif/MotifBrowserControlCanvasStub.cpp
g++ ${STUBDEFINES} ${STUBINCLUDE} -c motif/MotifBrowserControlCanvasStub.cpp
MotifBrowserControlCanvas.o: motif/MotifBrowserControlCanvas.cpp
g++ ${DEFINES} ${INCLUDE} -c motif/MotifBrowserControlCanvas.cpp
BrowserControlMozillaShimStub.o: motif/BrowserControlMozillaShimStub.cpp
g++ ${STUBDEFINES} ${STUBINCLUDE} -c motif/BrowserControlMozillaShimStub.cpp
BrowserControlMozillaShim.o: BrowserControlMozillaShim.cpp
g++ ${DEFINES} ${INCLUDE} -c BrowserControlMozillaShim.cpp
motif/nsSetupRegistry.cpp:
cd motif
${LN} ${MOZILLA_TOP}/../webshell/tests/viewer/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
g++ ${DEFINES} ${INCLUDE} -c motif/nsSetupRegistry.cpp
nsActions.o: nsActions.cpp
g++ ${DEFINES} ${INCLUDE} -c nsActions.cpp
clean:
rm -f component.reg components *.o *.so *~ motif/*~ motif/nsSetupRegistry.cpp

View File

@ -1,90 +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)\nsActions.obj \
.\$(OBJDIR)\BrowserControlNativeShim.obj \
.\$(OBJDIR)\DocumentObserver.obj \
.\$(OBJDIR)\jni_util.obj \
$(NULL)
LINCS = \
-I$(JDKHOME)\include \
-I$(JDKHOME)\include\win32 \
$(NULL)
LCFLAGS = \
$(NULL)
LLIBS = \
$(DIST)\lib\gkweb.lib \
$(DIST)\lib\raptorbasewidget_s.lib \
$(DIST)\lib\gkwidget.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\nsreg.lib \
$(DIST)\lib\nspr3.lib \
$(DIST)\lib\plds3.lib \
$(DEPTH)\xpfe\bootstrap\$(OBJDIR)\nsSetupRegistry.obj \
$(NULL)
WIN_LIBS = \
version.lib
include <$(DEPTH)\config\rules.mak>
include <$(DEPTH)\java\config\localdefs.mak>
!CMDSWITCHES -S
# generate the jni header
export:: BrowserControlNativeShim.h
BrowserControlNativeShim.h:
@echo Assuming class org.mozilla.webclient.BrowserControlNativeShim is in $(JAVAH_FLAGS)
$(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.BrowserControlNativeShim
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
@echo +++ Creating $(MOZ_SRC)\mozilla\java\webclient\src\$(OBJDIR)\runem.bat. Use this to run the test browser.
@echo set PATH=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin;$(PATH) > .\$(OBJDIR)\runem.bat
@echo $(JAVA) -Djava.library.path=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin -classpath $(JAVAC_CLASSPATH) org.mozilla.webclient.test.EmbeddedMozilla $(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin %1% >> .\$(OBJDIR)\runem.bat
@echo +++ Creating $(MOZ_SRC)\mozilla\java\webclient\src\$(OBJDIR)\swingem.bat. Use this to run the swing based test browser.
@echo set PATH=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin;$(PATH) > .\$(OBJDIR)\swingem.bat
@echo $(JAVA) -Djava.library.path=$(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin -classpath $(JAVAC_CLASSPATH) org.mozilla.webclient.test.swing.SwingEmbeddedMozilla $(MOZ_SRC)\mozilla\dist\$(OBJDIR)\bin %1% >> .\$(OBJDIR)\swingem.bat
clobber_all:: clobber
clobber::
rm -f $(DIST)\bin\$(DLLNAME).dll
rm -f BrowserControlNativeShim.h
rm -f .\$(OBJDIR)\runem.bat
rm -f .\$(OBJDIR)\swingem.bat

View File

@ -1,107 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include "jni.h"
#include "jni_util.h"
JNIEXPORT jvalue JNICALL
JNU_CallMethodByName(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
...)
{
jvalue result;
va_list args;
va_start(args, signature);
result = JNU_CallMethodByNameV(env, hasException, obj, name, signature,
args);
va_end(args);
return result;
}
JNIEXPORT jvalue JNICALL
JNU_CallMethodByNameV(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
va_list args)
{
jclass clazz;
jmethodID mid;
jvalue result;
const char *p = signature;
printf("jni_util: call method by name if 0");
/* find out the return type */
while (*p && *p != ')')
p++;
p++;
result.i = 0;
if ((*env)->EnsureLocalCapacity(env, 3) < 0)
goto done2;
printf("jni_util: call method by name if 1");
clazz = (*env)->GetObjectClass(env, obj);
printf("jni_util: call method by name 2");
mid = (*env)->GetMethodID(env, clazz, name, signature);
printf("jni_util: call method by name 3");
if (mid == 0)
goto done1;
printf("jni_util: call method by name if 4");
switch (*p) {
case 'V':
(*env)->CallVoidMethodV(env, obj, mid, args);
break;
case '[':
case 'L':
result.l = (*env)->CallObjectMethodV(env, obj, mid, args);
break;
case 'Z':
result.z = (*env)->CallBooleanMethodV(env, obj, mid, args);
break;
case 'B':
result.b = (*env)->CallByteMethodV(env, obj, mid, args);
break;
case 'C':
result.c = (*env)->CallCharMethodV(env, obj, mid, args);
break;
case 'S':
result.s = (*env)->CallShortMethodV(env, obj, mid, args);
break;
case 'I':
result.i = (*env)->CallIntMethodV(env, obj, mid, args);
break;
case 'J':
result.j = (*env)->CallLongMethodV(env, obj, mid, args);
break;
case 'F':
result.f = (*env)->CallFloatMethodV(env, obj, mid, args);
break;
case 'D':
result.d = (*env)->CallDoubleMethodV(env, obj, mid, args);
break;
default:
(*env)->FatalError(env, "JNU_CallMethodByNameV: illegal signature");
}
done1:
(*env)->DeleteLocalRef(env, clazz);
done2:
if (hasException) {
*hasException = (*env)->ExceptionCheck(env);
}
return result;
}
JNIEXPORT void * JNICALL
JNU_GetEnv(JavaVM *vm, jint version)
{
void *env;
(*vm)->GetEnv(vm, &env, version);
return env;
}

View File

@ -1,48 +0,0 @@
/*
* @(#)jni_util.h 1.24 98/09/02
*
* Copyright 1997, 1998 by Sun Microsystems, Inc.,
* 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Sun Microsystems, Inc. ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Sun.
*/
#ifndef JNI_UTIL_H
#define JNI_UTIL_H
#ifdef __cplusplus
extern "C" {
#endif
/* Invoke an instance method by name.
*/
JNIEXPORT jvalue JNICALL
JNU_CallMethodByName(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
...);
JNIEXPORT jvalue JNICALL
JNU_CallMethodByNameV(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
va_list args);
JNIEXPORT void * JNICALL
JNU_GetEnv(JavaVM *vm, jint version);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* JNI_UTIL_H */

View File

@ -1,578 +0,0 @@
/* -*- 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):
*/
/*
* BrowserControlNativeShimStub.cpp
*/
// PENDING(mark): I suppose this is where I need to go into my explaination of why
// this file is needed...
// For loading DLL
#include <dlfcn.h>
// JNI...yada, yada, yada
#include <jni.h>
// JNI Header
#include "../BrowserControlNativeShim.h"
// JNI Header
#include "NativeEventThread.h"
// allow code in webclientstub.so to load us
#include "BrowserControlNativeShimStub.h"
// Global reference to webclient dll
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, jobject);
void (* nativeWebShellDelete) (JNIEnv *, jobject, jint);
void (* nativeWebShellLoadURL) (JNIEnv *, jobject, jint, jstring);
void (* nativeWebShellStop) (JNIEnv *, jobject, jint);
void (* nativeWebShellShow) (JNIEnv *, jobject, jint);
void (* nativeWebShellHide) (JNIEnv *, jobject, jint);
void (* nativeWebShellSetBounds) (JNIEnv *, jobject, jint, jint, jint, jint, jint);
void (* nativeWebShellMoveTo) (JNIEnv *, jobject, jint, jint, jint);
void (* nativeWebShellSetFocus) (JNIEnv *, jobject, jint);
void (* nativeWebShellRemoveFocus) (JNIEnv *, jobject, jint);
void (* nativeWebShellRepaint) (JNIEnv *, jobject, jint, jboolean);
jboolean (* nativeWebShellCanBack) (JNIEnv *, jobject, jint);
jboolean (* nativeWebShellCanForward) (JNIEnv *, jobject, jint);
jboolean (* nativeWebShellBack) (JNIEnv *, jobject, jint);
jboolean (* nativeWebShellForward) (JNIEnv *, jobject, jint);
jboolean (* nativeWebShellGoTo) (JNIEnv *, jobject, jint, jint);
jint (* nativeWebShellGetHistoryLength) (JNIEnv *, jobject, jint);
jint (* nativeWebShellGetHistoryIndex) (JNIEnv *, jobject, jint);
jstring (* nativeWebShellGetURL) (JNIEnv *, jobject, jint, jint);
// added by Mark Goddard OTMP 9/2/1999
jboolean (* nativeWebShellRefresh)(JNIEnv *, jobject, jint);
jboolean (* nativeWebShellAddDocListener) (JNIEnv *, jobject, jint, jobject);
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());
}
nativeTerminate = (void (*) (JNIEnv *, jobject)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeTerminate");
if (!nativeTerminate) {
printf("got dlsym error %s\n", dlerror());
}
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());
}
nativeWebShellDelete = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellDelete");
if (!nativeWebShellDelete) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellLoadURL = (void (*) (JNIEnv *, jobject, jint, jstring)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellLoadURL");
if (!nativeWebShellLoadURL) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellStop = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellStop");
if (!nativeWebShellStop) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellShow = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellShow");
if (!nativeWebShellShow) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellHide = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellHide");
if (!nativeWebShellHide) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellSetBounds = (void (*) (JNIEnv *, jobject, jint, jint, jint, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellSetBounds");
if (!nativeWebShellSetBounds) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellMoveTo = (void (*) (JNIEnv *, jobject, jint, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellMoveTo");
if (!nativeWebShellMoveTo) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellSetFocus = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellSetFocus");
if (!nativeWebShellSetFocus) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellRemoveFocus = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRemoveFocus");
if (!nativeWebShellRemoveFocus) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellRepaint = (void (*) (JNIEnv *, jobject, jint, jboolean)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRepaint");
if (!nativeWebShellRepaint) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellCanBack = (jboolean (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCanBack");
if (!nativeWebShellCanBack) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellCanForward = (jboolean (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCanForward");
if (!nativeWebShellCanForward) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellBack = (jboolean (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellBack");
if (!nativeWebShellBack) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellForward = (jboolean (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellForward");
if (!nativeWebShellForward) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellGoTo = (jboolean (*) (JNIEnv *, jobject, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGoTo");
if (!nativeWebShellGoTo) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellGetHistoryLength = (jint (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetHistoryLength");
if (!nativeWebShellGetHistoryLength) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellGetHistoryIndex = (jint (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetHistoryIndex");
if (!nativeWebShellGetHistoryIndex) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellGetURL = (jstring (*) (JNIEnv *, jobject, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetURL");
if (!nativeWebShellGetURL) {
printf("got dlsym error %s\n", dlerror());
}
// added by Mark Goddard OTMP 9/2/1999
nativeWebShellRefresh = (jboolean (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRefresh");
if (!nativeWebShellRefresh) {
printf("got dlsym error %s\n", dlerror());
}
nativeWebShellAddDocListener = (jboolean (*) (JNIEnv *, jobject, jint, jobject)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellAddDocListener");
if (!nativeWebShellAddDocListener) {
printf("got dlsym error %s\n", dlerror());
}
processNativeEventQueue = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_motif_NativeEventThread_processNativeEventQueue");
if (!processNativeEventQueue) {
printf("got dlsym error %s\n", dlerror());
}
}
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
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_NativeEventThread_processNativeEventQueue
(JNIEnv * env, jobject obj, jint gtkWinPtr) {
(* 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: MozWebShellNativeShim
* Method: raptorInitialize
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeInitialize (
JNIEnv * env,
jobject obj, jstring verifiedBinDirAbsolutePath)
{
(* nativeInitialize) (env, obj, verifiedBinDirAbsolutePath);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeInitialize()
/*
* Class: MozWebShellNativeShim
* Method: raptorTerminate
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeTerminate (
JNIEnv * env,
jobject obj)
{
(* nativeTerminate) (env, obj);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeTerminate()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellCreate
* Signature: (IIIIII)I
*/
JNIEXPORT jint JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate (
JNIEnv * env,
jobject obj,
jint windowPtr,
jint x,
jint y,
jint width,
jint height,
jobject abrowsercontrolimpl)
{
return (* nativeWebShellCreate) (env, obj, windowPtr, x, y, width, height, abrowsercontrolimpl);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCreate()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellDelete
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellDelete (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
(* nativeWebShellDelete) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellDelete()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellLoadURL
* Signature: (ILjava/lang/String;)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellLoadURL (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jstring urlString)
{
(* nativeWebShellLoadURL) (env, obj, webShellPtr, urlString);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellLoadURL()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellStop
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellStop (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
(* nativeWebShellStop) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellStop()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellShow
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellShow (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
(* nativeWebShellShow) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellShow()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellHide
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellHide (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
(* nativeWebShellHide) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellHide()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellSetBounds
* Signature: (IIIII)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellSetBounds (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jint x,
jint y,
jint width,
jint height)
{
(* nativeWebShellSetBounds) (env, obj, webShellPtr, x, y, width, height);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellSetBounds()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellMoveTo
* Signature: (III)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellMoveTo (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jint x,
jint y)
{
(* nativeWebShellMoveTo) (env, obj, webShellPtr, x, y);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellMoveTo()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellSetFocus
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellSetFocus (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
(* nativeWebShellSetFocus) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellSetFocus()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellRemoveFocus
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRemoveFocus (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
(* nativeWebShellRemoveFocus) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRemoveFocus()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellRepaint
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRepaint (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jboolean forceRepaint)
{
(* nativeWebShellRepaint) (env, obj, webShellPtr, forceRepaint);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRepaint()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellCanBack
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCanBack (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellCanBack) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCanBack()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellCanForward
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCanForward (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellCanForward) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellCanForward()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellBack
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellBack (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellBack) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellBack()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellForward
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellForward (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellForward) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellForward()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellGoTo
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGoTo (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jint historyIndex)
{
return (* nativeWebShellGoTo) (env, obj, webShellPtr, historyIndex);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGoTo()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellGetHistoryLength
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetHistoryLength (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellGetHistoryLength) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetHistoryLength()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellGetHistoryIndex
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetHistoryIndex (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellGetHistoryIndex) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetHistoryIndex()
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellGetURL
* Signature: (II)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetURL (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jint historyIndex)
{
return (* nativeWebShellGetURL) (env, obj, webShellPtr, historyIndex);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellGetURL()
// added by Mark Goddard OTMP 9/2/1999
/*
* Class: MozWebShellNativeShim
* Method: raptorWebShellRefresh
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRefresh (
JNIEnv * env,
jobject obj,
jint webShellPtr)
{
return (* nativeWebShellRefresh) (env, obj, webShellPtr);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellRefresh()
/*
* Class: BrowserControlNativeShimStub
* Method: nativeWebShellAddDocListener
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellAddDocListener (
JNIEnv * env,
jobject obj,
jint webShellPtr,
jobject listener)
{
return (* nativeWebShellAddDocListener) (env, obj, webShellPtr, listener);
} // Java_org_mozilla_webclient_BrowserControlNativeShim_nativeWebShellAddDocListener()
// EOF

View File

@ -1,43 +0,0 @@
/* -*- 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):
*/
/*
* BrowserControlNativeShimStub.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);

View File

@ -1,103 +0,0 @@
#//------------------------------------------------------------------------
#//
#// Makefile to build the motif part of the native version of webclient
#//
#//------------------------------------------------------------------------
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
MODULE = webclient_motif
LIBRARY_NAME = webclient_motif
STUB_LIBRARY_NAME = webclientstub
# we don't want the shared lib, but we want to force the creation of a
# static lib.
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
CPPSRCS = \
BrowserControlNativeShimStub.cpp \
MotifBrowserControlCanvas.cpp \
MotifBrowserControlCanvasStub.cpp \
gtkmozilla.cpp \
nsSetupRegistry.cpp \
$(NULL)
# files that go into lib$(STUB_LIBRARY_NAME).so
STUBOBJS = \
BrowserControlNativeShimStub.o \
MotifBrowserControlCanvasStub.o \
$(NULL)
# files that go into lib$(LIBRARY_NAME).a
SHAREOBJS = \
MotifBrowserControlCanvas.o \
gtkmozilla.o \
nsSetupRegistry.o \
$(NULL)
include $(topsrcdir)/config/rules.mk
#ifeq ($(NSPR_INCLUDE_DIR),)
INCLUDES += -I$(DIST)/include/private
#else
INCLUDES += -I$(NSPR_INCLUDE_DIR)/private
#endif
ifndef MOZ_MONOLITHIC_TOOLKIT
CXXFLAGS += $(MOZ_GTK_CFLAGS)
CFLAGS += $(MOZ_GTK_CFLAGS)
else
CXXFLAGS += $(TK_CFLAGS)
CFLAGS += $(TK_CFLAGS)
endif
# include mozilla/widget/src/gtk/nsGtkEventHandler.h
INCLUDES += -I$(topsrcdir)/widget/src/gtk
# START section might end up in a file that gets included from this Makefile
STUB_LIBRARY := lib$(STUB_LIBRARY_NAME).so
# take the controls for creating the libraries
$(LIBRARY): $(LOBJS) $(SHAREOBJS) $(STUB_LIBRARY) Makefile Makefile.in
$(AR) -o $@ $(SHAREOBJS) $(LOBJS) $(SUB_LOBJS)
$(RANLIB) $@
@rm -f foodummyfilefoo $(SUB_LOBJS)
$(STUB_LIBRARY): $(STUBOBJS) Makefile Makefile.in
$(MKSHLIB) -o $@ $(STUBOBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS)
install::
$(INSTALL) -m 444 $(LIBRARY) $(DIST)/lib
$(INSTALL) -m 444 $(STUB_LIBRARY) $(DIST)/lib $(DIST)/bin
# END possible include section
# force everything to be done in the export phase
export:: MotifBrowserControlCanvas.h NativeEventThread.h nsSetupRegistry.cpp ../BrowserControlNativeShim.h libs install
nsSetupRegistry.cpp:
ln $(DEPTH)/webshell/tests/viewer/nsSetupRegistry.cpp nsSetupRegistry.cpp
MotifBrowserControlCanvas.h:
@echo Assuming class org.mozilla.webclient.motif.MotifBrowserControlCanvas is in $(JAVAH_FLAGS)
$(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.motif.MotifBrowserControlCanvas
NativeEventThread.h:
@echo Assuming class org.mozilla.webclient.motif.NativeEventThread is in $(JAVAH_FLAGS)
$(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.motif.NativeEventThread
../BrowserControlNativeShim.h:
@echo Assuming class org.mozilla.webclient.BrowserControlNativeShim is in $(JAVAH_FLAGS)
$(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.BrowserControlNativeShim

View File

@ -1,169 +0,0 @@
/* -*- 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):
*/
/*
* MotifBrowserControlCanvas.cpp
*/
#include <jni.h>
#include "MotifBrowserControlCanvas.h"
#include <X11/Xlib.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "gtkmozilla.h"
#include "gtkmozarea.h"
#include "nsIDOMDocument.h"
#include "nsGtkEventHandler.h"
#include <dlfcn.h>
extern "C" void NS_SetupRegistry();
extern "C" {
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: createTopLevelWindow
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow
(JNIEnv * env, jobject obj) {
static GtkWidget *mShell = NULL;
/* Initialise GTK */
gtk_set_locale ();
gtk_init (0, NULL);
gdk_event_handler_set (handle_gdk_event, NULL, NULL);
gdk_rgb_init();
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;
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: createContainerWindow
* Signature: (III)I
*/
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 *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(mMozArea);
gtk_widget_show(window);
//gtk_main();
return (jint) mMozArea;
}
int getWinID(GtkWidget * gtkWidgetPtr) {
//GdkWindow * gdkWindow = gtk_widget_get_parent_window(gtkWidgetPtr);
GdkWindow * gdkWindow = gtkWidgetPtr->window;
int gtkwinid = GDK_WINDOW_XWINDOW(gdkWindow);
return gtkwinid;
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: getGTKWinID
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_getGTKWinID
(JNIEnv * env, jobject obj, jint gtkWinPtr) {
GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr;
return getWinID(gtkWidgetPtr);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: reparentWindow
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_reparentWindow (JNIEnv * env, jobject obj, jint childID, jint parentID) {
XReparentWindow(GDK_DISPLAY(), childID, parentID, 0, 0);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: processEvents
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_processEvents
(JNIEnv * env, jobject obj) {
//printf("process events....\n");
//processEventLoopIntelligently();
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: setGTKWindowSize
* Signature: (III)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_setGTKWindowSize
(JNIEnv * env, jobject obj, jint gtkWinPtr, jint width, jint height) {
if (gtkWinPtr != 0) {
GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr;
if (gtkWidgetPtr) {
gtk_widget_set_usize(gtkWidgetPtr, width, height);
}
}
}
/*
* 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"

View File

@ -1,147 +0,0 @@
/* -*- 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):
*/
/*
* MotifBrowserControlCanvasStub.cpp
*/
// PENDING(mark): I suppose this is where I need to go into my explaination of why
// this file is needed...
#include <jni.h>
#include "MotifBrowserControlCanvas.h"
#include "BrowserControlNativeShimStub.h"
#include <dlfcn.h>
extern void locateBrowserControlStubFunctions(void *);
jint (* createTopLevelWindow) (JNIEnv *, jobject);
jint (* createContainerWindow) (JNIEnv *, jobject, jint, jint, jint);
jint (* getGTKWinID) (JNIEnv *, jobject, jint);
void (* reparentWindow) (JNIEnv *, jobject, jint, jint);
void (* processEvents) (JNIEnv *, jobject);
void (* setGTKWindowSize) (JNIEnv *, jobject, jint, jint, jint);
void locateMotifBrowserControlStubFunctions(void * dll) {
createTopLevelWindow = (jint (*) (JNIEnv *, jobject)) dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow");
if (!createTopLevelWindow) {
printf("got dlsym error %s\n", dlerror());
}
createContainerWindow = (jint (*) (JNIEnv *, jobject, jint, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createContainerWindow");
if (!createContainerWindow) {
printf("got dlsym error %s\n", dlerror());
}
reparentWindow = (void (*) (JNIEnv *, jobject, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_reparentWindow");
if (!reparentWindow) {
printf("got dlsym error %s\n", dlerror());
}
processEvents = (void (*) (JNIEnv *, jobject)) dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_processEvents");
if (!processEvents) {
printf("got dlsym error %s\n", dlerror());
}
setGTKWindowSize = (void (*) (JNIEnv *, jobject, jint, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_setGTKWindowSize");
if (!setGTKWindowSize) {
printf("got dlsym error %s\n", dlerror());
}
getGTKWinID = (jint (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_getGTKWinID");
if (!getGTKWinID) {
printf("got dlsym error %s\n", dlerror());
}
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: createTopLevelWindow
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow (JNIEnv * env, jobject obj) {
return (* createTopLevelWindow) (env, obj);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: createContainerWindow
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createContainerWindow (JNIEnv * env, jobject obj, jint parent, jint width, jint height) {
return (* createContainerWindow) (env, obj, parent, width, height);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: getGTKWinID
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_getGTKWinID
(JNIEnv * env, jobject obj, jint gtkWinPtr) {
return (* getGTKWinID) (env, obj, gtkWinPtr);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: reparentWindow
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_reparentWindow
(JNIEnv * env, jobject obj, jint childID, jint parentID) {
(* reparentWindow) (env, obj, childID, parentID);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: processEvents
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_processEvents
(JNIEnv * env, jobject obj) {
(* processEvents) (env, obj);
}
/*
* Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas
* Method: setGTKWindowSize
* Signature: (III)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_setGTKWindowSize
(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();
}

View File

@ -1,131 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "MPL"); you may not use this file except in
* compliance with the MPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of the Original Code is Alexander. Portions
* created by Alexander Larsson are Copyright (C) 1999
* Alexander Larsson. All Rights Reserved.
*/
/*
* gtkmozilla.cpp
*/
#include <gtk/gtk.h>
#include "gtkmozilla.h"
static void gtk_mozilla_realize(GtkWidget *widget);
static void gtk_mozilla_finalize (GtkObject *object);
typedef gboolean (*GtkSignal_BOOL__POINTER_INT) (GtkObject * object,
gpointer arg1,
gint arg2,
gpointer user_data);
extern "C" void
gtk_mozilla_marshal_BOOL__POINTER_INT (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
GtkSignal_BOOL__POINTER_INT rfunc;
gboolean *return_val;
return_val = GTK_RETLOC_BOOL (args[2]);
rfunc = (GtkSignal_BOOL__POINTER_INT) func;
*return_val = (*rfunc) (object,
GTK_VALUE_POINTER (args[0]),
GTK_VALUE_INT (args[1]),
func_data);
}
static GtkLayoutClass *parent_class = 0;
static void
gtk_mozilla_class_init (GtkMozillaClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass;
parent_class = (GtkLayoutClass *)gtk_type_class (GTK_TYPE_LAYOUT);
object_class->finalize = gtk_mozilla_finalize;
widget_class->realize = gtk_mozilla_realize;
}
static void
gtk_mozilla_realize (GtkWidget *widget)
{
//printf("gtk_mozilla_realize()\n");
GtkMozilla *moz = GTK_MOZILLA(widget);
if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
}
static void
gtk_mozilla_init (GtkMozilla *moz)
{
//printf("gtk_mozilla_init()\n");
gtk_layout_set_hadjustment (GTK_LAYOUT (moz), 0);
gtk_layout_set_vadjustment (GTK_LAYOUT (moz), 0);
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(moz), GTK_CAN_FOCUS);
}
GtkType
gtk_mozilla_get_type (void)
{
static GtkType mozilla_type = 0;
if (!mozilla_type) {
static const GtkTypeInfo mozilla_info = {
"GtkMozilla",
sizeof (GtkMozilla),
sizeof (GtkMozillaClass),
(GtkClassInitFunc) gtk_mozilla_class_init,
(GtkObjectInitFunc) gtk_mozilla_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
};
mozilla_type = gtk_type_unique (GTK_TYPE_LAYOUT, &mozilla_info);
}
return mozilla_type;
}
GtkWidget*
gtk_mozilla_new (void)
{
GtkMozilla *moz;
moz = GTK_MOZILLA(gtk_type_new(GTK_TYPE_MOZILLA));
return GTK_WIDGET (moz);
}
static void
gtk_mozilla_finalize (GtkObject *object)
{
GtkMozilla *moz;
g_return_if_fail(object != NULL);
g_return_if_fail(GTK_IS_MOZILLA(object));
moz = GTK_MOZILLA(object);
GTK_OBJECT_CLASS(parent_class)->finalize (object);
}

View File

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 Alexander
* Larsson. Portions created by Alexander Larsson are
* Copyright (C) 1999 Alexander Larsson. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* gtkmozilla.h
*/
#ifndef GTKMOZILLA_H
#define GTKMOZILLA_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <gtk/gtklayout.h>
#define GTK_TYPE_MOZILLA (gtk_mozilla_get_type ())
#define GTK_MOZILLA(obj) GTK_CHECK_CAST ((obj), GTK_TYPE_MOZILLA, GtkMozilla)
#define GTK_MOZILLA_CLASS(klass) GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MOZILLA, GtkMozillaClass)
#define GTK_IS_MOZILLA(obj) GTK_CHECK_TYPE ((obj), GTK_TYPE_MOZILLA)
#define GTK_IS_MOZILLA_CLASS(klass) GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MOZILLA)
typedef struct _GtkMozilla GtkMozilla;
typedef struct _GtkMozillaClass GtkMozillaClass;
struct _GtkMozilla
{
GtkLayout layout;
};
struct _GtkMozillaClass
{
GtkLayoutClass parent_class;
};
extern GtkType gtk_mozilla_get_type(void);
extern GtkWidget* gtk_mozilla_new(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GTKMOZILLA_H */

View File

@ -1,664 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
*/
/*
* nsActions.cpp
*/
#include "nsActions.h"
#include "nsCOMPtr.h"
#include "nsIContentViewer.h"
#include "nsIBaseWindow.h"
void * handleEvent (PLEvent * event);
void destroyEvent (PLEvent * event);
void *
handleEvent (PLEvent * event)
{
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
void * result = nsnull;
result = actionEvent->handleEvent();
return result;
} // handleEvent()
void
destroyEvent (PLEvent * event)
{
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
if (actionEvent != NULL) {
actionEvent->destroyEvent();
}
} // destroyEvent()
/*
* nsActionEvent
*/
nsActionEvent::nsActionEvent ()
{
PL_InitEvent(&mEvent, this,
(PLHandleEventProc ) ::handleEvent,
(PLDestroyEventProc) ::destroyEvent);
}
/*
* wsResizeEvent
*/
wsResizeEvent::wsResizeEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) :
nsActionEvent(),
mWebShell(webShell),
mLeft(x),
mBottom(y),
mWidth(w),
mHeight(h)
{
}
void *
wsResizeEvent::handleEvent ()
{
nsresult rv = NS_ERROR_FAILURE;
if (mWebShell) {
printf("handleEvent(resize(x = %d y = %d w = %d h = %d))\n", mLeft, mBottom, mWidth, mHeight);
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
getter_AddRefs(baseWindow));
if (NS_FAILED(rv)) {
return NULL;
}
rv = baseWindow->SetPositionAndSize(mLeft, mBottom, mWidth, mHeight,
PR_TRUE);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsLoadURLEvent
*/
wsLoadURLEvent::wsLoadURLEvent(nsIWebShell* webShell, PRUnichar * urlString) :
nsActionEvent(),
mWebShell(webShell),
mURL(nsnull)
{
mURL = new nsString(urlString);
}
void *
wsLoadURLEvent::handleEvent ()
{
if (mWebShell && mURL) {
printf("handleEvent(loadURL))\n");
nsresult rv = mWebShell->LoadURL(mURL->GetUnicode());
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
wsLoadURLEvent::~wsLoadURLEvent ()
{
if (mURL != nsnull)
delete mURL;
}
/*
* wsStopEvent
*/
wsStopEvent::wsStopEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsStopEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Stop))\n");
nsresult rv = mWebShell->Stop();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsShowEvent
*/
wsShowEvent::wsShowEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsShowEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Show))\n");
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
getter_AddRefs(baseWindow));
if (NS_FAILED(rv)) {
return NULL;
}
baseWindow->SetVisibility(PR_TRUE);
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsHideEvent
*/
wsHideEvent::wsHideEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsHideEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Hide))\n");
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
getter_AddRefs(baseWindow));
if (NS_FAILED(rv)) {
return NULL;
}
baseWindow->SetVisibility(PR_FALSE);
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsMoveToEvent
*/
wsMoveToEvent::wsMoveToEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y) :
nsActionEvent(),
mWebShell(webShell),
mX(x),
mY(y)
{
}
void *
wsMoveToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(MoveTo(%ld, %ld))\n", mX, mY);
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
getter_AddRefs(baseWindow));
if (NS_FAILED(rv)) {
return NULL;
}
rv = baseWindow->SetPosition(mX, mY);
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsSetFocusEvent
*/
wsSetFocusEvent::wsSetFocusEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsSetFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(SetFocus())\n");
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
getter_AddRefs(baseWindow));
if (NS_FAILED(rv)) {
return NULL;
}
rv = baseWindow->SetFocus();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsRemoveFocusEvent
*/
wsRemoveFocusEvent::wsRemoveFocusEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsRemoveFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(RemoveFocus())\n");
nsresult rv = mWebShell->RemoveFocus();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsRepaintEvent
*/
wsRepaintEvent::wsRepaintEvent(nsIWebShell* webShell, PRBool forceRepaint) :
nsActionEvent(),
mWebShell(webShell),
mForceRepaint(forceRepaint)
{
}
void *
wsRepaintEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Repaint(%d))\n", mForceRepaint);
nsresult rv;
nsCOMPtr<nsIBaseWindow> baseWindow;
rv = mWebShell->QueryInterface(NS_GET_IID(nsIBaseWindow),
getter_AddRefs(baseWindow));
if (NS_FAILED(rv)) {
return NULL;
}
rv = baseWindow->Repaint(mForceRepaint);
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsCanBackEvent
*/
wsCanBackEvent::wsCanBackEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsCanBackEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(CanBack())\n");
nsresult rv = mWebShell->CanBack();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsCanForwardEvent
*/
wsCanForwardEvent::wsCanForwardEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsCanForwardEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(CanForward())\n");
nsresult rv = mWebShell->CanForward();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsBackEvent
*/
wsBackEvent::wsBackEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsBackEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Back())\n");
nsresult rv = mWebShell->Back();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsForwardEvent
*/
wsForwardEvent::wsForwardEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsForwardEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Forward())\n");
nsresult rv = mWebShell->Forward();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsGoToEvent
*/
wsGoToEvent::wsGoToEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
nsActionEvent(),
mWebShell(webShell),
mHistoryIndex(historyIndex)
{
}
void *
wsGoToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(GoTo(%ld))\n", mHistoryIndex);
nsresult rv = mWebShell->GoTo(mHistoryIndex);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsGetHistoryLengthEvent
*/
wsGetHistoryLengthEvent::wsGetHistoryLengthEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsGetHistoryLengthEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetHistoryLengthEvent())\n");
PRInt32 historyLength = 0;
nsresult rv = mWebShell->GetHistoryLength(historyLength);
printf("result = %lx\n", rv);
return (void *) historyLength;
}
return NULL;
} // handleEvent()
/*
* wsGetHistoryIndexEvent
*/
wsGetHistoryIndexEvent::wsGetHistoryIndexEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsGetHistoryIndexEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetHistoryIndexEvent())\n");
PRInt32 historyIndex = 0;
nsresult rv = mWebShell->GetHistoryIndex(historyIndex);
printf("result = %lx\n", rv);
return (void *) historyIndex;
}
return NULL;
} // handleEvent()
/*
* wsGetURLEvent
*/
wsGetURLEvent::wsGetURLEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
nsActionEvent(),
mWebShell(webShell),
mHistoryIndex(historyIndex)
{
}
void *
wsGetURLEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetURLEvent(%ld))\n", mHistoryIndex);
const PRUnichar * url = nsnull;
// returns PRUninchar * URL in <url>. No need to delete. References internal buffer of an nsString
nsresult rv = mWebShell->GetURL(mHistoryIndex, &url);
printf("result = %lx, url = %lx\n", rv, url);
return (void *) url;
}
return NULL;
} // handleEvent()
// Added by Mark Goddard OTMP 9/2/1999
/*
* wsRefreshEvent
*/
wsRefreshEvent::wsRefreshEvent(nsIWebShell* webShell) :
nsActionEvent(),
mWebShell(webShell)
{
}
void *
wsRefreshEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Refresh())\n");
nsresult rv = mWebShell->Reload(nsIChannel::LOAD_NORMAL);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
// EOF

View File

@ -1,263 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
*/
/*
* nsActions.h
*/
#ifndef nsActions_h___
#define nsActions_h___
#ifndef XP_UNIX
#include <windows.h>
#endif
#include "nsIWebShell.h"
#include "nsString.h"
#include "plevent.h"
class nsActionEvent {
public:
nsActionEvent ();
virtual ~nsActionEvent () {};
virtual void * handleEvent (void) { return NULL;};
void destroyEvent (void) { delete this; };
operator PLEvent* () { return &mEvent; };
protected:
PLEvent mEvent;
};
class wsResizeEvent : public nsActionEvent {
public:
wsResizeEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mLeft;
PRInt32 mBottom;
PRInt32 mWidth;
PRInt32 mHeight;
};
class wsLoadURLEvent : public nsActionEvent {
public:
wsLoadURLEvent (nsIWebShell* webShell, PRUnichar * urlString);
~wsLoadURLEvent ();
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsString * mURL;
};
class wsStopEvent : public nsActionEvent {
public:
wsStopEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsShowEvent : public nsActionEvent {
public:
wsShowEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsHideEvent : public nsActionEvent {
public:
wsHideEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsMoveToEvent : public nsActionEvent {
public:
wsMoveToEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mX;
PRInt32 mY;
};
class wsSetFocusEvent : public nsActionEvent {
public:
wsSetFocusEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsRemoveFocusEvent : public nsActionEvent {
public:
wsRemoveFocusEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsRepaintEvent : public nsActionEvent {
public:
wsRepaintEvent (nsIWebShell* webShell, PRBool forceRepaint);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRBool mForceRepaint;
};
class wsCanBackEvent : public nsActionEvent {
public:
wsCanBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsCanForwardEvent : public nsActionEvent {
public:
wsCanForwardEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsBackEvent : public nsActionEvent {
public:
wsBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsForwardEvent : public nsActionEvent {
public:
wsForwardEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsGoToEvent : public nsActionEvent {
public:
wsGoToEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
};
class wsGetHistoryLengthEvent : public nsActionEvent {
public:
wsGetHistoryLengthEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsGetHistoryIndexEvent : public nsActionEvent {
public:
wsGetHistoryIndexEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsGetURLEvent : public nsActionEvent {
public:
wsGetURLEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
};
// added by Mark Goddard OTMP 9/2/1999
class wsRefreshEvent : public nsActionEvent {
public:
wsRefreshEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
#endif /* nsActions_h___ */
// EOF

View File

@ -1,39 +0,0 @@
#!/bin/sh
MOZILLA_TOP=${PWD}/../../..
MOZILLA_DIST=${MOZILLA_TOP}/dist
MOZILLA_FIVE_HOME=${MOZILLA_DIST}/bin
export MOZILLA_FIVE_HOME
# Standard JDK 1.2 location
JDK_LOCATION=${JDKHOME}
# WARNING: YOU NEED TO RUN 'gtk-config --libs' and stick in whatever library
# paths it gives you!!!!
GTKLIBS=/usr/local/X11R6/lib:/opt/local/lib:/usr/openwin/lib:/usr/dt/lib
# For Solaris
LD_LIBRARY_PATH=${JDK_LOCATION}/jre/lib/sparc:${JDK_LOCATION}/jre/lib/sparc/native_threads:${JDK_LOCATION}/jre/lib/sparc/classic:${MOZILLA_DIST}/bin:${GTKLIBS}:.:/usr/local/lib:/usr/lib:/lib
export LD_LIBRARY_PATH
JAVA=${JDK_LOCATION}/bin/java
OUTPUT_DIR=${MOZILLA_DIST}/classes
# JDK 1.2 CLASSES
CLASSES=${JDK_LOCATION}/lib/tools.jar:${JDK_LOCATION}/lib/rt.jar:${OUTPUT_DIR}
CLASSNAME=org.mozilla.webclient.test.EmbeddedMozilla
echo
echo "===================================================================="
echo JDKHOME=${JDKHOME}
echo "===================================================================="
echo CLASSPATH=${CLASSES}
echo "===================================================================="
echo MOZILLA_FIVE_HOME=${MOZILLA_FIVE_HOME}
echo "===================================================================="
echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
echo "===================================================================="
echo
# For debugging...
#${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

View File

@ -1,37 +0,0 @@
#!/bin/sh
MOZILLA_TOP=${PWD}/../../..
MOZILLA_DIST=${MOZILLA_TOP}/dist
MOZILLA_FIVE_HOME=${MOZILLA_DIST}/bin
export MOZILLA_FIVE_HOME
# Standard JDK 1.2 location
JDK_LOCATION=${JDKHOME}
# WARNING: YOU NEED TO RUN 'gtk-config --libs' and stick in whatever library
# paths it gives you!!!!
GTKLIBS=/usr/lib
LD_LIBRARY_PATH=${JDK_LOCATION}/jre/lib/i386:${JDK_LOCATION}/jre/lib/i386/classic:${JDK_LOCATION}/jre/lib/i386/native_threads:${MOZILLA_DIST}/bin:${GTKLIBS}:.:/usr/local/lib:/usr/lib:/lib
export LD_LIBRARY_PATH
JAVA=${JDK_LOCATION}/bin/java
OUTPUT_DIR=${MOZILLA_DIST}/classes
# JDK 1.2 CLASSES
CLASSES=${JDK_LOCATION}/lib/tools.jar:${JDK_LOCATION}/lib/rt.jar:${OUTPUT_DIR}
CLASSNAME=org.mozilla.webclient.test.EmbeddedMozilla
echo
echo "===================================================================="
echo JDKHOME=${JDKHOME}
echo "===================================================================="
echo CLASSPATH=${CLASSES}
echo "===================================================================="
echo MOZILLA_FIVE_HOME=${MOZILLA_FIVE_HOME}
echo "===================================================================="
echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
echo "===================================================================="
echo
# For debugging...
#${JAVA} -native -verbose:jni -Xcheck:jni -classpath ${CLASSES} ${CLASSNAME} $1
${JAVA} -native -classpath ${CLASSES} ${CLASSNAME} $1 $2 $3 $4 $5