Merged branch JAVADEV_PR3_20001002 into trunk.

git-svn-id: svn://10.0.0.236/trunk@82247 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2000-11-02 23:33:21 +00:00
parent 19a05b26cb
commit aee4ebbf93
71 changed files with 1537 additions and 521 deletions

View File

@@ -29,6 +29,8 @@ DIRS= \
src \
jni \
classes \
test \
examples \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -29,6 +29,8 @@ DIRS= \
src \
jni \
classes \
test \
examples \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -63,14 +63,14 @@ Requirements:
* current mozilla built tree
* JDK1.2 or JDK1.3
* JDK1.3
* Perl 5 must be in your path
How To Build:
* make sure the environment var JDKHOME is set to your jdk installation
directory, ie export JDKHOME=/usr/local/jdk1.2
directory, ie export JDKHOME=/usr/local/jdk1.3
* Add following directories to to your LD_LIBRARY_PATH:
@@ -84,13 +84,13 @@ How to Run:
* Add $MOZILLA_FILE_HOME/../classes to your CLASSPATH
How to build and run test
* go to the test directory and type "gmake"
test.jar will be placed in mozilla/dist/bin/plugins directory
* Set PLUGLET environment to the directory you have test.jar
* Run mozilla and load page test.html from test directory and if everething is ok you will see
some awt demo.
* set LD_PRELOAD to libXm.so
* Run mozilla and load page resource:///res/javadev/pluglets/test.html and if everething is ok you will see some awt demo.
========================================================================
@@ -101,3 +101,5 @@ Problems:

View File

@@ -31,8 +31,11 @@ public class PlugletInputStream extends InputStream {
nativeInitialize();
}
public int read() throws IOException {
read(buf,0,1);
return buf[0];
if (read(buf,0,1) < 0) {
return -1;
} else {
return buf[0] & 0xff;
}
}
public int read(byte b[], int off, int len) throws IOException {
if (b == null) {

View File

@@ -43,7 +43,9 @@ public class PlugletStreamInfoImpl implements PlugletStreamInfo {
* @param offset the start point for reading.
* @param length the number of bytes to be read.
*/
public native void requestRead(ByteRanges ranges);
public void requestRead(ByteRanges ranges) {
throw(new UnsupportedOperationException("PlugletStreamInfo.requestRead not implemented yet"));
}
protected void finalize() {
nativeFinalize();
}

View File

@@ -61,12 +61,16 @@ public class PlugletTagInfo2Impl implements PlugletTagInfo2 {
/* Get the complete text of the HTML tag that was
* used to instantiate this pluglet
*/
public native String getTagText();
public String getTagText() {
throw(new UnsupportedOperationException("PlugletTagInfo2.getTagText not implemented yet"));
}
public native String getDocumentBase();
/* Return an encoding whose name is specified in:
* http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303
*/
public native String getDocumentEncoding();
public String getDocumentEncoding() {
throw(new UnsupportedOperationException("PlugletTagInfo2.getDocumentEncoding not implemented yet"));
}
public native String getAlignment();
public native int getWidth();
public native int getHeight();

View File

@@ -0,0 +1,75 @@
#
# 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):
#
# Igor Kushnirskiy idk@eng.sun.com
include $(DEPTH)/config/autoconf.mk
include $(DEPTH)/config/config.mk
ifneq ($(PACKAGE_BUILD),)
JAVADEV=$(DIST)/javadev
PLUGLETS_DIR=$(JAVADEV)/example
MISC_DIR=$(JAVADEV)/misc
HTML_DIR=$(JAVADEV)/misc
INSTALL = $(DEPTH)/config/nsinstall -m 666
else
PLUGLETS_DIR=$(DIST)/bin/plugins
MISC_DIR=$(DIST)/bin/res/javadev/pluglets
HTML_DIR=$(DIST)/bin/res/javadev/pluglets
endif
$(PLUGLET).jar: $(CLASSES) manifest
$(JDKHOME)/bin/jar cvfm $(PLUGLET).jar manifest *.class
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath .:../../classes:$(CLASSPATH):JavaDOM.jar $<
clobber:
rm -f *.class *.jar
clean : clobber
ifneq ($(PLUGLET),)
INSTALL_DEPS += install_pluglet
endif
ifneq ($(HTML),)
INSTALL_DEPS += install_html
endif
ifneq ($(MISC),)
INSTALL_DEPS += install_misc
endif
install_pluglet: $(PLUGLET).jar
$(INSTALL) $(PLUGLET).jar $(PLUGLETS_DIR)
install_html :
$(INSTALL) $(HTML) $(HTML_DIR)
install_misc :
$(INSTALL) $(MISC) $(MISC_DIR)
install: $(INSTALL_DEPS)
export: install

View File

@@ -0,0 +1,35 @@
#!gmake
# 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):
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS= \
zip \
rtf \
dom \
demo \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,31 +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):
JMPlayer.jar: JMPlayer.class manifest
$(JDKHOME)/bin/jar cvfm JMPlayer.jar manifest *.class
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath ../classes:$(CLASSPATH) $<
clobber:
rm *.class *.jar
install:
cp *.jar $(PLUGLET)

View File

@@ -18,14 +18,9 @@
#
# Contributor(s):
DEPTH= ../../../..
JView.jar: JView.class manifest
$(JDKHOME)/bin/jar cvfm JView.jar manifest *.class
PLUGLET=JMPlayer
CLASSES=JMPlayer.class
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath ../classes:$(CLASSPATH) $<
clobber:
rm *.class *.jar
install:
cp *.jar $(PLUGLET)
include ../../config/rules.mk

View File

@@ -18,14 +18,11 @@
#
# Contributor(s):
DEPTH= ../../../..
ZipView.jar: ZipView.class manifest
$(JDKHOME)/bin/jar cvfm ZipView.jar manifest *.class
HTML=index.html
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath ../classes:$(CLASSPATH) $<
clobber:
rm *.class *.jar
install:
cp *.jar $(PLUGLET)
include ../../config/rules.mk
export:
cp pluglet_run.sh $(DEPTH)/bin

View File

@@ -0,0 +1,12 @@
<html>
<title>
Pluglets demo
</title>
<body>
<ul>
<li> <a href="test.html" target="new"> Test plulets </a>
<li> <a href="dom.html" target="new"> DOM viewer plulets </a>
<li> <a href="zip.html" target="new"> Zip viewer plulets </a>
</ul>
</body>
</thml>

View File

@@ -0,0 +1,4 @@
#!/bin/sh
LD_PRELOAD=libXm.so
export LD_PRELOAD
./mozilla resource:///res/javadev/pluglets/index.html

View File

@@ -1,31 +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):
DOMViewer.jar: DOMViewerFactory.class DOMAccessPanel.class DOMTreeDumper.class manifest
$(JDKHOME)/bin/jar cvfm DOMViewer.jar manifest *.class
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath .:../../classes:$(CLASSPATH):JavaDOM.jar $<
clobber:
rm *.class *.jar
install:
cp *.jar $(PLUGLET)

View File

@@ -18,14 +18,13 @@
#
# Contributor(s):
DEPTH= ../../../..
test.jar: test.class manifest
$(JDKHOME)/bin/jar cvfm test.jar manifest *.class
PLUGLET=DOMViewer
CLASSES=DOMViewerFactory.class DOMAccessPanel.class DOMTreeDumper.class
HTML=dom.html
include ../../config/rules.mk
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath ../classes $<
clobber:
rm *.class *.jar

View File

@@ -18,14 +18,9 @@
#
# Contributor(s):
DEPTH= ../../../..
PDFView.jar: PDFView.class manifest
$(JDKHOME)/bin/jar cvfm PDFView.jar manifest *.class
PLUGLET=PDFView.jar
CLASSES=PDFView.class
.SUFFIXES: .java .class
.java.class:
$(JDKHOME)/bin/javac -classpath ../classes:$(CLASSPATH) $<
clobber:
rm *.class *.jar
install:
cp *.jar $(PLUGLET)
include ../../config/rules.mk

View File

@@ -0,0 +1,26 @@
#
# 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= ../../../..
PLUGLET=JView
CLASSES=JView.class
include ../../config/rules.mk

View File

@@ -0,0 +1,34 @@
#
# 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= ../../../..
PLUGLET=ZipView
CLASSES=ZipView.class
MISC=ZipView.jar
HTML=zip.html
include ../../config/rules.mk

View File

@@ -67,7 +67,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletInputStream_close
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletInputStream_nativeRead
(JNIEnv *env, jobject jthis, jbyteArray b, jint off, jint len) {
PRUint32 retval = 0;
jint retval = -1;
nsIInputStream * input = (nsIInputStream*)env->GetLongField(jthis, peerFID);
if (input) {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
@@ -91,17 +91,19 @@ JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletInputStream_nativ
//nb throw OutOfMemory
}
nsresult res;
res = input->Read((char*)bufElems,(PRUint32)len,&retval);
PRUint32 actualLen;
res = input->Read((char*)bufElems,(PRUint32)len,&actualLen);
if (NS_FAILED(res)) {
free(bufElems);
return retval;
}
retval = actualLen;
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("PlugletInputStream.nativeRead: %i bytes read\n", retval));
env->SetByteArrayRegion(b,off,retval,bufElems);
free(bufElems);
return retval;
return (len > 0 && actualLen <= 0) ? -1 : retval;
}
/*

View File

@@ -183,13 +183,15 @@ void PlugletEngine::StartJVM() {
("PlugletEngine::StartJVM we got already started JVM\n"));
return;
}
char classpath[1024];
char classpath[1024]="";
JavaVMInitArgs vm_args;
JavaVMOption options[2];
sprintf(classpath, "-Djava.class.path=%s",PR_GetEnv("CLASSPATH"));
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("PlugletEngine::StartJVM about to create JVM classpath=%s\n",classpath));
char * classpathEnv = PR_GetEnv("CLASSPATH");
if (classpath != NULL) {
sprintf(classpath, "-Djava.class.path=%s",classpathEnv);
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("PlugletEngine::StartJVM about to create JVM classpath=%s\n",classpath));
}
options[0].optionString = classpath;
options[1].optionString=""; //-Djava.compiler=NONE";
vm_args.version = 0x00010002;

View File

@@ -179,7 +179,7 @@ int PlugletFactory::Compare(const char *mimeType) {
char *p1 = mimeDescription;
char *p2 = strchr(p1,';');
while ( p1 != NULL && p1 < terminator ) {
size_t n = sizeof(char) * ( ( (p2 == NULL) ? terminator : p2) - p1 );
size_t n = sizeof(char) * ( ( (p2 == NULL || p2 > terminator) ? terminator : p2) - p1 );
if (PL_strncasecmp(p1,mimeType,n) == 0) {
return 1;
}

View File

@@ -28,12 +28,6 @@
#include <Xm/PushB.h>
#include <Xm/DrawingA.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gdksuperwin.h>
#include <gtkmozbox.h>
#include "PlugletViewMotif.h"
#include "PlugletEngine.h"
@@ -67,6 +61,10 @@ static Colormap awt_cmap;
static Visual * awt_visual;
static int awt_num_colors;
static void (*AwtLock)(JNIEnv *);
static void (*AwtUnLock)(JNIEnv *);
static void (*AwtNoFlushUnLock)(JNIEnv *);
void PlugletViewMotif::Initialize() {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("PlugletViewMotif.Initialize\n"));
@@ -83,6 +81,7 @@ void PlugletViewMotif::Initialize() {
return;
}
getAwtData(&awt_depth, &awt_cmap, &awt_visual, &awt_num_colors, NULL);
getAwtLockFunctions(&AwtLock, &AwtUnLock, &AwtNoFlushUnLock,NULL);
}
PRBool PlugletViewMotif::SetWindow(nsPluginWindow* win) {
@@ -100,7 +99,7 @@ PRBool PlugletViewMotif::SetWindow(nsPluginWindow* win) {
|| !win->window) {
if (win && !win->window) {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("PlugletViewMotif.SetWindow win->window = NULL. We have a bug in plugin module. this=%p\n",this));
("PlugletViewMotif.SetWindow win->window = NULL. We have a bug in plugin module. this=%p\n",this));
}
if (frame) {
env->DeleteGlobalRef(frame);
@@ -112,30 +111,16 @@ PRBool PlugletViewMotif::SetWindow(nsPluginWindow* win) {
}
return PR_FALSE;
}
GdkSuperWin * superWin = (GdkSuperWin *) win->window;
Window parentWindowID;
Window rootWindowID;
Window * childrenWindowIDs;
unsigned int numberOfChildren;
int containerWindowID = GDK_WINDOW_XWINDOW(superWin->shell_window);
Status status = XQueryTree(GDK_DISPLAY(), containerWindowID,
&rootWindowID, &parentWindowID,
&childrenWindowIDs, & numberOfChildren);
if (numberOfChildren >= 1) {
containerWindowID = childrenWindowIDs[0];
}
if (WindowID == containerWindowID) {
return PR_FALSE;
}
WindowID = containerWindowID;
void (*AwtLock)(JNIEnv *);
void (*AwtUnLock)(JNIEnv *);
void (*AwtNoFlushUnLock)(JNIEnv *);
getAwtLockFunctions(&AwtLock, &AwtUnLock, &AwtNoFlushUnLock,NULL);
AwtLock(env);
int containerWindowID = win->window;
printf("containerWindowID=%d WindowID=%d\n",containerWindowID, WindowID);
#if 0
if (WindowID == containerWindowID) {
printf("about to return false\n");
return PR_FALSE;
}
#endif
WindowID = containerWindowID;
Display *awt_display = getAwtDisplay();
XSync(awt_display, FALSE);
Arg args[40];

View File

@@ -0,0 +1,26 @@
#
# 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= ../../..
PLUGLET=test
CLASSES=test.class
HTML=test.html
include ../config/rules.mk