From d1ada5f5b1baa9e10fdae5e3a1b60ca47a003bbe Mon Sep 17 00:00:00 2001 From: "mark.lin%eng.sun.com" Date: Fri, 13 Aug 1999 23:02:40 +0000 Subject: [PATCH] Rearchitected the way Mozilla events are delivered in the Unix Motif port. Events are now handled by a Java Thread. git-svn-id: svn://10.0.0.236/trunk@43316 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/java/webclient/classes/Makefile.unix | 2 + .../webclient/BrowserControlCanvas.java | 6 +- .../motif/MotifBrowserControlCanvas.java | 262 +++++++++--------- 3 files changed, 137 insertions(+), 133 deletions(-) diff --git a/mozilla/java/webclient/classes/Makefile.unix b/mozilla/java/webclient/classes/Makefile.unix index 5e699343503..e1720478405 100644 --- a/mozilla/java/webclient/classes/Makefile.unix +++ b/mozilla/java/webclient/classes/Makefile.unix @@ -18,5 +18,7 @@ all: ${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/MozillaEventThread.h org.mozilla.webclient.motif.MozillaEventThread ${JAVAH} -jni -classpath ${CLASSES} \ -o ${JAVAH_OUTPUT_DIR}/BrowserControlMozillaShim.h org.mozilla.webclient.BrowserControlMozillaShim diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java index 48173fd76da..b8aa3999fb9 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCanvas.java @@ -44,9 +44,11 @@ import java.awt.*; * See concrete subclasses for scope info. - * @version $Id: BrowserControlCanvas.java,v 1.1 1999-07-30 01:03:04 edburns%acm.org Exp $ + * @version $Id: BrowserControlCanvas.java,v 1.2 1999-08-13 23:02:39 mark.lin%eng.sun.com Exp $ - * @see org.mozilla.webclient.Win32BrowserControlCanvas + * @see org.mozilla.webclient.win32.Win32BrowserControlCanvas + + * @see org.mozilla.webclient.motif.MotifBrowserControlCanvas */ diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/motif/MotifBrowserControlCanvas.java b/mozilla/java/webclient/classes/org/mozilla/webclient/motif/MotifBrowserControlCanvas.java index e443da70cf1..c24a5d206c5 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/motif/MotifBrowserControlCanvas.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/motif/MotifBrowserControlCanvas.java @@ -1,131 +1,131 @@ -/* -*- 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. - */ - -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. - - * Lifetime And Scope

- - * There is one instance of the WebShellCanvas per top level awt Frame. - - * @version $Id: MotifBrowserControlCanvas.java,v 1.1 1999-08-10 18:55:00 mark.lin%eng.sun.com 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"); - } - - static private boolean firstTime = true; - private int gtkWinID; - private int gtkTopWindow; - private int canvasWinID; - private int gtkWinPtr; - private MDrawingSurfaceInfo drawingSurfaceInfo; - - 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 actionPerformed(ActionEvent e) { - System.out.println("process events....\n"); - this.processEvents(); - } - */ - - public void paint(Graphics g) { - super.paint(g); - - if (firstTime) { - synchronized(getTreeLock()) { - canvasWinID = this.drawingSurfaceInfo.getDrawable(); - this.reparentWindow(this.gtkWinID, this.canvasWinID); - - //Timer timer = new Timer(1, this); - //timer.start(); - - 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); - } - } - - /** - * 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); - } - - return this.gtkWinPtr; - } -} - +/* -*- 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. + */ + +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. + + * Lifetime And Scope

+ + * There is one instance of the WebShellCanvas per top level awt Frame. + + * @version $Id: MotifBrowserControlCanvas.java,v 1.2 1999-08-13 23:02:40 mark.lin%eng.sun.com 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"); + } + + static private boolean firstTime = true; + private int gtkWinID; + private int gtkTopWindow; + private int canvasWinID; + private int gtkWinPtr; + private MDrawingSurfaceInfo drawingSurfaceInfo; + + 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; + + Thread mozillaEventThread = new MozillaEventThread(this); + mozillaEventThread.start(); + } + } + } + + 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); + } + + return this.gtkWinPtr; + } +} +