[Patch][gui] native gtk-peer merge

Michael Koch konqueror@gmx.de
Thu Feb 10 16:20:00 GMT 2005


Hi list,


I commited the attached patch to merge the native part of the gtk-peer
more with classpath CVS HEAD. It fixes a compile problem with the latest
cairo snapshot and some problems fixed by Graig Black.


Michael


2005-02-10  Michael Koch  <konqueror@gmx.de>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
	 Fix includes for cairo 0.3.0 snappshot.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
	Merged file header from classpath CVS HEAD.

2005-02-10  Craig Black  <craig.black@aonix.com>

	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
	(copyState): Pass a JNI global reference to signal handler.
	(realize_cb): Use and free JNI global reference.
	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
	(create): Pass a JNI global reference to signal handler.
	(selection_changed): Match declaration.
	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
	(dispose): Do not remove entries from state tables until after widget is
	destroyed.

-------------- next part --------------
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,v
retrieving revision 1.9.4.1
diff -u -r1.9.4.1 gnu_java_awt_peer_gtk_GdkGraphics.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c	8 Feb 2005 05:22:49 -0000	1.9.4.1
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c	10 Feb 2005 15:08:29 -0000
@@ -133,13 +133,17 @@
   (JNIEnv *env, jobject obj, jobject peer)
 {
   void *ptr;
+  jobject *gref;
+
+  NSA_SET_GLOBAL_REF (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
 
   ptr = NSA_GET_PTR (env, peer);
 
   gdk_threads_enter ();
 
   g_signal_connect_after (G_OBJECT (ptr), "realize",
-                          G_CALLBACK (realize_cb), obj);
+                          G_CALLBACK (realize_cb), *gref);
 
   gdk_threads_leave ();
 }
@@ -682,5 +686,7 @@
 
   (*gdk_env())->CallVoidMethod (gdk_env(), peer, initComponentGraphicsID);
 
+  NSA_DEL_GLOBAL_REF (gdk_env(), peer);
+
   gdk_threads_enter ();
 }
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.11.4.2
diff -u -r1.11.4.2 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	10 Feb 2005 04:48:41 -0000	1.11.4.2
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	10 Feb 2005 15:08:29 -0000
@@ -45,7 +45,8 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk-pixbuf/gdk-pixdata.h>
 
-#include <cairo.h>
+#include <cairo-ft.h>
+#include <cairo-xlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,v
retrieving revision 1.9.4.1
diff -u -r1.9.4.1 gnu_java_awt_peer_gtk_GtkChoicePeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c	8 Feb 2005 05:22:51 -0000	1.9.4.1
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c	10 Feb 2005 15:08:29 -0000
@@ -39,22 +39,24 @@
 #include "gtkpeer.h"
 #include "gnu_java_awt_peer_gtk_GtkChoicePeer.h"
 
-static void selection_changed (GtkComboBox *combobox, gpointer data);
+static void selection_changed (GtkComboBox *combobox, jobject peer);
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create 
   (JNIEnv *env, jobject obj)
 {
   GtkWidget *combobox;
+  jobject *gref;
 
   NSA_SET_GLOBAL_REF (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
 
   gdk_threads_enter ();
   
   combobox = gtk_combo_box_new_text ();
 
   g_signal_connect (combobox, "changed",
-                    G_CALLBACK (selection_changed), obj);
+                    G_CALLBACK (selection_changed), *gref);
 
   gdk_threads_leave ();
 
@@ -175,7 +177,7 @@
   return index;
 }
 
-void selection_changed (GtkComboBox *combobox, jobject peer)
+static void selection_changed (GtkComboBox *combobox, jobject peer)
 {
   jstring label;
   GtkTreeModel *model;
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c,v
retrieving revision 1.2.4.1
diff -u -r1.2.4.1 gnu_java_awt_peer_gtk_GtkGenericPeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c	8 Feb 2005 05:22:51 -0000	1.2.4.1
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c	10 Feb 2005 15:08:29 -0000
@@ -45,9 +45,7 @@
 {
   void *ptr;
 
-  /* Remove entries from state tables */
-  NSA_DEL_GLOBAL_REF (env, obj);
-  ptr = NSA_DEL_PTR (env, obj);
+  ptr = NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
 
@@ -57,6 +55,10 @@
 
   gdk_threads_leave ();
 
+  /* Remove entries from state tables */
+  NSA_DEL_GLOBAL_REF (env, obj);
+  NSA_DEL_PTR (env, obj);
+
   /* 
    * Wake up the main thread, to make sure it re-checks the window
    * destruction condition. 
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,v
retrieving revision 1.11.4.1
diff -u -r1.11.4.1 gnu_java_awt_peer_gtk_GtkListPeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c	8 Feb 2005 05:22:51 -0000	1.11.4.1
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c	10 Feb 2005 15:08:29 -0000
@@ -1,5 +1,5 @@
-/* gtklistpeer.c -- Native implementation of GtkListPeer
-   Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
+/* GtkListPeer.c -- implements GtkListPeer's native methods
+   Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GNU Classpath.
 


More information about the Java-patches mailing list