+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
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 \
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 \
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 \
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 \
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 \
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 \
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 \
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 \
.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 \
.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 \
.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 \
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;
+ }
}
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
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);
}
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;
}
--- /dev/null
+/* 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
+{
+}
--- /dev/null
+/* 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());
+ }
+}
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().
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();
return new GtkWindowPeer (w);
}
+ public EmbeddedWindowPeer createEmbeddedWindow (EmbeddedWindow w)
+ {
+ return new GtkEmbeddedWindowPeer (w);
+ }
+
protected FontPeer getFontPeer (String name, int style)
{
try {
--- /dev/null
+/* 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 ();
+}