Port pluglets to linux and Solaris
(This is not part of the build)
This commit is contained in:
idk%eng.sun.com 1999-11-20 23:19:40 +00:00
Родитель 7b598ec648
Коммит ab99cae7bf
24 изменённых файлов: 656 добавлений и 143 удалений

34
java/plugins/Makefile Normal file
Просмотреть файл

@ -0,0 +1,34 @@
#!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 = ../..
VPATH = .
srcdir = .
include $(DEPTH)/config/autoconf.mk
DIRS= \
src \
jni \
classes \
$(NULL)
include $(topsrcdir)/config/rules.mk

34
java/plugins/Makefile.in Normal file
Просмотреть файл

@ -0,0 +1,34 @@
#!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= \
src \
jni \
classes \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -15,23 +15,24 @@ The sources is divided into four directories
Test code, including simple pluglet.
========================================================================
Win32 Build Directions:
Win32 Directions:
========================================================================
Requirements:
* built M8 mozilla tree for WinNT4.0
* current mozilla built tree
* JDK1.3
* JDK1.3 or JDK1.2 if you are not using OJI
* Perl 5 perl.exe must be in your path
How To Build:
* Follow the directions in ..\README
* make sure the environment var JDKHOME is set to your jdk installation
directory, ie SET JDKHOME=C:\jdk1.2
* if you do not have working OJI set OJI_DISABLE to 1
(You can do it in your command prompt, or you can set it in
mozilla/java/plugins/src).
mozilla/java/plugins/src/makefile.win).
* type "nmake /f makefile.win"
@ -49,14 +50,52 @@ How to build and run test
* Set PLUGLET environment to the directory you have test.jar
* Run mozilla and load page test.html from test directory and if evething is ok you will see
some output from the test pluglet on the stdout.
* Run mozilla and load page test.html from test directory and if everething is ok you will see
some awt demo.
=========================================================================
Unix (Sparc Solaris and i386 Linux) Directions:
=========================================================================
Requirements:
* current mozilla built tree
* JDK1.2 or 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
* Add following directories to to your LD_LIBRARY_PATH:
$MOZILLA_FIVE_HOME:$JDKHOME/jre/lib/$HOSTTYPE/native_threads:$JDKHOME/jre/lib/$HOSTTYPE/classic:
$JDKHOME/jre/lib/$HOSTTYPE/:
* type "gmake"
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"
* 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.
========================================================================
Problems:
* clobber_all doesn't remove the .class files from dist\classes. You
have to do this manually.
* post to netscape.public.mozilla.java newsgroup

Просмотреть файл

@ -0,0 +1,52 @@
#!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@
IGNORE_MANIFEST=1
JAVA_OR_NSJVM=1
NO_CAFE=1
# PENDING(frankm): find out how to define this for UNIX/SunOS
JAVAC=$(JDKHOME)/bin/javac
JAVALIB=$(JDKHOME)/lib
include $(DEPTH)/config/autoconf.mk
JAR_PLUGLET_CLASSES = \
org/mozilla/util \
org/mozilla/pluglet \
org/mozilla/pluglet/mozilla \
$(NULL)
ifdef JAVA_OR_NSJVM
JDIRS = $(JAR_PLUGLET_CLASSES)
endif
include $(topsrcdir)/config/rules.mk
JAVAC=$(JDKHOME)/bin/javac -classpath .:$(CLASSPATH) -d $(DIST)/classes

Просмотреть файл

@ -27,15 +27,22 @@ import java.util.jar.Attributes;
import java.io.InputStream;
import org.mozilla.pluglet.mozilla.*;
import java.security.*;
import java.awt.*;
public class PlugletLoader {
static {
System.loadLibrary("plugletjni");
Dimension screenSize = new Button().getToolkit().getScreenSize();
}
// path to jar file. Name of main class sould to be in MANIFEST.
public static PlugletFactory getPluglet(String path) {
try {
org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet("+path+")\n");
URL url = new URL("file:/"+path);
URL url = new URL("file://"+path);
URLClassLoader loader = URLClassLoader.newInstance(new URL[]{url});
URL manifestURL = new URL("jar:file:/"+path+"!/META-INF/MANIFEST.MF");
URL manifestURL = new URL("jar:file://"+path+"!/META-INF/MANIFEST.MF");
InputStream inputStream = manifestURL.openStream();
Manifest manifest = new Manifest(inputStream);
Attributes attr = manifest.getMainAttributes();
@ -75,7 +82,7 @@ public class PlugletLoader {
public static String getMIMEDescription(String path) {
try {
org.mozilla.util.Debug.print("-- PlugletLoader.getMIMEDescription("+path+")\n");
URL manifestURL = new URL("jar:file:/"+path+"!/META-INF/MANIFEST.MF");
URL manifestURL = new URL("jar:file://"+path+"!/META-INF/MANIFEST.MF");
InputStream inputStream = manifestURL.openStream();
Manifest manifest = new Manifest(inputStream);
Attributes attr = manifest.getMainAttributes();

Просмотреть файл

@ -22,8 +22,6 @@ package org.mozilla.util;
public class Debug {
public static native void print(String str);
static {
System.loadLibrary("plugletjni");
}
}

Просмотреть файл

@ -19,6 +19,7 @@
* Contributor(s):
*/
#include <stdlib.h>
#include "ByteRanges.h"
jfieldID ByteRanges::offsetFID = NULL;

Просмотреть файл

@ -18,6 +18,8 @@
*
* Contributor(s):
*/
#include <stdlib.h>
#include "nsIInputStream.h"
#include "org_mozilla_pluglet_mozilla_PlugletInputStream.h"

Просмотреть файл

@ -18,6 +18,8 @@
*
* Contributor(s):
*/
#include <stdlib.h>
#include "nsIOutputStream.h"
#include "org_mozilla_pluglet_mozilla_PlugletOutputStream.h"

Просмотреть файл

@ -1,97 +0,0 @@
Index: nsPluginHostImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp,v
retrieving revision 1.76
diff -C3 -r1.76 nsPluginHostImpl.cpp
*** nsPluginHostImpl.cpp 1999/09/16 01:15:58 1.76
--- nsPluginHostImpl.cpp 1999/09/17 03:49:37
***************
*** 1863,1868 ****
--- 1863,1872 ----
result = GetPluginFactory(mimetype, &plugin);
if(!NS_FAILED(result)){
result = plugin->CreateInstance(NULL, kIPluginInstanceIID, (void **)&instance);
+ if (NS_FAILED(result)) {
+ result = plugin->CreatePluginInstance(NULL, kIPluginInstanceIID,aMimeType, (void **)&instance);
+ }
+
NS_RELEASE(plugin);
}
}
***************
*** 1911,1917 ****
for (cnt = 0; cnt < variants; cnt++)
{
! if (0 == strcmp(plugins->mMimeTypeArray[cnt], aMimeType))
return NS_OK;
}
--- 1915,1922 ----
for (cnt = 0; cnt < variants; cnt++)
{
! if (0 == strcmp(plugins->mMimeTypeArray[cnt], aMimeType)
! || 0 == strcmp(plugins->mMimeTypeArray[cnt],"*"))
return NS_OK;
}
***************
*** 2138,2144 ****
{
nsPluginTag *plugins = nsnull;
PRInt32 variants, cnt;
!
aPlugin = nsnull;
if (PR_FALSE == mPluginsLoaded)
--- 2143,2149 ----
{
nsPluginTag *plugins = nsnull;
PRInt32 variants, cnt;
! nsPluginTag *starPlugin = nsnull;
aPlugin = nsnull;
if (PR_FALSE == mPluginsLoaded)
***************
*** 2160,2166 ****
aPlugin = plugins;
return NS_OK;
}
! }
if (cnt < variants)
break;
--- 2165,2175 ----
aPlugin = plugins;
return NS_OK;
}
! if (0 == strcmp(plugins->mMimeTypeArray[cnt],"*"))
! {
! starPlugin = plugins;
! }
! }
if (cnt < variants)
break;
***************
*** 2168,2174 ****
plugins = plugins->mNext;
}
}
!
return NS_ERROR_FAILURE;
}
--- 2177,2187 ----
plugins = plugins->mNext;
}
}
! if (starPlugin != nsnull)
! {
! aPlugin = starPlugin;
! return NS_OK;
! }
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -0,0 +1,70 @@
#!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@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
LIBRARY_NAME = pluglet
MODULE = pluglet
IS_COMPONENT = 1
CPPSRCS = \
List.cpp \
Pluglet.cpp \
PlugletEngine.cpp \
PlugletFactory.cpp \
PlugletInputStream.cpp \
PlugletLoader.cpp \
PlugletManager.cpp \
PlugletPeer.cpp \
PlugletStreamInfo.cpp \
PlugletStreamListener.cpp \
PlugletsDir.cpp \
Registry.cpp \
PlugletViewMotif.cpp \
PlugletViewFactory.cpp \
$(NULL)
CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS) -D_REENTRANT -DOJI_DISABLE
DSO_LDOPTS += \
-L$(JDKHOME)/jre/lib/$(HOSTTYPE)/ \
-L$(JDKHOME)/jre/lib/$(HOSTTYPE)/classic \
-ljava -ljvm -lawt \
-lgdk
ifneq ($(OS_ARCH), Linux)
DSO_LDOPTS += \
-lthread -lXm -lX11 -lXt -lm
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -23,6 +23,8 @@
#include "PlugletStreamListener.h"
#include "PlugletPeer.h"
#include "Registry.h"
#include "PlugletViewFactory.h"
jmethodID Pluglet::initializeMID = NULL;
jmethodID Pluglet::startMID = NULL;
@ -41,7 +43,7 @@ Pluglet::Pluglet(jobject object) {
jthis = PlugletEngine::GetJNIEnv()->NewGlobalRef(object);
//nb check for null
peer = NULL;
view = new PlugletView();
view = PlugletViewFactory::GetPlugletView();
Registry::SetPeer(jthis,(jlong)this);
}
@ -111,12 +113,14 @@ NS_METHOD Pluglet::Initialize(nsIPluginInstancePeer* _peer) {
}
NS_METHOD Pluglet::GetPeer(nsIPluginInstancePeer* *result) {
printf("--Pluglet::GetPeer\n");
peer->AddRef();
*result = peer;
return NS_OK;
}
NS_METHOD Pluglet::Start(void) {
printf("--Pluglet::Start\n");
JNIEnv * env = PlugletEngine::GetJNIEnv();
env->CallVoidMethod(jthis,startMID);
if (env->ExceptionOccurred()) {
@ -126,6 +130,7 @@ NS_METHOD Pluglet::Start(void) {
return NS_OK;
}
NS_METHOD Pluglet::Stop(void) {
printf("--Pluglet::Stop\n");
JNIEnv * env = PlugletEngine::GetJNIEnv();
env->CallVoidMethod(jthis,stopMID);
if (env->ExceptionOccurred()) {
@ -145,6 +150,7 @@ NS_METHOD Pluglet::Destroy(void) {
}
NS_METHOD Pluglet::NewStream(nsIPluginStreamListener** listener) {
printf("--Pluglet::NewStream \n");
if(!listener) {
return NS_ERROR_FAILURE;
}
@ -162,13 +168,19 @@ NS_METHOD Pluglet::NewStream(nsIPluginStreamListener** listener) {
}
NS_METHOD Pluglet::GetValue(nsPluginInstanceVariable variable, void *value) {
printf("--Pluglet::GetValue\n");
return NS_ERROR_FAILURE;
}
NS_METHOD Pluglet::SetWindow(nsPluginWindow* window) {
JNIEnv *env = PlugletEngine::GetJNIEnv();
if (view->SetWindow(window)) {
env->CallVoidMethod(jthis,setWindowMID,view->GetJObject());
printf("--Pluglet::SetWindow \n");
if (view->SetWindow(window) == PR_TRUE) {
JNIEnv *env = PlugletEngine::GetJNIEnv();
env->CallVoidMethod(jthis,setWindowMID,view->GetJObject());
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
return NS_ERROR_FAILURE;
}
}
return NS_OK;
}

Просмотреть файл

@ -175,11 +175,17 @@ void PlugletEngine::StartJVM(void) {
sprintf(classpath, "%s%c%s",
vm_args.classpath, PATH_SEPARATOR, PR_GetEnv("CLASSPATH"));
printf("-- classpath %s\n",classpath);
char **props = new char*[2];
props[0]="java.compiler=NONE";
props[1]=0;
vm_args.properties = props;
vm_args.classpath = classpath;
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, &env, &vm_args);
if(res < 0 ) {
printf("--JNI_CreateJavaVM failed \n");
} else {
printf("--PlugletEngine::StartJVM() jvm was started \n");
}
}
#endif /* OJI_DISABLE */
@ -208,6 +214,7 @@ JNIEnv * PlugletEngine::GetJNIEnv(void) {
StartJVM();
}
jvm->AttachCurrentThread(&res,NULL);
printf("--PluglgetEngine::GetJNIEnv after jvm->Attach \n");
#endif /* OJI_DISABLE */
return res;
}
@ -230,7 +237,7 @@ jobject PlugletEngine::GetPlugletManager(void) {
}
PlugletEngine * PlugletEngine::GetEngine(void) {
return engine;
return engine;
}
void PlugletEngine::IncObjectCount(void) {
objectCount++;

Просмотреть файл

@ -24,7 +24,7 @@
#include "jni.h"
#include "nsIPluginManager.h"
#include "PlugletsDir.h"
#include "nsComPtr.h"
#include "nsCOMPtr.h"
#ifndef OJI_DISABLE
#include "nsJVMManager.h"

Просмотреть файл

@ -58,7 +58,7 @@ jobject PlugletStreamInfo::GetJObject(const nsIPluginStreamInfo *streamInfo) {
return NULL;
}
}
res = env->NewObject(clazz,initMID,*(jlong*)(void*)&streamInfo);
res = env->NewObject(clazz,initMID,(jlong)streamInfo);
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
res = NULL;

Просмотреть файл

@ -20,24 +20,15 @@
*/
#ifndef __PlugletView_h__
#define __PlugletView_h__
#include <windows.h>
#include "nsplugindefs.h"
#include "jni.h"
class PlugletView {
public:
PlugletView(void);
jobject GetJObject(void);
BOOLEAN SetWindow(nsPluginWindow* window);
private:
static void Initialize(void);
static jclass clazz;
static jmethodID initMID;
HWND hWND;
BOOL isCreated;
jobject frame;
virtual jobject GetJObject(void) = 0;
virtual PRBool SetWindow(nsPluginWindow* window) = 0;
};
#endif /* __PlugletInstanceView_h__ */
#endif /* __PlugletView_h__ */

Просмотреть файл

@ -0,0 +1,33 @@
/*
* 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 "PlugletViewFactory.h"
#ifdef XP_PC
#include "PlugletViewWindows.h"
#define VIEW PlugletViewWindows
#else /* XP_PC */
#include "PlugletViewMotif.h"
#define VIEW PlugletViewMotif
#endif /* XP_PC */
PlugletView * PlugletViewFactory::GetPlugletView(void) {
return new VIEW();
}

Просмотреть файл

@ -0,0 +1,30 @@
/*
* 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):
*/
#ifndef __PlugletViewFactory_h__
#define __PlugletViewFactory_h__
#include "PlugletView.h"
class PlugletViewFactory {
public:
static PlugletView * GetPlugletView(void);
};
#endif /* __PlugletViewFactory_h__ */

Просмотреть файл

@ -0,0 +1,166 @@
/* -*- 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):
*/
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/VendorS.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>
#include <Xm/DrawingA.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "PlugletViewMotif.h"
#include "PlugletEngine.h"
jclass PlugletViewMotif::clazz = NULL;
jmethodID PlugletViewMotif::initMID = NULL;
PlugletViewMotif::PlugletViewMotif() {
frame = NULL;
WindowID = 0;
}
void PlugletViewMotif::Initialize() {
JNIEnv *env = PlugletEngine::GetJNIEnv();
clazz = env->FindClass("sun/awt/motif/MEmbeddedFrame");
if (!clazz) {
env->ExceptionDescribe();
return;
}
initMID = env->GetMethodID(clazz, "<init>", "(J)V");
if (!initMID) {
env->ExceptionDescribe();
clazz = NULL;
return;
}
}
#define AWT_LOCK() (env)->MonitorEnter(awt_lock)
#define AWT_UNLOCK() (env)->MonitorExit(awt_lock)
extern jobject awt_lock;
extern Display *awt_display;
PRBool PlugletViewMotif::SetWindow(nsPluginWindow* win) {
printf("--PlugletViewMotif::SetWindow \n");
JNIEnv *env = PlugletEngine::GetJNIEnv();
if(!clazz) {
Initialize();
if(!clazz) {
return PR_FALSE;
}
}
if (!win
|| !win->window) {
if (win && !win->window) {
printf("--PlugletViewMotif win->window = NULL. We have a bug in plugin module \n");
}
if (frame) {
env->DeleteGlobalRef(frame);
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
}
frame = NULL;
return PR_TRUE;
}
return PR_FALSE;
}
GtkWidget * containerWidget = (GtkWidget *) win->window;
Window parentWindowID;
Window rootWindowID;
Window * childrenWindowIDs;
unsigned int numberOfChildren;
int containerWindowID = GDK_WINDOW_XWINDOW(containerWidget->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;
AWT_LOCK();
XSync(awt_display, FALSE);
Arg args[40];
int argc = 0;
XtSetArg(args[argc], XmNsaveUnder, False); argc++;
XtSetArg(args[argc], XmNallowShellResize, False); argc++;
XtSetArg(args[argc], XmNwidth, win->width); argc++;
XtSetArg(args[argc], XmNheight, win->height); argc++;
XtSetArg(args[argc], XmNx, 0); argc++;
XtSetArg(args[argc], XmNy, 0); argc++;
XtSetArg(args[argc],XmNmappedWhenManaged,False); argc++;
Widget w = XtAppCreateShell("AWTapp", "XApplication",
vendorShellWidgetClass,
awt_display,
args, argc);
XtRealizeWidget(w);
XFlush(awt_display);
XSync(awt_display, True);
Window child, parent;
parent = (Window) containerWindowID;
child = XtWindow(w);
XReparentWindow(awt_display, child, parent, 0, 0);
XFlush(awt_display);
XSync(awt_display, True);
if (frame) {
env->DeleteGlobalRef(frame);
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
return PR_FALSE;
}
}
printf("--before new frame\n");
frame = env->NewObject(clazz,initMID,(jlong)w);
printf("--after new frame\n");
if(frame) {
frame = env->NewGlobalRef(frame);
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
return PR_FALSE;
}
}
AWT_UNLOCK();
return PR_TRUE;
}
jobject PlugletViewMotif::GetJObject() {
return frame;
}

Просмотреть файл

@ -0,0 +1,49 @@
/*
* 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):
*/
#ifndef __PlugletViewMotif_h__
#define __PlugletViewMotif_h__
#include "nsplugindefs.h"
#include "jni.h"
#include "PlugletView.h"
class PlugletViewMotif : public PlugletView {
public:
PlugletViewMotif(void);
virtual jobject GetJObject(void);
virtual PRBool SetWindow(nsPluginWindow* window);
private:
static void Initialize(void);
static jclass clazz;
static jmethodID initMID;
int WindowID;
jobject frame;
};
#endif /* __PlugletViewMotif_h__ */

Просмотреть файл

@ -19,19 +19,19 @@
* Contributor(s):
*/
#include <windows.h>
#include "PlugletView.h"
#include "PlugletViewWindows.h"
#include "PlugletEngine.h"
jclass PlugletView::clazz = NULL;
jmethodID PlugletView::initMID = NULL;
jclass PlugletViewWindows::clazz = NULL;
jmethodID PlugletViewWindows::initMID = NULL;
PlugletView::PlugletView() {
PlugletViewWindows::PlugletViewWindows() {
hWND = NULL;
frame = NULL;
isCreated = FALSE;
}
void PlugletView::Initialize() {
void PlugletViewWindows::Initialize() {
JNIEnv *env = PlugletEngine::GetJNIEnv();
clazz = env->FindClass("sun/awt/windows/WEmbeddedFrame");
if (!clazz) {
@ -46,7 +46,7 @@ void PlugletView::Initialize() {
}
}
BOOLEAN PlugletView::SetWindow(nsPluginWindow* window) {
PRBool PlugletViewWindows::SetWindow(nsPluginWindow* window) {
if (!window || !window->window) {
if (isCreated) {
isCreated = FALSE;
@ -56,7 +56,7 @@ BOOLEAN PlugletView::SetWindow(nsPluginWindow* window) {
}
}
if (hWND == reinterpret_cast<HWND>(window->window) && isCreated) {
return FALSE;
return PR_FALSE;
}
DWORD dwStyle = ::GetWindowLong(reinterpret_cast<HWND>(window->window), GWL_STYLE);
@ -65,7 +65,7 @@ BOOLEAN PlugletView::SetWindow(nsPluginWindow* window) {
if(!clazz) {
Initialize();
if (!clazz) {
return FALSE;
return PR_FALSE;
}
}
JNIEnv *env = PlugletEngine::GetJNIEnv();
@ -75,10 +75,10 @@ BOOLEAN PlugletView::SetWindow(nsPluginWindow* window) {
}
hWND = (HWND) window->window;
isCreated = TRUE;
return TRUE;
return PR_TRUE;
}
jobject PlugletView::GetJObject() {
jobject PlugletViewWindows::GetJObject() {
return frame;
}

Просмотреть файл

@ -0,0 +1,51 @@
/*
* 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):
*/
#ifndef __PlugletViewWindows_h__
#define __PlugletViewWindows_h__
#include <windows.h>
#include "nsplugindefs.h"
#include "jni.h"
#include "PlugletView.h"
class PlugletViewWindows : public PlugletView {
public:
PlugletViewWindows(void);
virtual jobject GetJObject(void);
virtual PRBool SetWindow(nsPluginWindow* window);
private:
static void Initialize(void);
static jclass clazz;
static jmethodID initMID;
HWND hWND;
BOOL isCreated;
jobject frame;
};
#endif /* __PlugletViewWindows_h__ */

Просмотреть файл

@ -50,7 +50,8 @@ OBJS = \
.\$(OBJDIR)\PlugletPeer.obj \
.\$(OBJDIR)\PlugletManager.obj \
.\$(OBJDIR)\PlugletInputStream.obj \
.\$(OBJDIR)\PlugletView.obj \
.\$(OBJDIR)\PlugletViewFactory.obj \
.\$(OBJDIR)\PlugletViewWindows.obj \
!ifndef OJI_DISABLE
.\$(OBJDIR)\PlugletSecurityContext.obj \
!endif

Просмотреть файл

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