This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Fix EmbeddedWindow cross-process embedding


Hi,

This patch allows embedding an EmbeddedWindow from one process into a
socket in another process.  Previously, embedding a window from within
the same process worked but cross-process embedding failed.

The problem was that the GtkPlug used in GtkEmbeddedWindowPeer's
implementation was being realized between the calls to
GtkEmbeddedWindowPeer's create and construct methods.  Calling
gtk_plug_construct on a realized window fails silently.

Comments?

Tom

2003-09-14  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java (construct):
	Remove method declaration.
	(create()): Call native create.
	(create(int)): New method.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c:
	(create): Add window_id parameter.  Call gtk_plug_new with
	window_id parameter.
	(construct): Remove method implementation.

Index: gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java,v
retrieving revision 1.1
diff -u -r1.1 GtkEmbeddedWindowPeer.java
--- gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java	27 Jul 2003 19:04:42 -0000	1.1
+++ gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java	14 Sep 2003 23:56:30 -0000
@@ -1,4 +1,5 @@
-/* GtkEmbeddedWindowPeer.java -- Implements FramePeer using a GtkPlug
+/* GtkEmbeddedWindowPeer.java -- Implements EmbeddedWindowPeer using a
+   GtkPlug
    Copyright (C) 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -44,12 +45,15 @@
 public class GtkEmbeddedWindowPeer extends GtkFramePeer
   implements EmbeddedWindowPeer
 {
-  native void create();
-  native void construct (int window_id);
+  native void create(int window_id);
+
+  void create ()
+  {
+    create (((EmbeddedWindow)awtComponent).getHandle());
+  }
 
   public GtkEmbeddedWindowPeer (EmbeddedWindow w)
   {
     super (w);
-    construct (w.getHandle());
   }
 }
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c,v
retrieving revision 1.2
diff -u -r1.2 gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c	27 Jul 2003 20:01:00 -0000	1.2
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c	14 Sep 2003 23:56:32 -0000
@@ -42,15 +42,15 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
-  (JNIEnv *env, jobject obj)
+  (JNIEnv *env, jobject obj, jint window_id)
 {
-  gpointer window;
+  GtkWidget *window;
   GtkWidget *vbox, *layout;
 
   gdk_threads_enter ();
 
   /* Create an "unplugged" GtkPlug. */
-  window = gtk_plug_new (0);
+  window = gtk_plug_new (window_id);
 
   vbox = gtk_vbox_new (0, 0);
   layout = gtk_layout_new (NULL, NULL);
@@ -63,19 +63,4 @@
   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 ();
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]