Added port to Linux.
This commit is contained in:
Родитель
be5e32d6a6
Коммит
3450a1e53a
|
@ -5,6 +5,11 @@ Authors: Kirk Baker <kbaker@eb.com>
|
|||
|
||||
Build hacking and packaging: Ed Burns <edburns@acm.org>
|
||||
|
||||
Unix port: Mark Lin <mark.lin@eng.sun.com>
|
||||
|
||||
========================================================================
|
||||
Win32 Build Directions:
|
||||
========================================================================
|
||||
Requirements:
|
||||
|
||||
* built M8 mozilla tree for WinNT4.0
|
||||
|
@ -47,13 +52,53 @@ Problems:
|
|||
|
||||
* post to netscape.public.mozilla.java newsgroup
|
||||
|
||||
General notes:
|
||||
========================================================================
|
||||
Unix Build Directions (currently only Linux,
|
||||
Solaris support is coming soon):
|
||||
========================================================================
|
||||
Requirements:
|
||||
|
||||
* Please update the ChangeLog (changelo) when you make changes.
|
||||
* built M8 mozilla tree for some variant of Linux
|
||||
|
||||
* JDK1.2 with native threads support from http://www.blackdown.org
|
||||
(JDK1.1 doesn't seem to work)
|
||||
|
||||
* built org.mozilla.util java classes (see NOTE_UTIL)
|
||||
|
||||
How To Build:
|
||||
|
||||
* Follow the directions in ../util/README
|
||||
|
||||
* set JDKHOME to where your JDK install directory resides
|
||||
-> setenv JDKHOME /usr/local/jdk1.2
|
||||
|
||||
* cd to 'classes' and type "make -f makefile.unix" and hope for the best
|
||||
-> cd classes; make -f Makefile.unix
|
||||
|
||||
* then cd to 'src' and type "make -f makefile.unix" and hope for the best
|
||||
-> cd src; make -f Makefile.unix
|
||||
|
||||
How to Run:
|
||||
|
||||
* once the build has successfully completed, run 'runem.unix' in your
|
||||
'src' directory:
|
||||
-> cd src; ./runem.unix <YOUR_URL>
|
||||
|
||||
Note that YOUR_URL is probably necessary since firewall support wasn't
|
||||
working in M8.
|
||||
|
||||
Problems? Email mark.lin@eng.sun.com or post to netscape.public.mozilla.java.
|
||||
|
||||
========================================================================
|
||||
NOTE_UTIL:
|
||||
|
||||
========================================================================
|
||||
* this package depends on the org.mozilla.util classes, which can be
|
||||
found in the mozilla tree under mozilla\java\util. They are a
|
||||
separate checkout and build. Once you check out the org.mozilla.util
|
||||
classes, see the README in the mozilla\java\util\README.
|
||||
|
||||
General notes:
|
||||
|
||||
* Please update the ChangeLog (changelo) when you make changes.
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
Mon Aug 9 20:25:49 1999 Mark Lin <mark.lin@eng.sun.com>
|
||||
* Ported webclient to Linux
|
||||
* Added a motif and win32 directory under classes/org/mozilla/webclient
|
||||
* Added a motif directory under src/motif
|
||||
|
||||
Fri Jul 30 14:40:32 1999 Ed Burns <Ed Burns <ed.burns@sun.com>>
|
||||
|
||||
* Modified makefile to reference new location for localdefs.mak:
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# 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}/BrowserControlMozillaShim.h org.mozilla.webclient.BrowserControlMozillaShim
|
|
@ -40,7 +40,7 @@ include <$(DEPTH)\config\config.mak>
|
|||
include <$(DEPTH)\java\config\localdefs.mak>
|
||||
|
||||
JAR_WEBCLIENT_CLASSES = org\mozilla\webclient \
|
||||
org\mozilla\webclient\test
|
||||
org\mozilla\webclient\test org\mozilla\webclient\win32
|
||||
|
||||
!ifdef JAVA_OR_NSJVM
|
||||
JDIRS = $(JAR_WEBCLIENT_CLASSES)
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
* 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 Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are Copyright (C) 1997, 1998, 1999 Sun
|
||||
* Microsystems, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package org.mozilla.webclient;
|
||||
|
@ -33,7 +28,7 @@ import org.mozilla.util.ParameterCheck;
|
|||
* This is a static class, it is neven instantiated.
|
||||
|
||||
*
|
||||
* @version $Id: BrowserControlCanvasFactory.java,v 1.1 1999-07-30 01:03:04 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlCanvasFactory.java,v 1.2 1999-08-10 03:59:03 mark.lin%eng.sun.com Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.test.EmbeddedMozilla
|
||||
|
||||
|
@ -63,7 +58,7 @@ public class BrowserControlCanvasFactory extends Object
|
|||
|
||||
public BrowserControlCanvasFactory()
|
||||
{
|
||||
Assert.assert(false, "This class shouldn't be constructed.");
|
||||
Assert.assert(false, "This class shouldn't be constructed.");
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -72,24 +67,56 @@ public BrowserControlCanvasFactory()
|
|||
|
||||
public static BrowserControlCanvas newBrowserControlCanvas()
|
||||
{
|
||||
BrowserControlCanvas result = null;
|
||||
Class browserControlCanvasClass = null;
|
||||
String className = null;
|
||||
|
||||
BrowserControlCanvas result = null;
|
||||
// PENDING(edburns): do some magic to determine the right kind of
|
||||
// MozWebShellCanvas to instantiate
|
||||
|
||||
// PENDING(edburns): do some magic to determine the right kind of
|
||||
// BrowserControlCanvas to instantiate
|
||||
|
||||
Class browserControlCanvasClass = null;
|
||||
String className = "org.mozilla.webclient.Win32BrowserControlCanvas";
|
||||
// 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
|
||||
|
||||
try {
|
||||
if (null != (browserControlCanvasClass = Class.forName(className))) {
|
||||
result = (BrowserControlCanvas) browserControlCanvasClass.newInstance();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
Class win32DrawingSurfaceInfoClass =
|
||||
Class.forName("sun.awt.windows.WDrawingSurfaceInfo");
|
||||
|
||||
if (win32DrawingSurfaceInfoClass != null) {
|
||||
className = "org.mozilla.webclient.win32.Win32MozWebShellCanvas";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
className = null;
|
||||
}
|
||||
|
||||
try {
|
||||
Class motifDrawingSurfaceInfoClass =
|
||||
Class.forName("sun.awt.motif.MDrawingSurfaceInfo");
|
||||
|
||||
if (motifDrawingSurfaceInfoClass != null) {
|
||||
className = "org.mozilla.webclient.motif.MotifBrowserControlCanvas";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
className = null;
|
||||
}
|
||||
|
||||
if (className != null) {
|
||||
try {
|
||||
if (null != (browserControlCanvasClass = Class.forName(className))) {
|
||||
result = (BrowserControlCanvas) browserControlCanvasClass.newInstance();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Got Exception: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("Could not determine WebShellCanvas class to load\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -104,10 +131,11 @@ public static BrowserControlCanvas newBrowserControlCanvas()
|
|||
|
||||
public static void main(String [] args)
|
||||
{
|
||||
System.out.println("doing asserts");
|
||||
Assert.setEnabled(true);
|
||||
Log.setApplicationName("BrowserControlCanvasFactory");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlCanvasFactory.java,v 1.1 1999-07-30 01:03:04 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlCanvasFactory.java,v 1.2 1999-08-10 03:59:03 mark.lin%eng.sun.com Exp $");
|
||||
|
||||
BrowserControlCanvas canvas = BrowserControlCanvasFactory.newBrowserControlCanvas();
|
||||
|
||||
|
@ -116,4 +144,4 @@ public static void main(String [] args)
|
|||
|
||||
// ----UNIT_TEST_END
|
||||
|
||||
} // end of class BrowserControlCanvasFactory
|
||||
} // end of class BrowserControl!CanvasFactory
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.awt.*;
|
|||
* There is one instance of this class and all of the exposed methods
|
||||
* are static.
|
||||
|
||||
* @version $Id: BrowserControlMozillaShim.java,v 1.1 1999-07-30 01:03:05 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlMozillaShim.java,v 1.2 1999-08-10 03:59:04 mark.lin%eng.sun.com Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlImpl
|
||||
|
||||
|
@ -89,14 +89,20 @@ public static void initialize () throws Exception
|
|||
{
|
||||
if (!initialized) {
|
||||
instance = new BrowserControlMozillaShim();
|
||||
|
||||
|
||||
// PENDING(mark): Try loading the native library in your own implemntation specfic canvas
|
||||
// class (ie. Win32BrowserControlCanvas or MotifBrowserControlCanvas.
|
||||
// The Unix port needs this. If this is a problem, let me know ASAP.
|
||||
// - Mark
|
||||
/*
|
||||
try {
|
||||
System.loadLibrary("webclient");
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e) {
|
||||
throw new Exception("Unable to open native webclient library");
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
instance.nativeInitialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
@ -563,7 +569,7 @@ public static void main(String [] args)
|
|||
BrowserControlMozillaShim me = new BrowserControlMozillaShim();
|
||||
Log.setApplicationName("BrowserControlMozillaShim");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.1 1999-07-30 01:03:05 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.2 1999-08-10 03:59:04 mark.lin%eng.sun.com Exp $");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,60 +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.0 (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 <kbaker@eb.com> and * Ian Wilkinson <iw@ennoble.com
|
||||
*/
|
||||
|
||||
package org.mozilla.webclient;
|
||||
|
||||
// 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.1 1999-07-30 01:03:06 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlCanvasFactory
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
import sun.awt.*;
|
||||
import sun.awt.windows.*;
|
||||
|
||||
/**
|
||||
* Win32BrowserControlCanvas provides a concrete realization
|
||||
* of the RaptorCanvas.
|
||||
*/
|
||||
class Win32BrowserControlCanvas extends BrowserControlCanvas {
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
|
@ -48,6 +48,10 @@ nsMacMessageSink gMessageSink;
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
#include "nsActions.h"
|
||||
|
||||
#include "nsIRegistry.h"
|
||||
|
@ -67,7 +71,12 @@ extern "C" void NS_SetupRegistry();
|
|||
|
||||
|
||||
struct WebShellInitContext {
|
||||
HWND parentHWnd;
|
||||
#ifdef XP_UNIX
|
||||
GtkWidget * parentHWnd;
|
||||
#else
|
||||
// PENDING(mark): Don't we need something for Mac?
|
||||
HWND parentHWnd;
|
||||
#endif
|
||||
nsIWebShell * webShell;
|
||||
PLEventQueue * actionQueue;
|
||||
PRThread * embeddedThread;
|
||||
|
@ -81,43 +90,36 @@ struct WebShellInitContext {
|
|||
int h;
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
ThrowExceptionToJava (JNIEnv * env, const char * message)
|
||||
{
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
jclass excCls = env->FindClass("java/lang/Exception");
|
||||
|
||||
if (excCls == 0) { // Unable to find the exception class, give up.
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
return;
|
||||
}
|
||||
|
||||
// Throw the exception with the error code and description
|
||||
jmethodID jID = env->GetMethodID(excCls, "<init>", "(Ljava/lang/String;)V"); // void Exception(String)
|
||||
|
||||
if (jID != NULL) {
|
||||
jstring exceptionString = env->NewStringUTF(message);
|
||||
jthrowable newException = (jthrowable) env->NewObject(excCls, jID, exceptionString);
|
||||
|
||||
if (newException != NULL) {
|
||||
env->Throw(newException);
|
||||
}
|
||||
else {
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
|
||||
jclass excCls = env->FindClass("java/lang/Exception");
|
||||
|
||||
if (excCls == 0) { // Unable to find the exception class, give up.
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
return;
|
||||
}
|
||||
|
||||
// Throw the exception with the error code and description
|
||||
jmethodID jID = env->GetMethodID(excCls, "<init>", "(Ljava/lang/String;)V"); // void Exception(String)
|
||||
|
||||
if (jID != NULL)
|
||||
{
|
||||
jstring exceptionString = env->NewStringUTF(message);
|
||||
jthrowable newException = (jthrowable) env->NewObject(excCls, jID, exceptionString);
|
||||
|
||||
if (newException != NULL)
|
||||
{
|
||||
env->Throw(newException);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
} else {
|
||||
if (env->ExceptionOccurred())
|
||||
env->ExceptionClear();
|
||||
}
|
||||
} // ThrowExceptionToJava()
|
||||
|
||||
|
@ -139,37 +141,94 @@ char * errorMessages[] = {
|
|||
};
|
||||
|
||||
|
||||
void
|
||||
EmbeddedEventHandler (void * arg)
|
||||
{
|
||||
WebShellInitContext * initContext = (WebShellInitContext *) arg;
|
||||
nsIEventQueueService* aEventQService = nsnull;
|
||||
nsresult rv;
|
||||
PRBool allowPlugins = PR_FALSE;
|
||||
|
||||
//TODO Add tracing from nspr.
|
||||
int processEventLoop(WebShellInitContext * initContext) {
|
||||
#ifdef XP_UNIX
|
||||
while(gtk_events_pending()) {
|
||||
gtk_main_iteration();
|
||||
}
|
||||
#else
|
||||
// PENDING(mark): Does this work on the Mac?
|
||||
MSG msg;
|
||||
|
||||
if (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
|
||||
if (::GetMessage(&msg, NULL, 0, 0)) {
|
||||
::TranslateMessage(&msg);
|
||||
::DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
::PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
|
||||
if ((initContext->initComplete) && (initContext->actionQueue)) {
|
||||
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
if (::PL_EventAvailable(initContext->actionQueue)) {
|
||||
|
||||
PLEvent * event = ::PL_GetEvent(initContext->actionQueue);
|
||||
|
||||
if (event != NULL) {
|
||||
::PL_HandleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
}
|
||||
if (initContext->stopThread) {
|
||||
initContext->stopThread++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef XP_UNIX
|
||||
static void event_processor_callback(gpointer data,
|
||||
gint source,
|
||||
GdkInputCondition condition) {
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Create the Event Queue for the UI thread...\n", initContext);
|
||||
printf("event_processor_callback()\n");
|
||||
#endif
|
||||
nsIEventQueue *eventQueue = (nsIEventQueue*)data;
|
||||
eventQueue->ProcessPendingEvents();
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("Done processing pending events...\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create the Event Queue for the UI thread...
|
||||
rv = nsServiceManager::GetService(kEventQueueServiceCID,
|
||||
kIEventQueueServiceIID,
|
||||
(nsISupports **)&aEventQService);
|
||||
void
|
||||
EmbeddedEventHandler (void * arg) {
|
||||
WebShellInitContext * initContext = (WebShellInitContext *) arg;
|
||||
nsIEventQueueService * aEventQService = nsnull;
|
||||
nsresult rv;
|
||||
PRBool allowPlugins = PR_FALSE;
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kEventQueueError;
|
||||
return;
|
||||
//TODO Add tracing from nspr.
|
||||
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Create the Event Queue for the UI thread...\n", initContext);
|
||||
#endif
|
||||
|
||||
// Create the Event Queue for the UI thread...
|
||||
rv = nsServiceManager::GetService(kEventQueueServiceCID,
|
||||
kIEventQueueServiceIID,
|
||||
(nsISupports **) &aEventQService);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kEventQueueError;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the event queue.
|
||||
rv = aEventQService->CreateThreadEventQueue();
|
||||
|
||||
NS_InitINetService();
|
||||
|
||||
// Create the action queue
|
||||
if (initContext->embeddedThread) {
|
||||
|
||||
// Create the event queue.
|
||||
rv = aEventQService->CreateThreadEventQueue();
|
||||
|
||||
NS_InitINetService();
|
||||
|
||||
// Create the action queue
|
||||
if (initContext->embeddedThread) {
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): embeddedThread != NULL\n", initContext);
|
||||
#endif
|
||||
|
@ -184,74 +243,61 @@ EmbeddedEventHandler (void * arg)
|
|||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Create the WebShell...\n", initContext);
|
||||
#endif
|
||||
|
||||
// Create the WebShell.
|
||||
rv = nsRepository::CreateInstance(kWebShellCID, nsnull, kIWebShellIID, (void**)&initContext->webShell);
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kCreateWebShellError;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the WebShell.
|
||||
rv = nsRepository::CreateInstance(kWebShellCID, nsnull, kIWebShellIID, (void**)&initContext->webShell);
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kCreateWebShellError;
|
||||
return;
|
||||
}
|
||||
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Init the WebShell...\n", initContext);
|
||||
#endif
|
||||
|
||||
rv = initContext->webShell->Init((nsNativeWidget *)initContext->parentHWnd,
|
||||
initContext->x, initContext->y, initContext->w, initContext->h
|
||||
);
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kInitWebShellError;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
rv = initContext->webShell->Init((nsNativeWidget *)initContext->parentHWnd,
|
||||
initContext->x, initContext->y, initContext->w, initContext->h);
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kInitWebShellError;
|
||||
return;
|
||||
}
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): Show the WebShell...\n", initContext);
|
||||
#endif
|
||||
|
||||
rv = initContext->webShell->Show();
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kShowWebShellError;
|
||||
return;
|
||||
}
|
||||
|
||||
initContext->initComplete = TRUE;
|
||||
|
||||
|
||||
rv = initContext->webShell->Show();
|
||||
if (NS_FAILED(rv)) {
|
||||
initContext->initFailCode = kShowWebShellError;
|
||||
return;
|
||||
}
|
||||
|
||||
initContext->initComplete = TRUE;
|
||||
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("EmbeddedEventHandler(%lx): enter event loop\n", initContext);
|
||||
printf("EmbeddedEventHandler(%lx): enter event loop\n", initContext);
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
// PENDING(mark): I'm not sure why the following code is needed....
|
||||
// All I know is that when I add the code here, the document
|
||||
// loader will try to load any clicked urls before crashing.
|
||||
// Whereas, if I left it out, nothing happens when the user clicks on
|
||||
// a URL
|
||||
nsIEventQueue * EQueue = nsnull;
|
||||
|
||||
rv = aEventQService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
|
||||
|
||||
gdk_input_add(EQueue->GetEventQueueSelectFD(),
|
||||
GDK_INPUT_READ,
|
||||
event_processor_callback,
|
||||
EQueue);
|
||||
#endif
|
||||
|
||||
do {
|
||||
MSG msg;
|
||||
|
||||
if (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
|
||||
if (::GetMessage(&msg, NULL, 0, 0)) {
|
||||
::TranslateMessage(&msg);
|
||||
::DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
::PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
|
||||
if ((initContext->initComplete) && (initContext->actionQueue)) {
|
||||
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
if (::PL_EventAvailable(initContext->actionQueue)) {
|
||||
|
||||
PLEvent * event = ::PL_GetEvent(initContext->actionQueue);
|
||||
|
||||
if (event != NULL) {
|
||||
::PL_HandleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
}
|
||||
if (initContext->stopThread) {
|
||||
initContext->stopThread++;
|
||||
break;
|
||||
}
|
||||
if (!processEventLoop(initContext)) {
|
||||
#ifndef XP_UNIX
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
} while (PR_TRUE);
|
||||
}
|
||||
|
||||
|
@ -274,27 +320,24 @@ void
|
|||
InitEmbeddedEventHandler (WebShellInitContext* initContext)
|
||||
{
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("InitEmbeddedEventHandler(%lx): Creating embedded thread...\n", initContext);
|
||||
printf("InitEmbeddedEventHandler(%lx): Creating embedded thread...\n", initContext);
|
||||
#endif
|
||||
|
||||
initContext->embeddedThread = ::PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
EmbeddedEventHandler,
|
||||
(void*)initContext,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
EmbeddedEventHandler,
|
||||
(void*)initContext,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
#if DEBUG_RAPTOR_CANVAS
|
||||
printf("InitEmbeddedEventHandler(%lx): Embedded Thread created...\n", initContext);
|
||||
#endif
|
||||
|
||||
while (initContext->initComplete == FALSE) {
|
||||
if (initContext->initFailCode != 0) {
|
||||
::ThrowExceptionToJava(initContext->env, errorMessages[initContext->initFailCode]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (initContext->initComplete == FALSE) {
|
||||
if (initContext->initFailCode != 0) {
|
||||
::ThrowExceptionToJava(initContext->env, errorMessages[initContext->initFailCode]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -302,34 +345,32 @@ InitEmbeddedEventHandler (WebShellInitContext* initContext)
|
|||
static nsEventStatus PR_CALLBACK
|
||||
HandleRaptorEvent (nsGUIEvent *)
|
||||
{
|
||||
nsEventStatus result = nsEventStatus_eIgnore;
|
||||
return result;
|
||||
nsEventStatus result = nsEventStatus_eIgnore;
|
||||
return result;
|
||||
} // HandleRaptorEvent()
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
DispatchEvent (nsGUIEvent* eventPtr, nsIWidget* widgetPtr)
|
||||
{
|
||||
// PENDING(mark): DO I NEED TO DO ANYTHING SPECIAL HERE FOR UNIX?????????
|
||||
#ifdef XP_MAC
|
||||
|
||||
// Enable Raptor background activity
|
||||
// Note: This will be moved to nsMacMessageSink very soon.
|
||||
// The application will not have to do it anymore.
|
||||
|
||||
EventRecord * macEventPtr = (EventRecord *) eventPtr->nativeMsg;
|
||||
|
||||
gMessageSink.DispatchOSEvent(*macEventPtr, FrontWindow());
|
||||
Repeater::DoRepeaters(*macEventPtr);
|
||||
|
||||
if (macEventPtr->what == nullEvent)
|
||||
Repeater::DoIdlers(*macEventPtr);
|
||||
|
||||
// Enable Raptor background activity
|
||||
// Note: This will be moved to nsMacMessageSink very soon.
|
||||
// The application will not have to do it anymore.
|
||||
|
||||
EventRecord * macEventPtr = (EventRecord *) eventPtr->nativeMsg;
|
||||
|
||||
gMessageSink.DispatchOSEvent(*macEventPtr, FrontWindow());
|
||||
Repeater::DoRepeaters(*macEventPtr);
|
||||
|
||||
if (macEventPtr->what == nullEvent)
|
||||
Repeater::DoIdlers(*macEventPtr);
|
||||
|
||||
#else
|
||||
|
||||
nsEventStatus aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
widgetPtr->DispatchEvent(eventPtr, aStatus);
|
||||
|
||||
nsEventStatus aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
widgetPtr->DispatchEvent(eventPtr, aStatus);
|
||||
#endif
|
||||
} // DispatchEvent()
|
||||
|
||||
|
@ -347,36 +388,35 @@ const jint BUTTON3_MASK = META_MASK;
|
|||
static unsigned short
|
||||
ConvertModifiersToMacModifiers (jint modifiers)
|
||||
{
|
||||
unsigned short convertedModifiers = 0;
|
||||
|
||||
if (modifiers & META_MASK)
|
||||
convertedModifiers |= cmdKey;
|
||||
if (modifiers & SHIFT_MASK)
|
||||
convertedModifiers |= shiftKey;
|
||||
if (modifiers & ALT_MASK)
|
||||
convertedModifiers |= optionKey;
|
||||
if (modifiers & CTRL_MASK)
|
||||
convertedModifiers |= controlKey;
|
||||
if (modifiers & BUTTON1_MASK)
|
||||
convertedModifiers |= btnState;
|
||||
|
||||
// KAB alphaLock would be nice too...
|
||||
|
||||
return convertedModifiers;
|
||||
unsigned short convertedModifiers = 0;
|
||||
|
||||
if (modifiers & META_MASK)
|
||||
convertedModifiers |= cmdKey;
|
||||
if (modifiers & SHIFT_MASK)
|
||||
convertedModifiers |= shiftKey;
|
||||
if (modifiers & ALT_MASK)
|
||||
convertedModifiers |= optionKey;
|
||||
if (modifiers & CTRL_MASK)
|
||||
convertedModifiers |= controlKey;
|
||||
if (modifiers & BUTTON1_MASK)
|
||||
convertedModifiers |= btnState;
|
||||
|
||||
// KAB alphaLock would be nice too...
|
||||
return convertedModifiers;
|
||||
} // ConvertModifiersToMacModifiers()
|
||||
|
||||
|
||||
static void
|
||||
ConvertMouseCoordsToMacMouseCoords (jint windowPtr, jint x, jint y, Point& pt)
|
||||
{
|
||||
GrafPtr savePort;
|
||||
|
||||
pt.h = (short) x;
|
||||
pt.v = (short) y;
|
||||
GetPort(&savePort);
|
||||
SetPort((WindowPtr) windowPtr);
|
||||
LocalToGlobal(&pt);
|
||||
SetPort(savePort);
|
||||
GrafPtr savePort;
|
||||
|
||||
pt.h = (short) x;
|
||||
pt.v = (short) y;
|
||||
GetPort(&savePort);
|
||||
SetPort((WindowPtr) windowPtr);
|
||||
LocalToGlobal(&pt);
|
||||
SetPort(savePort);
|
||||
} // ConvertMouseCoordsToMacMouseCoords()
|
||||
|
||||
#endif // ifdef XP_MAC
|
||||
|
@ -385,11 +425,11 @@ ConvertMouseCoordsToMacMouseCoords (jint windowPtr, jint x, jint y, Point& pt)
|
|||
static void
|
||||
ConvertModifiersTo_nsInputEvent (jint modifiers, nsInputEvent& event)
|
||||
{
|
||||
event.isShift = (modifiers & SHIFT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isControl = (modifiers & CTRL_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isAlt = (modifiers & ALT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isShift = (modifiers & SHIFT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isControl = (modifiers & CTRL_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isAlt = (modifiers & ALT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
#ifdef XP_MAC
|
||||
event.isCommand = (modifiers & META_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isCommand = (modifiers & META_MASK) ? PR_TRUE : PR_FALSE;
|
||||
#endif
|
||||
} // ConvertModifiersTo_nsInputEvent()
|
||||
|
||||
|
@ -398,7 +438,7 @@ ConvertModifiersTo_nsInputEvent (jint modifiers, nsInputEvent& event)
|
|||
static unsigned long
|
||||
ConvertKeys (jchar keyChar, jint keyCode)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
} // ConvertKeys()
|
||||
|
||||
|
||||
|
@ -514,8 +554,12 @@ ConvertMouseMessageToMacMouseEvent (jint message)
|
|||
/*
|
||||
* JNI interfaces
|
||||
*/
|
||||
|
||||
|
||||
// I need this extern "C" for reasons I won't go into right now....
|
||||
// - Mark
|
||||
#ifdef XP_UNIX
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class: BrowserControlMozillaShim
|
||||
|
@ -530,7 +574,6 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize (
|
|||
JNIEnv * pEnv = env;
|
||||
jobject jobj = obj;
|
||||
static PRBool gFirstTime = PR_TRUE;
|
||||
|
||||
if (gFirstTime)
|
||||
{
|
||||
NS_SetupRegistry();
|
||||
|
@ -577,7 +620,6 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyDownEvent (
|
|||
JNIEnv * pEnv = env;
|
||||
jobject jobj = obj;
|
||||
nsKeyEvent keyEvent;
|
||||
|
||||
#ifdef XP_MAC
|
||||
EventRecord event;
|
||||
|
||||
|
@ -588,25 +630,21 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyDownEvent (
|
|||
event.where.h = 0;
|
||||
event.where.v = 0;
|
||||
event.modifiers = ConvertModifiersToMacModifiers(modifiers);
|
||||
|
||||
keyEvent.nativeMsg = &event;
|
||||
#else
|
||||
keyEvent.nativeMsg = nsnull;
|
||||
#endif
|
||||
|
||||
// nsEvent
|
||||
keyEvent.eventStructType = NS_KEY_EVENT;
|
||||
keyEvent.message = NS_KEY_DOWN;
|
||||
keyEvent.point.x = 0;
|
||||
keyEvent.point.y = 0;
|
||||
// keyEvent.time = TickCount();
|
||||
|
||||
// nsGUIEvent
|
||||
keyEvent.widget = (nsIWidget *) widgetPtr;
|
||||
|
||||
// nsInputEvent
|
||||
ConvertModifiersTo_nsInputEvent(modifiers, keyEvent);
|
||||
|
||||
// nsKeyEvent
|
||||
keyEvent.keyCode = (PRUint32) keyCode;
|
||||
keyEvent.charCode = (PRUint32) keyChar;
|
||||
|
@ -824,6 +862,8 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetCreate (
|
|||
WindowPtr pWindow = (WindowPtr) windowPtr;
|
||||
#elif defined(XP_PC)
|
||||
HWND pWindow = (HWND) windowPtr;
|
||||
#elif defined(XP_UNIX)
|
||||
GtkWidget * pWindow = (GtkWidget *) windowPtr;
|
||||
#endif
|
||||
nsRect r(x, y, width, height);
|
||||
nsresult rv;
|
||||
|
@ -832,7 +872,6 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetCreate (
|
|||
// IMPORTANT: It must be created before any controls are added to the window
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kWindowCID, nsnull, kIWidgetIID, (void**)&widgetPtr);
|
||||
|
||||
if (rv != NS_OK)
|
||||
{
|
||||
::ThrowExceptionToJava(env, "raptorWidgetCreate Exception: unable to create widget instance");
|
||||
|
@ -840,7 +879,6 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetCreate (
|
|||
}
|
||||
|
||||
rv = widgetPtr->Create((nsNativeWidget)pWindow, r, HandleRaptorEvent, nsnull);
|
||||
|
||||
if (rv != NS_OK)
|
||||
{
|
||||
::ThrowExceptionToJava(env, "raptorWidgetCreate Exception: unable to create widget");
|
||||
|
@ -864,14 +902,11 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetDelete (
|
|||
{
|
||||
JNIEnv * pEnv = env;
|
||||
jobject jobj = obj;
|
||||
|
||||
if (widgetPtr)
|
||||
{
|
||||
delete ((nsIWidget *) widgetPtr);
|
||||
}
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetDelete()
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: BrowserControlMozillaShim
|
||||
|
@ -896,7 +931,6 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetResize (
|
|||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetResize()
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Class: BrowserControlMozillaShim
|
||||
* Method: raptorWidgetEnable
|
||||
|
@ -1009,18 +1043,19 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCreate (
|
|||
#ifdef XP_MAC
|
||||
WindowPtr pWindow = (WindowPtr) windowPtr;
|
||||
Rect webRect = pWindow->portRect;
|
||||
// nsIWidget * pWidget = (nsIWidget *) widgetPtr;
|
||||
#else
|
||||
// elif defined(XP_WIN)
|
||||
HWND parentHWnd = (HWND)windowPtr;
|
||||
// nsIWidget * pWidget = (nsIWidget *) widgetPtr;
|
||||
#elif defined(XP_PC)
|
||||
// elif defined(XP_WIN)
|
||||
HWND parentHWnd = (HWND)windowPtr;
|
||||
#elif defined(XP_UNIX)
|
||||
GtkWidget * parentHWnd = (GtkWidget *) windowPtr;
|
||||
#endif
|
||||
|
||||
if (parentHWnd == nsnull) {
|
||||
::ThrowExceptionToJava(env, "Exception: null window handle passed to raptorWebShellCreate");
|
||||
return (jint) 0;
|
||||
}
|
||||
|
||||
WebShellInitContext* initContext = new WebShellInitContext;
|
||||
WebShellInitContext* initContext = new WebShellInitContext;
|
||||
|
||||
initContext->initComplete = FALSE;
|
||||
initContext->initFailCode = 0;
|
||||
|
@ -1058,7 +1093,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellDelete (
|
|||
if (webShellPtr)
|
||||
{
|
||||
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
||||
|
||||
|
||||
// stop the event thread
|
||||
initContext->stopThread = 1;
|
||||
while (initContext->stopThread <= 1) {
|
||||
|
@ -1104,7 +1139,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellLoadURL (
|
|||
return;
|
||||
}
|
||||
|
||||
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
||||
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
||||
|
||||
if (initContext == nsnull) {
|
||||
::ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellLoadURL");
|
||||
|
@ -1153,13 +1188,12 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop (
|
|||
wsStopEvent * actionEvent = new wsStopEvent(initContext->webShell);
|
||||
PLEvent * event = (PLEvent*) *actionEvent;
|
||||
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
::PL_PostEvent(initContext->actionQueue, event);
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
::PL_PostEvent(initContext->actionQueue, event);
|
||||
|
||||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
}
|
||||
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop()
|
||||
|
||||
|
||||
|
@ -1177,7 +1211,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow (
|
|||
JNIEnv * pEnv = env;
|
||||
jobject jobj = obj;
|
||||
|
||||
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
||||
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
|
||||
|
||||
if (initContext == nsnull) {
|
||||
::ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellShow");
|
||||
|
@ -1188,13 +1222,12 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow (
|
|||
wsShowEvent * actionEvent = new wsShowEvent(initContext->webShell);
|
||||
PLEvent * event = (PLEvent*) *actionEvent;
|
||||
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
::PL_PostEvent(initContext->actionQueue, event);
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
::PL_PostEvent(initContext->actionQueue, event);
|
||||
|
||||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
}
|
||||
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow()
|
||||
|
||||
|
||||
|
@ -1223,7 +1256,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellHide (
|
|||
wsHideEvent * actionEvent = new wsHideEvent(initContext->webShell);
|
||||
PLEvent * event = (PLEvent*) *actionEvent;
|
||||
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
::PL_PostEvent(initContext->actionQueue, event);
|
||||
|
||||
|
@ -1448,7 +1481,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanBack (
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
Sleep(0);
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1493,7 +1528,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanForward (
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1538,7 +1575,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellBack (
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1583,7 +1622,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellForward (
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1629,7 +1670,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGoTo (
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1674,7 +1717,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryLen
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1719,7 +1764,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryInd
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1766,7 +1813,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL (
|
|||
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
|
||||
|
||||
while (actionEvent->isComplete() == PR_FALSE) {
|
||||
#ifndef XP_UNIX
|
||||
Sleep(0);
|
||||
#endif
|
||||
}
|
||||
voidResult = actionEvent->getResult();
|
||||
delete actionEvent;
|
||||
|
@ -1801,6 +1850,8 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL (
|
|||
return urlString;
|
||||
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL()
|
||||
|
||||
|
||||
#ifdef XP_UNIX
|
||||
}// End extern "C"
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
#
|
||||
# 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
|
||||
GTKINCLUDES = -I/usr/X11R6/include -I/usr/lib/glib/include
|
||||
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
|
||||
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 -DXP_UNIX -DDEBUG_RAPTOR_CANVAS -DMOZ_DLL_SUFFIX=\".so\"
|
||||
STUBDEFINES = -D_REENTRANT
|
||||
STUBINCLUDE = ${JAVAINCLUDE}
|
||||
STUBLIBS = ${JAVALIBS}
|
||||
LIBS = ${GTKLIBS} ${JAVALIBS} \
|
||||
-L${DIST}/lib -lraptorgfx -lexpat -lxmltok -labouturl -lfileurl -lftpurl -lgophurl -lhttpurl -lremoturl -lsockstuburl -lmimetype -lnetcache -lnetcnvts -lnetwork -ljsurl -lmozdbm -lpwcac -lreg -lmozjs -lsecfree -lmozutil -lnspr3 -lxp -ljpeg -lpng -lz -lpthread -lXm -lXt -L${DIST}/lib -lxpcom -limg -lplds3 -lwidgetgtk -lgfxgtk -lraptorwebwidget -lraptorhtmlpars -lnetlib -lpref -lplds3 -lplc3 -ljsdom
|
||||
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
|
||||
|
||||
#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/*~
|
|
@ -22,7 +22,10 @@
|
|||
#ifndef nsActions_h___
|
||||
#define nsActions_h___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
//PENDING(mark): Will this work on the Mac????
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsString.h"
|
||||
#include "plevent.h"
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/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}
|
||||
# Native Threads
|
||||
LD_LIBRARY_PATH=${JDK_LOCATION}/jre/lib/i386:${JDK_LOCATION}/jre/lib/i386/classic:${JDK_LOCATION}/jre/lib/i386/native_threads:/disk4/mozilla/mozilla/dist/bin:.:/usr/local/lib:/usr/lib:/lib:.
|
||||
export LD_LIBRARY_PATH
|
||||
# Green Threads
|
||||
#LD_LIBRARY_PATH=${JDK_LOCATION}/jre/lib/i386:${JDK_LOCATION}/jre/lib/i386/classic:${JDK_LOCATION}/jre/lib/i386/green_threads:/disk4/mozilla/mozilla/dist/bin:.:/usr/local/lib:/usr/lib:/lib
|
||||
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
|
||||
|
||||
# For debugging...
|
||||
#${JAVA} -verbose:jni -Xcheck:jni -classpath ${CLASSES} ${CLASSNAME} $1
|
||||
${JAVA} -classpath ${CLASSES} ${CLASSNAME} $1 $2 $3 $4 $5
|
Загрузка…
Ссылка в новой задаче