2003-07-27 Thomas Fitzsimmons <fitzsim@redhat.com.h>

Michael Koch  <konqueror@gmx.de>

	* gnu/java/awt/EmbeddedWindow.java
	(EmbeddedWindow): Extends Frame instead of Window.
	(window_id): New member variable to store the native window handle.
	(create): Removed.
	(EmbeddedWindow): New constructor.
	(addNotify): New method.
	(getHandler): Likewise.
	(setWindowPeer): New native method.
	* gnu/java/awt/EmbeddedWindowSupport.java
	(EmbeddedWindowSupport): Fixed documentation.
	(createEmbeddedWindow): Return EmbeddedWindowPeer instead of
	WindowPeer, give it an EmbeddedWindow instance instead of the raw
	window data.
	* gnu/java/awt/natEmbeddedWindow.cc
	(create): Removed.
	(setWindowPeer): New method.
	* gnu/java/awt/peer/EmbeddedWindowPeer.java,
	gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c:
	New files
	* gnu/java/awt/peer/gtk/GtkToolkit.java
	(GtkToolkit): Implements EmbeddedWindowSupport.
	(createEmbeddedWindow): New method.
	* java/awt/Window.java
	(Window): Removed.
	* Makefile.am
	(java_source_files): Added EmbeddedWindowPeer.java.
	(gtk_awt_peer_sources): Added GtkEmbeddedWindowPeer.java.
	(gtk_c_source_files): Added gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c.
	* Makefile.in: Regenerated.

Co-Authored-By: Michael Koch <konqueror@gmx.de>

From-SVN: r69859
This commit is contained in:
Thomas Fitzsimmons 2003-07-27 19:04:42 +00:00 committed by Michael Koch
parent b7a78333b1
commit 0963808165
10 changed files with 286 additions and 26 deletions

View File

@ -1,3 +1,37 @@
2003-07-27 Thomas Fitzsimmons <fitzsim@redhat.com.h>
Michael Koch <konqueror@gmx.de>
* gnu/java/awt/EmbeddedWindow.java
(EmbeddedWindow): Extends Frame instead of Window.
(window_id): New member variable to store the native window handle.
(create): Removed.
(EmbeddedWindow): New constructor.
(addNotify): New method.
(getHandler): Likewise.
(setWindowPeer): New native method.
* gnu/java/awt/EmbeddedWindowSupport.java
(EmbeddedWindowSupport): Fixed documentation.
(createEmbeddedWindow): Return EmbeddedWindowPeer instead of
WindowPeer, give it an EmbeddedWindow instance instead of the raw
window data.
* gnu/java/awt/natEmbeddedWindow.cc
(create): Removed.
(setWindowPeer): New method.
* gnu/java/awt/peer/EmbeddedWindowPeer.java,
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c:
New files
* gnu/java/awt/peer/gtk/GtkToolkit.java
(GtkToolkit): Implements EmbeddedWindowSupport.
(createEmbeddedWindow): New method.
* java/awt/Window.java
(Window): Removed.
* Makefile.am
(java_source_files): Added EmbeddedWindowPeer.java.
(gtk_awt_peer_sources): Added GtkEmbeddedWindowPeer.java.
(gtk_c_source_files): Added gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c.
* Makefile.in: Regenerated.
2003-07-26 Ranjit Mathew <rmathew@hotmail.com>
* java/lang/Win32Process.java (ConcreteProcess): Surround

View File

@ -166,6 +166,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
@ -206,6 +207,7 @@ gnu/java/awt/peer/gtk/GtkClipboard.java \
gnu/java/awt/peer/gtk/GtkComponentPeer.java \
gnu/java/awt/peer/gtk/GtkContainerPeer.java \
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java \
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java \
gnu/java/awt/peer/gtk/GtkFontPeer.java \
gnu/java/awt/peer/gtk/GtkFramePeer.java \
@ -758,6 +760,7 @@ gnu/java/awt/EventModifier.java \
gnu/java/awt/GLightweightPeer.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/awt/peer/EmbeddedWindowPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \

View File

@ -255,6 +255,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
@ -295,6 +296,7 @@ gnu/java/awt/peer/gtk/GtkClipboard.java \
gnu/java/awt/peer/gtk/GtkComponentPeer.java \
gnu/java/awt/peer/gtk/GtkContainerPeer.java \
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java \
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java \
gnu/java/awt/peer/gtk/GtkFontPeer.java \
gnu/java/awt/peer/gtk/GtkFramePeer.java \
@ -529,6 +531,7 @@ gnu/java/awt/EventModifier.java \
gnu/java/awt/GLightweightPeer.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/awt/peer/EmbeddedWindowPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \
@ -2591,6 +2594,7 @@ gnu/java/awt/peer/gtk/GtkClipboard.lo \
gnu/java/awt/peer/gtk/GtkComponentPeer.lo \
gnu/java/awt/peer/gtk/GtkContainerPeer.lo \
gnu/java/awt/peer/gtk/GtkDialogPeer.lo \
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.lo \
gnu/java/awt/peer/gtk/GtkFileDialogPeer.lo \
gnu/java/awt/peer/gtk/GtkFontPeer.lo \
gnu/java/awt/peer/gtk/GtkFramePeer.lo \
@ -2623,6 +2627,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.lo \
@ -2785,6 +2790,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/awt/image/ImageDecoder.P \
.deps/gnu/java/awt/image/XBMDecoder.P \
.deps/gnu/java/awt/natEmbeddedWindow.P \
.deps/gnu/java/awt/peer/EmbeddedWindowPeer.P \
.deps/gnu/java/awt/peer/gtk/GdkFontMetrics.P \
.deps/gnu/java/awt/peer/gtk/GdkGraphics.P \
.deps/gnu/java/awt/peer/gtk/GtkArg.P \
@ -2799,6 +2805,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/awt/peer/gtk/GtkComponentPeer.P \
.deps/gnu/java/awt/peer/gtk/GtkContainerPeer.P \
.deps/gnu/java/awt/peer/gtk/GtkDialogPeer.P \
.deps/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.P \
.deps/gnu/java/awt/peer/gtk/GtkFileDialogPeer.P \
.deps/gnu/java/awt/peer/gtk/GtkFontPeer.P \
.deps/gnu/java/awt/peer/gtk/GtkFramePeer.P \
@ -4226,6 +4233,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.P \

View File

@ -38,25 +38,59 @@ exception statement from your version. */
package gnu.java.awt;
import java.awt.Window;
import gnu.java.awt.peer.EmbeddedWindowPeer;
import java.awt.Frame;
import java.awt.Toolkit;
/**
* This class represents an AWT window embedded into another graphical
* toolkit or anther application.
* Represents an AWT window that can be embedded into another
* application.
*
* @author Michael Koch <konqueror@gmx.de>
*/
public class EmbeddedWindow extends Window
public class EmbeddedWindow extends Frame
{
private int window_id;
/**
* Creates an window embedded into another application of graphical toolkit.
* Creates an window to be embedded into another application.
*
* @param window_id The native handle to the screen area where the AWT window
* should be embedded.
* @param width The width of the screen area.
* @param height The height of the screen area.
*/
public EmbeddedWindow (int window_id)
{
super();
this.window_id = window_id;
}
/**
* Creates the native peer for this embedded window.
*/
public void addNotify()
{
Toolkit tk = getToolkit();
if (! (tk instanceof EmbeddedWindowSupport))
throw new UnsupportedOperationException
("Embedded windows are not supported by the current peers: " + tk.getClass());
setWindowPeer (((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
super.addNotify();
}
// This method is only made native to circumvent the package-privateness of
// an internal java.awt.Window constructor.
public static native Window create (int window_id, int width, int height);
// an AWT internal java.awt.Component.peer member variable.
native void setWindowPeer (EmbeddedWindowPeer peer);
/**
* Gets the native handle of the screen area where the window will
* be embedded.
*
* @return The native handle that was passed to the constructor.
*/
public int getHandle()
{
return window_id;
}
}

View File

@ -38,14 +38,15 @@ exception statement from your version. */
package gnu.java.awt;
import java.awt.peer.WindowPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
/**
* This interface defines a method for creating embedded windows.
* Declares a method for creating native embedded window peers.
*
* All classes inherited from java.awt.Toolkit that implement this interface
* are assumed to support embedded windows. To embed the real embedded window
* you need to use gnu.java.awt.EmbeddedWindow.
* All classes inherited from java.awt.Toolkit that implement this
* interface are assumed to support the creation of embedded window
* peers. To create an embedded window, use
* gnu.java.awt.EmbeddedWindow.
*
* @see gnu.java.awt.EmbeddedWindow
* @see java.awt.Toolkit
@ -55,13 +56,10 @@ import java.awt.peer.WindowPeer;
public interface EmbeddedWindowSupport
{
/**
* This method creates an embedded window in an application.
* Creates an embedded window peer, and associates it with an
* EmbeddedWindow object.
*
* @param window_id The native handle of a screen area to display an
* AWT window in it.
* @param width The width of the screen area.
* @param height The height of the screen area.
* @param w The embedded window with which to associate a peer.
*/
public WindowPeer createEmbeddedWindow (int window_id,
int width, int height);
public EmbeddedWindowPeer createEmbeddedWindow (EmbeddedWindow w);
}

View File

@ -7,10 +7,11 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <gnu/java/awt/EmbeddedWindow.h>
#include <java/awt/Window.h>
#include <gnu/java/awt/peer/EmbeddedWindowPeer.h>
::java::awt::Window*
gnu::java::awt::EmbeddedWindow::create (jint window_id, jint width, jint height)
void
gnu::java::awt::EmbeddedWindow::setWindowPeer (gnu::java::awt::peer::EmbeddedWindowPeer* w)
{
return new ::java::awt::Window (window_id, width, height);
if (!peer)
(::java::lang::Object*) peer = (::java::lang::Object*) w;
}

View File

@ -0,0 +1,46 @@
/* EmbeddedWindowPeer.java -- Interface for window peers that may be
embedded into other applications
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer;
import java.awt.peer.FramePeer;
public interface EmbeddedWindowPeer extends FramePeer
{
}

View File

@ -0,0 +1,55 @@
/* GtkEmbeddedWindowPeer.java -- Implements FramePeer using a GtkPlug
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.gtk;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.peer.EmbeddedWindowPeer;
public class GtkEmbeddedWindowPeer extends GtkFramePeer
implements EmbeddedWindowPeer
{
native void create();
native void construct (int window_id);
public GtkEmbeddedWindowPeer (EmbeddedWindow w)
{
super (w);
construct (w.getHandle());
}
}

View File

@ -52,6 +52,9 @@ import java.util.Hashtable;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Properties;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.EmbeddedWindowSupport;
import gnu.java.awt.peer.EmbeddedWindowPeer;
import gnu.classpath.Configuration;
/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
@ -61,7 +64,8 @@ import gnu.classpath.Configuration;
this class. If getPeer() ever goes away, we can implement a hash table
that will keep up with every window's peer, but for now this is faster. */
public class GtkToolkit extends java.awt.Toolkit
public class GtkToolkit extends Toolkit
implements EmbeddedWindowSupport
{
GtkMainThread main;
Hashtable containers = new Hashtable();
@ -299,6 +303,11 @@ public class GtkToolkit extends java.awt.Toolkit
return new GtkWindowPeer (w);
}
public EmbeddedWindowPeer createEmbeddedWindow (EmbeddedWindow w)
{
return new GtkEmbeddedWindowPeer (w);
}
protected FontPeer getFontPeer (String name, int style)
{
try {

View File

@ -0,0 +1,72 @@
/* gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c -- Native
implementation of GtkEmbeddedWindowPeer
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.h"
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
(JNIEnv *env, jobject obj)
{
gpointer window;
gdk_threads_enter ();
/* Create an "unplugged" GtkPlug. */
window = gtk_plug_new (0);
gdk_threads_leave ();
NSA_SET_PTR (env, obj, window);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_construct
(JNIEnv *env, jobject obj, jint window_id)
{
void *ptr;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
gtk_plug_construct (GTK_PLUG (ptr), window_id);
gdk_threads_leave ();
}