summaryrefslogtreecommitdiff
path: root/libjava/classpath/native/jni/gtk-peer
diff options
context:
space:
mode:
authordoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-04 10:53:49 +0000
committerdoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-04 10:53:49 +0000
commitbfd03af53013b43663c88995c6d5943815e8d75b (patch)
tree871b70a606d87369d5aa9d6f621baedc13b49eba /libjava/classpath/native/jni/gtk-peer
parentbefb0bace8afefe156fe5718f9d1f202d28560c7 (diff)
downloadgcc-bfd03af53013b43663c88995c6d5943815e8d75b.tar.gz
libjava/
2007-08-04 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (libgcj-import-20070727). * Regenerate class and header files. * Regenerate auto* files. * include/jvm.h: * jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type. * jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise. * jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA, _Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA, _Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA, _Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify jvalue parameter. * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise. * java/lang/VMFloat.java (toString, parseFloat): New. * gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported, isModalExclusionTypeSupported): New (stub only). * gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise. * gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages, updateFocusableWindowState, setModalBlocked, getBoundsPrivate, setAlwaysOnTop): Likewise. * gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature. * scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer, ignore javax.sound.sampled.spi.MixerProvider, ignore .in files. * HACKING: Mention --enable-gstreamer-peer, removal of generated files. libjava/classpath/ 2007-08-04 Matthias Klose <doko@ubuntu.com> * java/util/EnumMap.java (clone): Add cast. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127204 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/native/jni/gtk-peer')
-rw-r--r--libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c18
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.am4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.in24
-rw-r--r--libjava/classpath/native/jni/gtk-peer/cairographics2d.h1
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gdkdisplay.h24
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gdkfont.h42
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c15
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c8
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c5
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c27
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c28
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c25
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c27
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c43
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c28
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c24
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c7
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c74
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c26
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c22
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c16
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c14
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c34
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c10
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c3
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c18
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c16
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c14
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c16
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c18
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c8
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c38
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c38
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c14
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c60
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtk_jawt.c8
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtkpeer.c584
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtkpeer.h221
44 files changed, 1133 insertions, 499 deletions
diff --git a/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c b/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c
index 62ffa1395ea..aee61bd08f6 100644
--- a/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/GtkDragSourceContextPeer.c
@@ -36,7 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
#include "gtkpeer.h"
-#include "GtkDragSourceContextPeer.h"
+#include "gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer.h"
#include <jni.h>
#include <gtk/gtk.h>
@@ -78,7 +78,7 @@ static jmethodID dropCompleteID;
GtkWidget *widget;
GtkWidget *tgt;
-jobject *gref;
+jobject gref;
jobject javaObj;
JNIEXPORT void JNICALL
@@ -88,10 +88,10 @@ Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_create
gdk_threads_enter ();
javaObj = obj;
- NSA_SET_GLOBAL_REF (env, obj);
- NSA_SET_GLOBAL_REF (env, comp);
+ gtkpeer_set_global_ref (env, obj);
+ gtkpeer_set_global_ref (env, comp);
- gref = NSA_GET_PTR (env, comp);
+ gref = gtkpeer_get_widget (env, comp);
widget = get_widget (GTK_WIDGET (gref));
gdk_threads_leave ();
@@ -109,7 +109,7 @@ Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_nativeSetCursor
gdk_threads_enter ();
javaObj = obj;
- ptr = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_global_ref (env, obj);
switch (type)
{
@@ -180,7 +180,7 @@ Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_connectSignals
gdk_threads_enter ();
javaObj = obj;
- gref = NSA_GET_GLOBAL_REF (env, comp);
+ gref = gtkpeer_get_global_ref (env, comp);
connect_signals_for_widget (widget);
@@ -245,7 +245,7 @@ Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_setTarget
gdk_threads_enter ();
javaObj = obj;
- ptr = NSA_GET_PTR (env, target);
+ ptr = gtkpeer_get_widget (env, target);
tgt = get_widget (GTK_WIDGET (ptr));
connect_signals_for_widget (tgt);
@@ -268,7 +268,7 @@ Java_gnu_java_awt_dnd_peer_gtk_GtkDragSourceContextPeer_nativeStartDrag
gdk_threads_enter ();
javaObj = obj;
- ptr = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_global_ref (env, obj);
data = (*env)->GetStringUTFChars (env, target, NULL);
tar[0].target = (gchar *) data;
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.am b/libjava/classpath/native/jni/gtk-peer/Makefile.am
index 15f865d4fee..b6438ff6fea 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.am
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.am
@@ -44,10 +44,10 @@ libgtkpeer_la_SOURCES = gnu_java_awt_peer_gtk_CairoSurface.c \
gdkdisplay.h \
gdkfont.h \
gtk_jawt.c \
+ gtkpeer.c \
gtkpeer.h
-libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
- $(top_builddir)/native/jni/classpath/jcl.lo
+libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
libgtkpeer_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @FREETYPE2_LIBS@ \
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.in b/libjava/classpath/native/jni/gtk-peer/Makefile.in
index c12ee60603d..1b76b7fb13d 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.in
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.in
@@ -71,7 +71,6 @@ am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
libgtkpeer_la_DEPENDENCIES = \
- $(top_builddir)/native/jni/classpath/native_state.lo \
$(top_builddir)/native/jni/classpath/jcl.lo
am_libgtkpeer_la_OBJECTS = gnu_java_awt_peer_gtk_CairoSurface.lo \
gnu_java_awt_peer_gtk_CairoGraphics2D.lo \
@@ -111,7 +110,7 @@ am_libgtkpeer_la_OBJECTS = gnu_java_awt_peer_gtk_CairoSurface.lo \
gnu_java_awt_peer_gtk_GtkToolkit.lo \
gnu_java_awt_peer_gtk_GtkWindowPeer.lo \
gnu_java_awt_peer_gtk_GtkVolatileImage.lo \
- GtkDragSourceContextPeer.lo gtk_jawt.lo
+ GtkDragSourceContextPeer.lo gtk_jawt.lo gtkpeer.lo
libgtkpeer_la_OBJECTS = $(am_libgtkpeer_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/../../depcomp
@@ -164,6 +163,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
+CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -202,8 +203,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
-FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
-FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@@ -227,6 +226,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
+GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
+GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
+GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
+GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
+GSTREAMER_LIBS = @GSTREAMER_LIBS@
+GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
+GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
+GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
+GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@@ -299,8 +307,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
-USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
-USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
@@ -418,11 +424,10 @@ libgtkpeer_la_SOURCES = gnu_java_awt_peer_gtk_CairoSurface.c \
gdkdisplay.h \
gdkfont.h \
gtk_jawt.c \
+ gtkpeer.c \
gtkpeer.h
-libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
- $(top_builddir)/native/jni/classpath/jcl.lo
-
+libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
libgtkpeer_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @FREETYPE2_LIBS@ \
@PANGOFT2_LIBS@ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ @XTEST_LIBS@
@@ -544,6 +549,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkVolatileImage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkWindowPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_jawt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkpeer.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff --git a/libjava/classpath/native/jni/gtk-peer/cairographics2d.h b/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
index fc564a86a99..d5611bff6d0 100644
--- a/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
+++ b/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
@@ -45,7 +45,6 @@ exception statement from your version. */
#include <stdlib.h>
#include <string.h>
#include <config.h>
-#include "native_state.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <jni.h>
diff --git a/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h b/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h
index 238ff9e2613..e15f08e6906 100644
--- a/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h
+++ b/libjava/classpath/native/jni/gtk-peer/gdkdisplay.h
@@ -40,28 +40,4 @@
#include "gtkpeer.h"
-/* Allows storing GdkDisplay pointers in GdkGraphicsEnvironment instances. */
-extern struct state_table *cp_gtk_native_display_state_table;
-
-/* Allows storing GdkScreen pointers in GdkScreenGraphicsDevice instances. */
-extern struct state_table *cp_gtk_native_screen_state_table;
-
-#define NSA_DISPLAY_INIT(env, clazz) \
- cp_gtk_native_display_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_DISPLAY_PTR(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_display_state_table)
-
-#define NSA_SET_DISPLAY_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, cp_gtk_native_display_state_table, (void *)ptr)
-
-#define NSA_SCREEN_INIT(env, clazz) \
- cp_gtk_native_screen_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_SCREEN_PTR(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_screen_state_table)
-
-#define NSA_SET_SCREEN_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, cp_gtk_native_screen_state_table, (void *)ptr)
-
#endif /* __GDKDISPLAY_H__ */
diff --git a/libjava/classpath/native/jni/gtk-peer/gdkfont.h b/libjava/classpath/native/jni/gtk-peer/gdkfont.h
index 20b8e424d84..241a05f7d5f 100644
--- a/libjava/classpath/native/jni/gtk-peer/gdkfont.h
+++ b/libjava/classpath/native/jni/gtk-peer/gdkfont.h
@@ -46,48 +46,6 @@
#include <pango/pango-fontmap.h>
#include <pango/pangoft2.h>
-extern struct state_table *cp_gtk_native_font_state_table;
-extern struct state_table *native_glyphvector_state_table;
-extern struct state_table *cp_gtk_native_text_layout_state_table;
-
-#define NSA_FONT_INIT(env, clazz) \
- cp_gtk_native_font_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_FONT_PTR(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_font_state_table)
-
-#define NSA_SET_FONT_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, cp_gtk_native_font_state_table, (void *)ptr)
-
-#define NSA_DEL_FONT_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, cp_gtk_native_font_state_table)
-
-
-#define NSA_GV_INIT(env, clazz) \
- native_glyphvector_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_GV_PTR(env, obj) \
- cp_gtk_get_state (env, obj, native_glyphvector_state_table)
-
-#define NSA_SET_GV_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, native_glyphvector_state_table, (void *)ptr)
-
-#define NSA_DEL_GV_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, native_glyphvector_state_table)
-
-
-#define NSA_TEXT_LAYOUT_INIT(env, clazz) \
- cp_gtk_native_text_layout_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_TEXT_LAYOUT_PTR(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_text_layout_state_table)
-
-#define NSA_SET_TEXT_LAYOUT_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, cp_gtk_native_text_layout_state_table, (void *)ptr)
-
-#define NSA_DEL_TEXT_LAYOUT_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, cp_gtk_native_text_layout_state_table)
-
#define FONT_METRICS_ASCENT 0
#define FONT_METRICS_MAX_ASCENT 1
#define FONT_METRICS_DESCENT 2
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
index 40ddeedf8a1..141e83792d2 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
@@ -327,7 +327,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
+ pfont = (struct peerfont *) gtkpeer_get_font(env, font);
g_assert (pfont != NULL);
glyphs = g_malloc( sizeof(cairo_glyph_t) * n);
@@ -392,7 +392,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFont
gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
+ pfont = (struct peerfont *) gtkpeer_get_font(env, font);
g_assert (pfont != NULL);
gdk_threads_enter();
@@ -508,7 +508,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
- jlong pointer, jdouble width, int cap, int join, double miterLimit)
+ jlong pointer, jdouble width, jint cap, jint join, jdouble miterLimit)
{
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
index ed9cf3d6ddc..9de0d7b95f1 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
@@ -125,13 +125,13 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_initState
cairo_surface_t *surface;
GdkWindow *win;
GtkWidget *widget = NULL;
- void *ptr = NULL;
int width, height;
cairo_t *cr;
+ void *ptr;
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
@@ -232,7 +232,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
@@ -260,10 +260,10 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_nativeGrab
gint w,h;
GtkWidget *widget = NULL;
void *ptr = NULL;
-
+
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
@@ -293,12 +293,13 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
{
GdkPixmap *pixmap;
GtkWidget *widget = NULL;
- void *ptr = NULL;
GdkGC *gc;
GdkRectangle clip;
+ void *ptr;
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, peer);
+
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
index 76caa5d0c00..7ce93b0a7a5 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
@@ -67,7 +67,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphicsCopy_getPixbuf
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
@@ -95,8 +95,8 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphicsCopy_copyPixbuf
(JNIEnv *env, jobject obj __attribute__((unused)),
jobject peer, jobject image,
- int x __attribute__((unused)), int y __attribute__((unused)),
- int width __attribute__((unused)), int height __attribute__((unused)))
+ jint x __attribute__((unused)), jint y __attribute__((unused)),
+ jint width __attribute__((unused)), jint height __attribute__((unused)))
{
gint pwidth, pheight;
GdkPixbuf *pixbuf;
@@ -107,7 +107,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphicsCopy_copyPixbuf
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
index 1a2d2a07430..cea06f52d51 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
@@ -45,7 +45,6 @@ exception statement from your version. */
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include "jcl.h"
-#include "native_state.h"
#include "gdkfont.h"
#include "gnu_java_awt_peer_gtk_FreetypeGlyphVector.h"
#include "cairographics2d.h"
@@ -76,7 +75,7 @@ getFont(JNIEnv *env, jobject obj)
data = (*env)->GetObjectField (env, obj, fid);
g_assert (data != NULL);
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, data);
+ pfont = (struct peerfont *) gtkpeer_get_font(env, data);
g_assert (pfont != NULL);
g_assert (pfont->font != NULL);
@@ -99,7 +98,7 @@ getFontSet(JNIEnv *env, jobject obj)
data = (*env)->GetObjectField (env, obj, fid);
g_assert (data != NULL);
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, data);
+ pfont = (struct peerfont *) gtkpeer_get_font (env, data);
g_assert (pfont != NULL);
g_assert (pfont->font != NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 022edeeaffd..a5e59f7e4fd 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -44,10 +44,9 @@
#include <freetype/fttypes.h>
#include <freetype/tttables.h>
#include "gdkfont.h"
+#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GdkFontPeer.h"
-struct state_table *cp_gtk_native_font_state_table;
-
enum java_awt_font_style {
java_awt_font_PLAIN = 0,
java_awt_font_BOLD = 1,
@@ -60,11 +59,14 @@ enum java_awt_font_baseline {
java_awt_font_HANGING_BASELINE = 2
};
+static PangoFT2FontMap *ft2_map = NULL;
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState
- (JNIEnv *env, jclass clazz)
+ (JNIEnv *env, jclass clazz __attribute__((unused)))
{
- NSA_FONT_INIT (env, clazz);
+ gtkpeer_init_font_IDs(env);
+ ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_new());
}
JNIEXPORT void JNICALL
@@ -78,7 +80,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_initState
g_assert (self != NULL);
pfont = (struct peerfont *) g_malloc0 (sizeof (struct peerfont));
g_assert (pfont != NULL);
- NSA_SET_FONT_PTR (env, self, pfont);
+ gtkpeer_set_font (env, self, pfont);
gdk_threads_leave ();
}
@@ -92,7 +94,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
gdk_threads_enter ();
- pfont = (struct peerfont *)NSA_DEL_FONT_PTR (env, self);
+ pfont = (struct peerfont *) gtkpeer_get_font (env, self);
g_assert (pfont != NULL);
if (pfont->layout != NULL)
g_object_unref (pfont->layout);
@@ -118,7 +120,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_releasePeerGraphicsResource
gdk_threads_enter();
- pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+ pfont = (struct peerfont *) gtkpeer_get_font (env, java_font);
g_assert (pfont != NULL);
if (pfont->graphics_resource != NULL)
{
@@ -145,7 +147,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics
gdk_threads_enter();
- pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+ pfont = (struct peerfont *) gtkpeer_get_font (env, java_font);
g_assert (pfont != NULL);
face = pango_fc_font_lock_face ((PangoFcFont *)pfont->font);
@@ -194,7 +196,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics
gdk_threads_enter();
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
+ pfont = (struct peerfont *) gtkpeer_get_font(env, java_font);
g_assert (pfont != NULL);
cstr = (*env)->GetStringUTFChars (env, str, NULL);
@@ -248,14 +250,13 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
struct peerfont *pfont = NULL;
char const *family_name = NULL;
enum java_awt_font_style style;
- PangoFT2FontMap *ft2_map = NULL;
gdk_threads_enter ();
style = (enum java_awt_font_style) style_int;
g_assert (self != NULL);
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self);
+ pfont = (struct peerfont *) gtkpeer_get_font(env, self);
g_assert (pfont != NULL);
/* Clear old font information */
@@ -286,9 +287,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
pango_font_description_set_size (pfont->desc, size * PANGO_SCALE);
/* Create new context */
- ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_new());
pfont->ctx = pango_ft2_font_map_create_context (ft2_map);
- g_object_unref(ft2_map);
g_assert (pfont->ctx != NULL);
pango_context_set_font_description (pfont->ctx, pfont->desc);
@@ -321,7 +320,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTrueTypeTable
jbyteArray result_array;
jbyte *rbuf;
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self);
+ pfont = (struct peerfont *) gtkpeer_get_font(env, self);
if(pfont == NULL)
return NULL;
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
index 6528ad43a2e..1c88d1b510e 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
@@ -42,18 +42,13 @@
#include "gdkdisplay.h"
#include "gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h"
-struct state_table *cp_gtk_native_display_state_table;
-
jclass gdkGraphicsEnvironment_class;
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_initStaticState
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_initIDs
(JNIEnv *env, jclass klazz __attribute__((unused)))
{
- gdkGraphicsEnvironment_class = (*env)->NewGlobalRef
- (env, klazz);
-
- NSA_DISPLAY_INIT(env, gdkGraphicsEnvironment_class);
+ gtkpeer_init_display_IDs(env);
}
JNIEXPORT void JNICALL
@@ -70,7 +65,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeInitState
gdk_threads_leave();
/* Store display pointer in GdkGraphicsEnvironment instance. */
- NSA_SET_DISPLAY_PTR(env, obj, (void *) defaultDisplay);
+ gtkpeer_set_display(env, obj, (void *) defaultDisplay);
}
static gint
@@ -157,7 +152,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetScreenDevices
gdkScreenGraphicsDevice_init = (*env)->GetMethodID
(env, gdkScreenGraphicsDevice_class, "init", "()V");
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, obj);
+ display = (GdkDisplay *) gtkpeer_get_display(env, obj);
gdk_threads_enter();
@@ -181,9 +176,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetScreenDevices
gdkScreenGraphicsDevice_ctor,
obj);
- NSA_SET_SCREEN_PTR(env,
- instance,
- gdk_display_get_screen(display, i));
+ gtkpeer_set_screen(env, instance, gdk_display_get_screen(display, i));
gdk_threads_leave();
(*env)->CallVoidMethod(env,
@@ -214,15 +207,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetDefaultScreenDevice
gdkScreenGraphicsDevice_ctor = (*env)->GetMethodID
(env, gdkScreenGraphicsDevice_class, "<init>",
"(Lgnu/java/awt/peer/gtk/GdkGraphicsEnvironment;)V");
-
gdkScreenGraphicsDevice_init = (*env)->GetMethodID
(env, gdkScreenGraphicsDevice_class, "init", "()V");
/* Create the GdkScreenGraphicsDevice instance. */
- defaultDevice = (*env)->NewObject (env,
- gdkScreenGraphicsDevice_class,
- gdkScreenGraphicsDevice_ctor,
- obj);
+ defaultDevice = (*env)->NewObject(env, gdkScreenGraphicsDevice_class,
+ gdkScreenGraphicsDevice_ctor, obj);
gdk_threads_enter();
@@ -233,7 +223,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetDefaultScreenDevice
/* Class initialization will have set up the native_state storage
* mechanism for GdkScreenGraphicsDevice.
*/
- NSA_SET_SCREEN_PTR(env, defaultDevice, defaultScreen);
+ gtkpeer_set_screen(env, defaultDevice, defaultScreen);
(*env)->CallVoidMethod(env,
defaultDevice,
@@ -252,7 +242,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_getMouseCoordinates
gint x, y, screenIndex;
GdkScreen *screen;
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, obj);
+ display = (GdkDisplay *) gtkpeer_get_display(env, obj);
g_assert (display != NULL);
gdk_threads_enter ();
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
index b92d017a5d4..5ed39521aca 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
@@ -42,26 +42,11 @@
#include <jni.h>
#include <jcl.h>
-#include "native_state.h"
#include "gnu_java_awt_peer_gtk_GdkPixbufDecoder.h"
#include <string.h>
#include <stdlib.h>
-static struct state_table *native_pixbufdecoder_state_table;
-
-#define NSA_PB_INIT(env, clazz) \
- native_pixbufdecoder_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_PB_PTR(env, obj) \
- cp_gtk_get_state (env, obj, native_pixbufdecoder_state_table)
-
-#define NSA_SET_PB_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, native_pixbufdecoder_state_table, (void *)ptr)
-
-#define NSA_DEL_PB_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, native_pixbufdecoder_state_table)
-
/* Union used for type punning. */
union env_union
{
@@ -201,7 +186,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initState
g_signal_connect (loader, "area-updated", G_CALLBACK (area_updated_cb), decoder);
g_signal_connect (loader, "closed", G_CALLBACK (closed_cb), decoder);
- NSA_SET_PB_PTR (env, obj, loader);
+ gtkpeer_set_pixbuf_loader (env, obj, loader);
}
static void
@@ -310,7 +295,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
query_formats (env, clazz);
- NSA_PB_INIT (env, clazz);
+ gtkpeer_init_pixbuf_IDs (env);
}
@@ -320,7 +305,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_finish
{
GdkPixbufLoader *loader = NULL;
- loader = (GdkPixbufLoader *)NSA_DEL_PB_PTR (env, obj);
+ loader = (GdkPixbufLoader *) gtkpeer_get_pixbuf_loader(env, obj);
if (loader == NULL)
return;
@@ -336,7 +321,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpDone
GError *err = NULL;
GdkPixbufLoader *loader = NULL;
- loader = (GdkPixbufLoader *)NSA_GET_PB_PTR (env, obj);
+ loader = (GdkPixbufLoader *) gtkpeer_get_pixbuf_loader (env, obj);
g_assert (loader != NULL);
gdk_pixbuf_loader_close (loader, &err);
@@ -470,7 +455,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpBytes
bytes = (*env)->GetByteArrayElements (env, jarr, NULL);
g_assert (bytes != NULL);
- loader = (GdkPixbufLoader *)NSA_GET_PB_PTR (env, obj);
+ loader = (GdkPixbufLoader *) gtkpeer_get_pixbuf_loader (env, obj);
g_assert (loader != NULL);
gdk_pixbuf_loader_write (loader, (const guchar *) bytes, len, &err);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
index 4053ad8b6f2..14ba2a123d6 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
@@ -54,13 +54,10 @@ struct state_table *cp_gtk_native_screen_state_table;
jclass gdkScreenGraphicsDevice_class;
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_initStaticState
-(JNIEnv *env, jclass klazz)
+Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_initIDs
+(JNIEnv *env, jclass klazz __attribute__((unused)))
{
- gdkScreenGraphicsDevice_class = (*env)->NewGlobalRef
- (env, klazz);
-
- NSA_SCREEN_INIT(env, gdkScreenGraphicsDevice_class);
+ gtkpeer_init_screen_IDs(env);
}
JNIEXPORT jobject JNICALL
@@ -75,7 +72,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetFixedDisplayMode
int temp1, temp2;
GdkDisplay *display;
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+ display = (GdkDisplay *) gtkpeer_get_display(env, gdkGraphicsEnv);
gdk_threads_enter();
@@ -87,7 +84,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetFixedDisplayMode
"<init>",
"(IIII)V");
- screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+ screen = (GdkScreen *) gtkpeer_get_screen(env, obj);
fixedDisplayMode = (*env)->NewObject(env,
displayMode_class,
@@ -108,7 +105,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetFixedDisplayMode
"<init>",
"(IIII)V");
- screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+ screen = (GdkScreen *) gtkpeer_get_screen(env, obj);
fixedDisplayMode = (*env)->NewObject(env,
displayMode_class,
@@ -130,7 +127,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetIDString
gchar* displayName;
jstring string;
- screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+ screen = (GdkScreen *) gtkpeer_get_screen(env, obj);
gdk_threads_enter();
@@ -155,7 +152,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModeRate
XRRScreenConfiguration *config;
int rate;
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+ display = (GdkDisplay *) gtkpeer_get_display(env, gdkGraphicsEnv);
gdk_threads_enter();
@@ -188,7 +185,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModeIndex
SizeID index;
Rotation rotation;
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+ display = (GdkDisplay *) gtkpeer_get_display(env, gdkGraphicsEnv);
gdk_threads_enter();
@@ -229,7 +226,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModes
short *rates;
jshortArray shortArray;
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+ display = (GdkDisplay *) gtkpeer_get_display(env, gdkGraphicsEnv);
gdk_threads_enter();
@@ -289,7 +286,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeSetDisplayMode
XRRScreenConfiguration *config;
Rotation rotation;
- display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
+ display = (GdkDisplay *) gtkpeer_get_display(env, gdkGraphicsEnv);
gdk_threads_enter();
@@ -335,7 +332,7 @@ Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetBounds
rectangle_ctor = (*env)->GetMethodID
(env, rectangle_class, "<init>", "(IIII)V");
- screen = (GdkScreen *) NSA_GET_SCREEN_PTR(env, obj);
+ screen = (GdkScreen *) gtkpeer_get_screen(env, obj);
gdk_threads_enter();
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
index 1099287e2ff..3e39b0ee29f 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
@@ -42,16 +42,15 @@ exception statement from your version. */
static jmethodID postActionEventID;
void
-cp_gtk_button_init_jni (void)
+cp_gtk_button_init_jni (JNIEnv* env)
{
jclass gtkbuttonpeer;
- gtkbuttonpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
- "gnu/java/awt/peer/gtk/GtkButtonPeer");
+ gtkbuttonpeer = (*env)->FindClass (env,
+ "gnu/java/awt/peer/gtk/GtkButtonPeer");
- postActionEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
- gtkbuttonpeer,
- "postActionEvent", "(I)V");
+ postActionEventID = (*env)->GetMethodID (cp_gtk_gdk_env(), gtkbuttonpeer,
+ "postActionEvent", "(I)V");
}
static void clicked_cb (GtkButton *button,
@@ -67,7 +66,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
c_label = (*env)->GetStringUTFChars (env, label, NULL);
@@ -77,7 +76,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
gtk_widget_show (button);
(*env)->ReleaseStringUTFChars (env, label, c_label);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -96,7 +95,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetGetPreferredDimensions
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
button = gtk_bin_get_child (GTK_BIN (ptr));
label = gtk_bin_get_child (GTK_BIN (button));
@@ -136,20 +135,20 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
(JNIEnv *env, jobject obj)
{
- void *ptr;
- jobject *gref;
+ GtkWidget *widget;
+ jobject gref;
GtkWidget *button;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ widget = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
- button = gtk_bin_get_child (GTK_BIN (ptr));
+ button = gtk_bin_get_child (GTK_BIN (widget));
/* Button signals */
g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (clicked_cb), *gref);
+ G_CALLBACK (clicked_cb), gref);
/* Component signals */
cp_gtk_component_connect_signals (G_OBJECT (button), gref);
@@ -168,7 +167,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = (*env)->GetStringUTFChars (env, jtext, NULL);
@@ -193,7 +192,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetModifyFont
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
font_name = (*env)->GetStringUTFChars (env, name, NULL);
@@ -234,7 +233,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetBackground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
normal_color.red = (red / 255.0) * 65535;
normal_color.green = (green / 255.0) * 65535;
@@ -275,7 +274,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetForeground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
color.red = (red / 255.0) * 65535;
color.green = (green / 255.0) * 65535;
@@ -300,7 +299,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkActivate
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
button = gtk_bin_get_child (GTK_BIN (ptr));
gtk_widget_activate (GTK_WIDGET (button));
@@ -317,7 +316,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetRequestFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
button = gtk_bin_get_child (GTK_BIN (ptr));
gtk_widget_grab_focus (button);
@@ -334,7 +333,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
widget = GTK_WIDGET (ptr);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
index ef9ac12076a..600b61a3332 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
@@ -48,11 +48,11 @@ Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
gdk_threads_enter ();
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
widget = gtk_drawing_area_new ();
- NSA_SET_PTR (env, obj, widget);
+ gtkpeer_set_widget (env, obj, widget);
gdk_threads_leave ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
index 77836cedd1e..a30eba4498e 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
@@ -48,7 +48,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
@@ -57,7 +57,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
(*env)->ReleaseStringUTFChars (env, label, str);
- NSA_SET_PTR (env, obj, widget);
+ gtkpeer_set_widget (env, obj, widget);
gdk_threads_leave ();
}
@@ -70,7 +70,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
index 9a6f713ba8a..96230aadf07 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
@@ -69,18 +69,18 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
GtkWidget *bin;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
bin = checkbox_get_widget (GTK_WIDGET (ptr));
/* Checkbox signals */
g_signal_connect (G_OBJECT (bin), "toggled",
- G_CALLBACK (item_toggled_cb), *gref);
+ G_CALLBACK (item_toggled_cb), gref);
/* Component signals */
cp_gtk_component_connect_signals (G_OBJECT (bin), gref);
@@ -97,7 +97,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkToggleButtonSetActive
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = checkbox_get_widget (GTK_WIDGET (ptr));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bin), is_active);
@@ -117,7 +117,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
button = checkbox_get_widget (GTK_WIDGET (ptr));
label = gtk_bin_get_child (GTK_BIN(button));
@@ -156,7 +156,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
c_label = (*env)->GetStringUTFChars (env, label, NULL);
@@ -182,14 +182,14 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createCheckButton
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
eventbox = gtk_event_box_new ();
button = gtk_check_button_new_with_label ("");
gtk_container_add (GTK_CONTAINER (eventbox), button);
gtk_widget_show (button);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -210,7 +210,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
eventbox = gtk_event_box_new ();
if (groupPointer != 0)
@@ -231,7 +231,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton
gtk_container_add (GTK_CONTAINER (eventbox), button);
gtk_widget_show (button);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), obj,
addToGroupMapID,
@@ -258,7 +258,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addToGroup
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
container = GTK_WIDGET (ptr);
check_button = checkbox_get_widget (container);
label = gtk_label_get_text (GTK_LABEL (gtk_bin_get_child
@@ -312,7 +312,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
container = GTK_WIDGET (ptr);
radio_button = checkbox_get_widget (container);
label = gtk_label_get_text (GTK_LABEL (gtk_bin_get_child
@@ -357,7 +357,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
radio_button = checkbox_get_widget (GTK_WIDGET (ptr));
native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
index ac4df69f457..6f3d9c0e19b 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
@@ -63,19 +63,17 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create
{
GtkWidget *combobox;
GtkWidget *eventbox;
- jobject *gref;
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
eventbox = gtk_event_box_new ();
combobox = gtk_combo_box_new_text ();
gtk_container_add (GTK_CONTAINER (eventbox), combobox);
gtk_widget_show (combobox);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -85,19 +83,19 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr = NULL;
- jobject *gref = NULL;
+ jobject gref;
GtkWidget *bin;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
/* Choice signals */
g_signal_connect (G_OBJECT (bin), "changed",
- G_CALLBACK (selection_changed_cb), *gref);
+ G_CALLBACK (selection_changed_cb), gref);
/* Component signals */
cp_gtk_component_connect_signals (G_OBJECT (bin), gref);
@@ -115,7 +113,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_add
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
label = (*env)->GetStringUTFChars (env, item, 0);
@@ -136,7 +134,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemove
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
/* First, unselect everything, to avoid problems when removing items. */
@@ -157,7 +155,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemoveAll
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (bin));
@@ -192,7 +190,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNativeUnlocked
void *ptr;
GtkWidget *bin;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
gtk_combo_box_set_active (GTK_COMBO_BOX (bin), (gint)index);
}
@@ -207,7 +205,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeGetSelected
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
index = gtk_combo_box_get_active (GTK_COMBO_BOX (bin));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
index 7ce1185a46d..0b076f864e3 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
@@ -193,6 +193,7 @@ clipboard_get_func (GtkClipboard *clipboard,
gtk_clipboard_instance,
provideContentID,
target_string);
+ (*env)->DeleteLocalRef(env, target_string);
if (bytes == NULL)
return;
len = (*env)->GetArrayLength(env, bytes);
@@ -273,9 +274,13 @@ clipboard_get_func (GtkClipboard *clipboard,
break;
text = (*env)->GetStringUTFChars (env, uri, NULL);
if (text == NULL)
- break;
+ {
+ (*env)->DeleteLocalRef(env, uri);
+ break;
+ }
list[i] = strdup (text);
(*env)->ReleaseStringUTFChars (env, uri, text);
+ (*env)->DeleteLocalRef(env, uri);
}
if (i == count)
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index d2025bb701f..8dbf25a5ae7 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -208,7 +208,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
GdkCursorType gdk_cursor_type;
GdkCursor *gdk_cursor;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
switch (type)
{
@@ -287,8 +287,8 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- parent_ptr = NSA_GET_PTR (env, parent);
+ ptr = gtkpeer_get_widget (env, obj);
+ parent_ptr = gtkpeer_get_widget (env, parent);
widget = GTK_WIDGET (ptr);
parent_widget = get_widget(GTK_WIDGET (parent_ptr));
@@ -332,7 +332,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetSensitive
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_widget_set_sensitive (get_widget(GTK_WIDGET (ptr)), sensitive);
@@ -348,7 +348,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetHasFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
retval = GTK_WIDGET_HAS_FOCUS((GTK_WIDGET (ptr)));
@@ -366,7 +366,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetCanFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
retval = GTK_WIDGET_CAN_FOCUS((GTK_WIDGET (ptr)));
@@ -383,7 +383,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetRequestFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_widget_grab_focus (get_widget(GTK_WIDGET (ptr)));
@@ -407,7 +407,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetDispatchKeyEvent
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (id == AWT_KEY_PRESSED)
event = gdk_event_new (GDK_KEY_PRESS);
@@ -522,7 +522,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
point = (*env)->GetIntArrayElements (env, jpoint, 0);
gdk_window_get_root_origin (get_widget(GTK_WIDGET (ptr))->window, point, point+1);
@@ -545,7 +545,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
point = (*env)->GetIntArrayElements (env, jpoint, 0);
widget = get_widget(GTK_WIDGET (ptr));
@@ -574,7 +574,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
dims = (*env)->GetIntArrayElements (env, jdims, 0);
dims[0] = dims[1] = 0;
@@ -603,7 +603,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
dims = (*env)->GetIntArrayElements (env, jdims, 0);
dims[0] = dims[1] = 0;
@@ -650,7 +650,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
widget = GTK_WIDGET (ptr);
@@ -685,7 +685,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL];
@@ -714,7 +714,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
fg = get_widget(GTK_WIDGET (ptr))->style->fg[GTK_STATE_NORMAL];
@@ -743,7 +743,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetBackground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
normal_color.red = (red / 255.0) * 65535;
normal_color.green = (green / 255.0) * 65535;
@@ -774,7 +774,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetForeground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
color.red = (red / 255.0) * 65535;
color.green = (green / 255.0) * 65535;
@@ -796,7 +796,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_realize (JNIEnv *env, jobject obj)
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_widget_realize (GTK_WIDGET (ptr));
@@ -821,7 +821,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNativeUnlocked
{
void *ptr;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (visible)
gtk_widget_show (GTK_WIDGET (ptr));
@@ -838,7 +838,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
ret_val = GTK_WIDGET_IS_SENSITIVE (get_widget(GTK_WIDGET (ptr)));
@@ -869,12 +869,12 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
cp_gtk_component_connect_signals (ptr, gref);
@@ -889,7 +889,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeEventMask
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_widget_add_events (get_widget(GTK_WIDGET (ptr)),
GDK_POINTER_MOTION_MASK
@@ -948,46 +948,46 @@ find_bg_color_widget (GtkWidget *widget)
}
void
-cp_gtk_component_connect_expose_signals (GObject *ptr, jobject *gref)
+cp_gtk_component_connect_expose_signals (GObject *ptr, jobject gref)
{
g_signal_connect (G_OBJECT (ptr), "expose-event",
- G_CALLBACK (component_expose_cb), *gref);
+ G_CALLBACK (component_expose_cb), gref);
}
void
-cp_gtk_component_connect_focus_signals (GObject *ptr, jobject *gref)
+cp_gtk_component_connect_focus_signals (GObject *ptr, jobject gref)
{
g_signal_connect (G_OBJECT (ptr), "focus-in-event",
- G_CALLBACK (component_focus_in_cb), *gref);
+ G_CALLBACK (component_focus_in_cb), gref);
g_signal_connect (G_OBJECT (ptr), "focus-out-event",
- G_CALLBACK (component_focus_out_cb), *gref);
+ G_CALLBACK (component_focus_out_cb), gref);
}
void
-cp_gtk_component_connect_mouse_signals (GObject *ptr, jobject *gref)
+cp_gtk_component_connect_mouse_signals (GObject *ptr, jobject gref)
{
g_signal_connect (G_OBJECT (ptr), "button-press-event",
- G_CALLBACK (component_button_press_cb), *gref);
+ G_CALLBACK (component_button_press_cb), gref);
g_signal_connect (G_OBJECT (ptr), "button-release-event",
- G_CALLBACK (component_button_release_cb), *gref);
+ G_CALLBACK (component_button_release_cb), gref);
g_signal_connect (G_OBJECT (ptr), "enter-notify-event",
- G_CALLBACK (component_enter_notify_cb), *gref);
+ G_CALLBACK (component_enter_notify_cb), gref);
g_signal_connect (G_OBJECT (ptr), "leave-notify-event",
- G_CALLBACK (component_leave_notify_cb), *gref);
+ G_CALLBACK (component_leave_notify_cb), gref);
g_signal_connect (G_OBJECT (ptr), "motion-notify-event",
- G_CALLBACK (component_motion_notify_cb), *gref);
+ G_CALLBACK (component_motion_notify_cb), gref);
g_signal_connect (G_OBJECT (ptr), "scroll-event",
- G_CALLBACK (component_scroll_cb), *gref);
+ G_CALLBACK (component_scroll_cb), gref);
}
void
-cp_gtk_component_connect_signals (GObject *ptr, jobject *gref)
+cp_gtk_component_connect_signals (GObject *ptr, jobject gref)
{
cp_gtk_component_connect_expose_signals (ptr, gref);
cp_gtk_component_connect_focus_signals (ptr, gref);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
index ca765c15c7b..fabadc8ca1c 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
@@ -49,7 +49,7 @@ Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
window = gtk_plug_new ((GdkNativeWindow) socket_id);
@@ -60,7 +60,7 @@ Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
gtk_widget_show (fixed);
- NSA_SET_PTR (env, obj, window);
+ gtkpeer_set_widget (env, obj, window);
gdk_threads_leave ();
}
@@ -73,7 +73,7 @@ Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_construct
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (GTK_WIDGET_REALIZED (GTK_WIDGET (ptr)))
g_printerr ("ERROR: GtkPlug is already realized\n");
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
index b9fd54abbcd..10f512f298b 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
@@ -90,7 +90,7 @@ cp_gtk_filedialog_init_jni (void)
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
- (JNIEnv *env, jobject obj, jobject parent, int mode)
+ (JNIEnv *env, jobject obj, jobject parent, jint mode)
{
void *parentp;
gpointer widget;
@@ -98,9 +98,9 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
gdk_threads_enter ();
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
- parentp = NSA_GET_PTR(env, parent);
+ parentp = gtkpeer_get_widget(env, parent);
if (mode == AWT_FILEDIALOG_LOAD)
widget = gtk_file_chooser_dialog_new
@@ -134,7 +134,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
gtk_window_group_add_window (cp_gtk_global_window_group,
GTK_WINDOW (widget));
- NSA_SET_PTR (env, obj, widget);
+ gtkpeer_set_widget (env, obj, widget);
gdk_threads_leave ();
}
@@ -144,16 +144,16 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr = NULL;
- jobject *gref = NULL;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
/* FileDialog signals */
g_signal_connect (G_OBJECT (ptr), "response",
- G_CALLBACK (handle_response_cb), *gref);
+ G_CALLBACK (handle_response_cb), gref);
/* Component signals */
cp_gtk_component_connect_signals (G_OBJECT (ptr), gref);
@@ -170,7 +170,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeGetDirectory
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(ptr));
@@ -208,7 +208,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
filter = gtk_file_filter_new();
gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_FILENAME,
@@ -228,7 +228,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetDirectory
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, directory, 0);
@@ -248,7 +248,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, filename, 0);
@@ -275,7 +275,7 @@ handle_response_cb (GtkDialog *dialog __attribute__((unused)),
&& responseId != GTK_RESPONSE_CANCEL)
return;
- ptr = NSA_GET_PTR (cp_gtk_gdk_env(), peer_obj);
+ ptr = gtkpeer_get_widget (cp_gtk_gdk_env(), peer_obj);
if (responseId == GTK_RESPONSE_DELETE_EVENT)
{
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
index 144ca0e8a95..ef7df0f0342 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
@@ -49,7 +49,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
children = gtk_container_get_children (GTK_CONTAINER (fixed));
@@ -84,11 +84,11 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (menubar)
{
- mptr = NSA_GET_PTR (env, menubar);
+ mptr = gtkpeer_get_widget (env, menubar);
fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
@@ -107,7 +107,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, menubar);
+ ptr = gtkpeer_get_widget (env, menubar);
gtk_widget_size_request (ptr, &requisition);
@@ -137,7 +137,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
if (menubar)
{
- ptr = NSA_GET_PTR (env, menubar);
+ ptr = gtkpeer_get_widget (env, menubar);
/* Get the menubar's natural size request. */
gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
@@ -158,7 +158,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
@@ -182,7 +182,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImage
pixbuf = cp_gtk_image_get_pixbuf (env, gtkimage);
g_assert (pixbuf != NULL);
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
@@ -195,7 +195,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_maximize
{
void *ptr;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_maximize (GTK_WINDOW (ptr));
gdk_threads_leave ();
}
@@ -206,7 +206,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_unmaximize
{
void *ptr;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_unmaximize (GTK_WINDOW (ptr));
gdk_threads_leave ();
}
@@ -217,7 +217,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_iconify
{
void *ptr;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_iconify (GTK_WINDOW (ptr));
gdk_threads_leave ();
}
@@ -228,7 +228,7 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_deiconify
{
void *ptr;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_deiconify (GTK_WINDOW (ptr));
gdk_threads_leave ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
index c8fb53040e8..e0ba508499b 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
@@ -40,6 +40,13 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkGenericPeer.h"
JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkGenericPeer_initIDs
+(JNIEnv *env, jclass clz __attribute__((unused)))
+{
+ gtkpeer_init_widget_IDs(env);
+}
+
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
(JNIEnv *env, jobject obj)
{
@@ -47,15 +54,14 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
/* For now the native state for any object must be a widget.
However, a subclass could override dispose() if required. */
gtk_widget_destroy (GTK_WIDGET (ptr));
- /* Remove entries from state tables */
- NSA_DEL_GLOBAL_REF (env, obj);
- NSA_DEL_PTR (env, obj);
+ /* Delete global reference. */
+ gtkpeer_del_global_ref(env, obj);
gdk_threads_leave ();
}
@@ -70,7 +76,7 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPeer_gtkWidgetModifyFont
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
font_name = (*env)->GetStringUTFChars (env, name, NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
index 13473a9a8db..3703858fe00 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
@@ -49,7 +49,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
str = (*env)->GetStringUTFChars (env, text, 0);
@@ -61,7 +61,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
(*env)->ReleaseStringUTFChars (env, text, str);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -78,7 +78,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetGetPreferredDimensions
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
label = gtk_bin_get_child (GTK_BIN (ptr));
@@ -115,7 +115,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
font_name = (*env)->GetStringUTFChars (env, name, NULL);
@@ -156,7 +156,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeText
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, text, 0);
@@ -178,7 +178,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_nativeSetAlignment
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
label = gtk_bin_get_child (GTK_BIN(ptr));
@@ -196,7 +196,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
widget = GTK_WIDGET (ptr);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
index 54ef31a4fed..4b7b63e6df8 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
@@ -84,7 +84,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_create
gdk_threads_enter ();
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
/* Add the number of rows so that we can calculate the tree view's
@@ -127,7 +127,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_create
gtk_widget_show (list);
gtk_widget_show (sw);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -137,20 +137,20 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
GtkWidget *list;
GtkTreeSelection *selection;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
gtk_tree_selection_set_select_function (selection, item_highlighted_cb,
- *gref, NULL);
+ gref, NULL);
cp_gtk_component_connect_signals (G_OBJECT (list), gref);
@@ -168,7 +168,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetModifyFont
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
@@ -202,7 +202,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetRequestFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
gtk_widget_grab_focus (list);
@@ -223,7 +223,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_append
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
count = (*env)->GetArrayLength (env, items);
@@ -261,7 +261,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_add
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, text, NULL);
list = list_get_widget (GTK_WIDGET (ptr));
@@ -294,7 +294,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (list));
@@ -327,7 +327,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_select
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
path = gtk_tree_path_new_from_indices (index, -1);
@@ -347,7 +347,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
@@ -372,7 +372,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize
dims = (*env)->GetIntArrayElements (env, jdims, NULL);
dims[0] = dims[1] = 0;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = list_get_widget (GTK_WIDGET (ptr));
/* Save the widget's current size request. */
@@ -421,7 +421,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
@@ -467,7 +467,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
path = gtk_tree_path_new_from_indices (index, -1);
@@ -487,7 +487,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_setMultipleMode
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = list_get_widget (GTK_WIDGET (ptr));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
index 1a21126a81a..ac3fab78be0 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
@@ -47,12 +47,12 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
widget = gtk_menu_bar_new ();
gtk_widget_show (widget);
- NSA_SET_PTR (env, obj, widget);
+ gtkpeer_set_widget (env, obj, widget);
gdk_threads_leave ();
}
@@ -65,8 +65,8 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
gdk_threads_enter ();
- mbar = NSA_GET_PTR (env, obj);
- menu = NSA_GET_PTR (env, menupeer);
+ mbar = gtkpeer_get_widget (env, obj);
+ menu = gtkpeer_get_widget (env, menupeer);
gtk_menu_shell_append (GTK_MENU_SHELL (mbar), GTK_WIDGET (menu));
@@ -82,7 +82,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
list = gtk_container_get_children (GTK_CONTAINER (ptr));
list = g_list_nth (list, index);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c
index 01b74e46c57..6da949488be 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c
@@ -51,6 +51,5 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose
/* However, references to the Java objects still exist in the
state tables, so we still have to remove those. */
- NSA_DEL_GLOBAL_REF (env, obj);
- NSA_DEL_PTR (env, obj);
+ gtkpeer_del_global_ref (env, obj);
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
index d2ae148a9a4..96543554580 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
@@ -68,7 +68,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
@@ -82,7 +82,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
(*env)->ReleaseStringUTFChars (env, label, str);
- NSA_SET_PTR (env, obj, widget);
+ gtkpeer_set_widget (env, obj, widget);
gdk_threads_leave ();
}
@@ -92,15 +92,15 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
g_signal_connect (G_OBJECT (ptr), "activate",
- G_CALLBACK (item_activate_cb), *gref);
+ G_CALLBACK (item_activate_cb), gref);
gdk_threads_leave ();
}
@@ -116,7 +116,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_gtkWidgetModifyFont
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
font_name = (*env)->GetStringUTFChars (env, name, NULL);
@@ -152,7 +152,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_widget_set_sensitive (GTK_WIDGET (ptr), enabled);
@@ -169,7 +169,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
index c23fc5bd6a4..1081de2530f 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
@@ -47,7 +47,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
gdk_threads_enter ();
- ptr1 = NSA_GET_PTR (env, obj);
+ ptr1 = gtkpeer_get_widget (env, obj);
if (!parent)
{
@@ -58,7 +58,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
{
GtkAccelGroup *parent_accel;
- ptr2 = NSA_GET_PTR (env, parent);
+ ptr2 = gtkpeer_get_widget (env, parent);
parent_accel = gtk_menu_get_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr2)->submenu));
gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
@@ -78,7 +78,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
@@ -101,7 +101,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
gtk_widget_show (menu_title);
- NSA_SET_PTR (env, obj, menu_title);
+ gtkpeer_set_widget (env, obj, menu_title);
(*env)->ReleaseStringUTFChars (env, label, str);
@@ -117,7 +117,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addTearOff
gdk_threads_enter ();
- ptr1 = NSA_GET_PTR (env, obj);
+ ptr1 = gtkpeer_get_widget (env, obj);
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (ptr1));
item = gtk_tearoff_menu_item_new ();
@@ -136,8 +136,8 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
gdk_threads_enter ();
- ptr1 = NSA_GET_PTR (env, obj);
- ptr2 = NSA_GET_PTR (env, menuitempeer);
+ ptr1 = gtkpeer_get_widget (env, obj);
+ ptr2 = gtkpeer_get_widget (env, menuitempeer);
menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(ptr1));
gtk_menu_shell_append (GTK_MENU_SHELL(menu), GTK_WIDGET (ptr2));
@@ -164,7 +164,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(ptr));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
index 8a130e1a4b3..e52e6de5133 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
@@ -55,7 +55,7 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
widget = gtk_fixed_new ();
@@ -63,7 +63,7 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
- NSA_SET_PTR (env, obj, widget);
+ gtkpeer_set_widget (env, obj, widget);
gdk_threads_leave ();
}
@@ -73,20 +73,20 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
/* Panel signals. These callbacks prevent expose events being
delivered to the panel when it is focused. */
g_signal_connect (G_OBJECT (ptr), "focus-in-event",
- G_CALLBACK (panel_focus_in_cb), *gref);
+ G_CALLBACK (panel_focus_in_cb), gref);
g_signal_connect (G_OBJECT (ptr), "focus-out-event",
- G_CALLBACK (panel_focus_out_cb), *gref);
+ G_CALLBACK (panel_focus_out_cb), gref);
/* Component signals. Exclude focus signals. */
cp_gtk_component_connect_expose_signals (ptr, gref);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
index e684a090f8f..b7b1c3322d1 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
@@ -67,7 +67,7 @@ Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
p = g_malloc (sizeof (struct pos));
p->x = x;
@@ -90,8 +90,8 @@ Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_setupAccelGroup
gdk_threads_enter ();
- ptr1 = NSA_GET_PTR (env, obj);
- ptr2 = NSA_GET_PTR (env, parent);
+ ptr1 = gtkpeer_get_widget (env, obj);
+ ptr2 = gtkpeer_get_widget (env, parent);
menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
gtk_menu_set_accel_group (menu, gtk_accel_group_new ());
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
index a4690deeda3..0d67b0b787e 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
@@ -55,7 +55,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create
gdk_threads_enter ();
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_size_request (sw, width, height);
@@ -63,7 +63,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create
gtk_container_add (GTK_CONTAINER (eventbox), sw);
gtk_widget_show (sw);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -78,7 +78,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setScrollPosition
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
@@ -101,7 +101,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetHScrollIncremen
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
@@ -121,7 +121,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetVScrollIncremen
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
@@ -143,7 +143,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getHScrollbarHeight
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
@@ -168,7 +168,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getVScrollbarWidth
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
sw = GTK_SCROLLED_WINDOW (scrollpane_get_widget (GTK_WIDGET (ptr)));
@@ -190,7 +190,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setPolicy
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
switch (policy)
{
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
index a90501968b6..64d91d2b276 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollbarPeer.c
@@ -84,7 +84,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
GtkObject *adj;
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
gdk_threads_enter ();
@@ -119,16 +119,16 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
gdk_threads_leave ();
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
(JNIEnv *env, jobject obj)
{
- void *ptr = NSA_GET_PTR (env, obj);
+ void *ptr = gtkpeer_get_widget (env, obj);
GtkWidget *wid = scrollbar_get_widget (GTK_WIDGET (ptr));
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
+ jobject gref = gtkpeer_get_global_ref (env, obj);
g_assert (gref);
gdk_threads_enter ();
@@ -136,10 +136,10 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
/* Scrollbar signals */
#if GTK_MINOR_VERSION > 4
g_signal_connect (G_OBJECT (wid), "change-value",
- G_CALLBACK (slider_moved_cb), *gref);
+ G_CALLBACK (slider_moved_cb), gref);
#else
g_signal_connect (G_OBJECT (wid), "value-changed",
- G_CALLBACK (post_change_event_cb), *gref);
+ G_CALLBACK (post_change_event_cb), gref);
#endif
/* Component signals */
@@ -156,7 +156,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
GtkAdjustment *adj;
GtkWidget *wid;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
wid = scrollbar_get_widget (GTK_WIDGET (ptr));
gdk_threads_enter ();
@@ -176,7 +176,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
GtkAdjustment *adj;
GtkWidget *wid;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
wid = scrollbar_get_widget (GTK_WIDGET (ptr));
gdk_threads_enter ();
@@ -196,7 +196,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setBarValues
GtkAdjustment *adj;
GtkWidget *wid;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
wid = scrollbar_get_widget (GTK_WIDGET (ptr));
gdk_threads_enter ();
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
index be03c45254e..e5ba4c7b114 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
@@ -105,6 +105,8 @@ clipboard_targets_received (GtkClipboard *clipboard
stringClass = (*env)->FindClass (env, "java/lang/String");
strings = (*env)->NewObjectArray (env, strings_len, stringClass,
NULL);
+ (*env)->DeleteLocalRef(env, stringClass);
+
if (strings != NULL)
{
if (include_text)
@@ -133,6 +135,8 @@ clipboard_targets_received (GtkClipboard *clipboard
(*env)->DeleteLocalRef (env, string);
}
}
+
+ (*env)->DeleteLocalRef(env, strings);
}
for (i = 0; i < targets_len; i++)
@@ -341,6 +345,8 @@ clipboard_uris_received (GtkClipboard *clipboard
len++;
strings = (*env)->NewObjectArray (env, len, stringClass, NULL);
+ (*env)->DeleteLocalRef(env, stringClass);
+
if (strings != NULL)
{
for (i = 0; i < len; i++)
@@ -351,6 +357,8 @@ clipboard_uris_received (GtkClipboard *clipboard
(*env)->SetObjectArrayElement (env, strings, i, string);
(*env)->DeleteLocalRef (env, string);
}
+
+ (*env)->DeleteLocalRef(env, strings);
}
g_strfreev (uris);
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
index bd6e14d7650..4d768fa3302 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
@@ -57,7 +57,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
gdk_threads_enter ();
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
text = gtk_text_view_new ();
gtk_widget_set_size_request (text, textview_width, textview_height);
@@ -86,7 +86,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
|| scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY)
? GTK_WRAP_NONE : GTK_WRAP_WORD);
- NSA_SET_PTR (env, obj, eventbox);
+ gtkpeer_set_widget (env, obj, eventbox);
gdk_threads_leave ();
}
@@ -98,12 +98,12 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_connectSignals
GtkWidget *text = NULL;
GtkTextBuffer *buf;
void *ptr;
- jobject *gref;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
/* Unwrap the text view from the scrolled window */
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -131,7 +131,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, contents, NULL);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -159,7 +159,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, contents, NULL);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -189,7 +189,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetModifyFont
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -223,7 +223,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetRequestFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -245,7 +245,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getHScrollbarHeight
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = gtk_bin_get_child (GTK_BIN (ptr));
sw = GTK_SCROLLED_WINDOW (bin);
@@ -275,7 +275,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getVScrollbarWidth
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
bin = gtk_bin_get_child (GTK_BIN (ptr));
sw = GTK_SCROLLED_WINDOW (bin);
@@ -305,7 +305,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getCaretPosition
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -333,7 +333,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_setCaretPosition
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -375,7 +375,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getSelectionStart
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -412,7 +412,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getSelectionEnd
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -445,7 +445,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_select
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -469,7 +469,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_setEditable
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -491,7 +491,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getText
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
@@ -519,7 +519,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_setText
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, contents, NULL);
text = textarea_get_widget (GTK_WIDGET (ptr));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
index 30b4a0fdac1..df82ff091b5 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
@@ -73,13 +73,13 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create
gdk_threads_enter ();
/* Create global reference and save it for future use */
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
entry = gtk_entry_new ();
gtk_widget_set_size_request (entry,
text_width + 2 * get_border_width (entry), -1);
- NSA_SET_PTR (env, obj, entry);
+ gtkpeer_set_widget (env, obj, entry);
gdk_threads_leave ();
}
@@ -89,12 +89,12 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = gtkpeer_get_global_ref (env, obj);
/* TextComponent signals */
cp_gtk_textcomponent_connect_signals (G_OBJECT (ptr), gref);
@@ -114,7 +114,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetSetBackground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
color.red = (red / 255.0) * 65535;
color.green = (green / 255.0) * 65535;
@@ -134,7 +134,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetSetForeground
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
color.red = (red / 255.0) * 65535;
color.green = (green / 255.0) * 65535;
@@ -162,7 +162,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetBorderWidth
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
border_width = get_border_width (GTK_WIDGET (ptr));
@@ -207,7 +207,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
entry = GTK_ENTRY (ptr);
@@ -233,7 +233,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getCaretPosition
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
pos = gtk_editable_get_position (GTK_EDITABLE (ptr));
@@ -250,7 +250,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setCaretPosition
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_editable_set_position (GTK_EDITABLE (ptr), pos);
@@ -267,7 +267,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getSelectionStart
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (ptr), &starti, &endi))
pos = starti;
@@ -289,7 +289,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getSelectionEnd
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (ptr), &starti, &endi))
pos = endi;
@@ -309,7 +309,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_select
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_editable_select_region (GTK_EDITABLE (ptr), start, end);
@@ -324,7 +324,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEditable
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_editable_set_editable (GTK_EDITABLE (ptr), state);
@@ -341,7 +341,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_getText
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
contents = gtk_editable_get_chars (GTK_EDITABLE (ptr), 0, -1);
@@ -363,7 +363,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setText
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
str = (*env)->GetStringUTFChars (env, contents, NULL);
gtk_entry_set_text (GTK_ENTRY (ptr), str);
@@ -374,10 +374,10 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setText
}
void
-cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject *gref)
+cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject gref)
{
g_signal_connect (G_OBJECT(ptr), "changed",
- G_CALLBACK (textcomponent_changed_cb), *gref);
+ G_CALLBACK (textcomponent_changed_cb), gref);
}
static void
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
index d2a4b0e4222..1186f659c15 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
@@ -79,9 +79,6 @@ exception statement from your version. */
#define VK_CAPS_LOCK 20
#define VK_META 157
-struct state_table *cp_gtk_native_state_table;
-struct state_table *cp_gtk_native_global_ref_table;
-
static jclass gtkgenericpeer;
static jclass gtktoolkit;
static JavaVM *java_vm;
@@ -129,6 +126,13 @@ static void glog_func (const gchar *log_domain,
gpointer user_data);
#endif
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkToolkit_initIDs
+(JNIEnv *env, jclass cls __attribute__((unused)))
+{
+ gtkpeer_init_pointer_IDs(env);
+}
+
/*
* Call gtk_init. It is very important that this happen before any other
* gtk calls.
@@ -158,8 +162,6 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
printCurrentThreadID = (*env)->GetStaticMethodID (env, gtkgenericpeer,
"printCurrentThread", "()V");
- NSA_INIT (env, gtkgenericpeer);
-
g_assert((*env)->GetJavaVM(env, &java_vm) == 0);
/* GTK requires a program's argc and argv variables, and requires that they
@@ -203,7 +205,7 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
old_glog_func = g_log_set_default_handler (&glog_func, NULL);
#endif
- cp_gtk_button_init_jni ();
+ cp_gtk_button_init_jni (env);
cp_gtk_checkbox_init_jni ();
cp_gtk_choice_init_jni ();
cp_gtk_component_init_jni ();
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
index 3fb5331a23e..e3edf1fb542 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
@@ -65,7 +65,7 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_init (JNIEnv *env,
if( peer != NULL )
{
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
g_assert (ptr != NULL);
widget = GTK_WIDGET (ptr);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index aa70b9d2dca..6ba8d476758 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -1167,7 +1167,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
+ gtkpeer_set_global_ref (env, obj);
window_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = GTK_WINDOW (window_widget);
@@ -1175,7 +1175,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
/* Keep this window in front of its parent, if it has one. */
if (parent)
{
- window_parent = NSA_GET_PTR (env, parent);
+ window_parent = gtkpeer_get_widget (env, parent);
gtk_window_set_transient_for (window, GTK_WINDOW(window_parent));
}
@@ -1191,7 +1191,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
gtk_widget_show (fixed);
- NSA_SET_PTR (env, obj, window_widget);
+ gtkpeer_set_widget (env, obj, window_widget);
gdk_threads_leave ();
}
@@ -1205,7 +1205,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetTitle
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
c_title = (*env)->GetStringUTFChars (env, title, NULL);
@@ -1224,7 +1224,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_set_resizable (GTK_WINDOW (ptr), resizable);
g_object_set (G_OBJECT (ptr), "allow-shrink", resizable, NULL);
@@ -1239,7 +1239,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetModal
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_set_modal (GTK_WINDOW (ptr), modal);
@@ -1254,7 +1254,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetAlwaysOnTop
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_set_keep_above (GTK_WINDOW (ptr), alwaysOnTop);
@@ -1270,7 +1270,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowHasFocus
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
retval = gtk_window_has_toplevel_focus (GTK_WINDOW (ptr));
@@ -1298,7 +1298,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNativeUnlocked
{
void *ptr;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
if (visible)
gtk_widget_show (GTK_WIDGET (ptr));
@@ -1311,48 +1311,48 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
- jobject *gref;
+ jobject gref;
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
+ gref = (jobject) gtkpeer_get_global_ref (env, obj);
g_signal_connect (G_OBJECT (ptr), "delete-event",
- G_CALLBACK (window_delete_cb), *gref);
+ G_CALLBACK (window_delete_cb), gref);
g_signal_connect (G_OBJECT (ptr), "destroy-event",
- G_CALLBACK (window_destroy_cb), *gref);
+ G_CALLBACK (window_destroy_cb), gref);
g_signal_connect (G_OBJECT (ptr), "notify::has-toplevel-focus",
- G_CALLBACK (window_focus_state_change_cb), *gref);
+ G_CALLBACK (window_focus_state_change_cb), gref);
g_signal_connect (G_OBJECT (ptr), "focus-in-event",
- G_CALLBACK (window_focus_in_cb), *gref);
+ G_CALLBACK (window_focus_in_cb), gref);
g_signal_connect (G_OBJECT (ptr), "focus-out-event",
- G_CALLBACK (window_focus_out_cb), *gref);
+ G_CALLBACK (window_focus_out_cb), gref);
g_signal_connect (G_OBJECT (ptr), "window-state-event",
- G_CALLBACK (window_window_state_cb), *gref);
+ G_CALLBACK (window_window_state_cb), gref);
g_signal_connect (G_OBJECT (ptr), "property-notify-event",
- G_CALLBACK (window_property_changed_cb), *gref);
+ G_CALLBACK (window_property_changed_cb), gref);
g_signal_connect_after (G_OBJECT (ptr), "realize",
- G_CALLBACK (realize_cb), *gref);
+ G_CALLBACK (realize_cb), gref);
g_signal_connect (G_OBJECT (ptr), "key-press-event",
- G_CALLBACK (key_press_cb), *gref);
+ G_CALLBACK (key_press_cb), gref);
g_signal_connect (G_OBJECT (ptr), "key-release-event",
- G_CALLBACK (key_release_cb), *gref);
+ G_CALLBACK (key_release_cb), gref);
g_signal_connect_after (G_OBJECT (ptr), "window-state-event",
- G_CALLBACK (window_window_state_cb), *gref);
+ G_CALLBACK (window_window_state_cb), gref);
g_signal_connect (G_OBJECT (ptr), "configure-event",
- G_CALLBACK (window_configure_cb), *gref);
+ G_CALLBACK (window_configure_cb), gref);
cp_gtk_component_connect_expose_signals (ptr, gref);
cp_gtk_component_connect_mouse_signals (ptr, gref);
@@ -1372,7 +1372,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_realize (JNIEnv *env, jobject obj)
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_widget_realize (GTK_WIDGET (ptr));
@@ -1387,7 +1387,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gdk_window_lower (GTK_WIDGET (ptr)->window);
gdk_flush ();
@@ -1403,7 +1403,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gdk_window_raise (GTK_WIDGET (ptr)->window);
gdk_flush ();
@@ -1419,7 +1419,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setSize
gdk_threads_enter ();
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
/* Avoid GTK runtime assertion failures. */
width = (width < 1) ? 1 : width;
@@ -1448,7 +1448,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetLocationUnlocked
{
void *ptr;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
gtk_window_move (GTK_WINDOW(ptr), x, y);
@@ -1476,7 +1476,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
gint current_width;
gint current_height;
- ptr = NSA_GET_PTR (env, obj);
+ ptr = gtkpeer_get_widget (env, obj);
/* Avoid GTK runtime assertion failures. */
width = (width < 1) ? 1 : width;
diff --git a/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c b/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c
index 2348a63fb04..72130376f15 100644
--- a/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c
+++ b/libjava/classpath/native/jni/gtk-peer/gtk_jawt.c
@@ -69,7 +69,7 @@ classpath_jawt_get_default_display (JNIEnv* env, jobject canvas)
peer = (*env)->CallObjectMethod (env, canvas, method_id);
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
widget = GTK_WIDGET (ptr);
@@ -105,7 +105,7 @@ classpath_jawt_get_visualID (JNIEnv* env, jobject canvas)
peer = (*env)->CallObjectMethod (env, canvas, method_id);
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
widget = GTK_WIDGET (ptr);
@@ -140,7 +140,7 @@ classpath_jawt_get_depth (JNIEnv* env, jobject canvas)
peer = (*env)->CallObjectMethod (env, canvas, method_id);
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
widget = GTK_WIDGET (ptr);
@@ -175,7 +175,7 @@ classpath_jawt_get_drawable (JNIEnv* env, jobject canvas)
peer = (*env)->CallObjectMethod (env, canvas, method_id);
- ptr = NSA_GET_PTR (env, peer);
+ ptr = gtkpeer_get_widget (env, peer);
widget = GTK_WIDGET (ptr);
diff --git a/libjava/classpath/native/jni/gtk-peer/gtkpeer.c b/libjava/classpath/native/jni/gtk-peer/gtkpeer.c
new file mode 100644
index 00000000000..c99fc48f90f
--- /dev/null
+++ b/libjava/classpath/native/jni/gtk-peer/gtkpeer.c
@@ -0,0 +1,584 @@
+/* gtkpeer.c -- Some GTK peer specific helper functions
+ Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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 "jni.h"
+
+/**
+ * The Pointer class.
+ */
+static jclass pointerClass;
+
+/**
+ * The Pointer constructor.
+ */
+static jmethodID pointerConstructorMID;
+
+/**
+ * The field ID of the data field in the Pointer class.
+ */
+static jfieldID pointerDataFID;
+
+/**
+ * The field ID of the widget field in the GtkGenericPeer class.
+ */
+static jfieldID widgetFID;
+
+/**
+ * The field ID of the globalRef field in the GtkGenericPeer class.
+ */
+static jfieldID globalRefFID;
+
+/**
+ * The field ID of the display field in the GdkGraphicsEnvironment class.
+ */
+static jfieldID displayFID;
+
+/**
+ * The field ID of the screen field in the GdkScreenGraphicsDevice class.
+ */
+static jfieldID screenFID;
+
+/**
+ * The field ID of the nativeFont field in GdkFontPeer.
+ */
+static jfieldID fontFID;
+
+/**
+ * The field ID of the nativeDecoder field in GdkPixbufDecoder.
+ */
+static jfieldID pixbufLoaderFID;
+
+/**
+ * Initializes the IDs of the Pointer* classes.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_pointer_IDs(JNIEnv* env)
+{
+#if SIZEOF_VOID_P == 8
+ pointerClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
+ if (pointerClass != NULL)
+ {
+ pointerClass = (*env)->NewGlobalRef (env, pointerClass);
+ pointerDataFID = (*env)->GetFieldID (env, pointerClass, "data", "J");
+ pointerConstructorMID = (*env)->GetMethodID (env, pointerClass, "<init>",
+ "(J)V");
+ }
+#else
+#if SIZEOF_VOID_P == 4
+ pointerClass = (*env)->FindClass(env, "gnu/classpath/Pointer32");
+ pointerDataFID = (*env)->GetFieldID(env, pointerClass, "data", "I");
+
+ /* Find the Pointer32 constructor. */
+ pointerConstructorMID = (*env)->GetMethodID(env, pointerClass, "<init>",
+ "(I)V");
+#else
+#error "Pointer size is not supported."
+#endif /* SIZEOF_VOID_P == 4 */
+#endif /* SIZEOF_VOID_P == 8 */
+}
+
+/**
+ * Initializes the field IDs for the widget reference.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_widget_IDs(JNIEnv *env)
+{
+ jclass cls;
+
+ /* Find the widget field ID in GtkGenericPeer. */
+ cls = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GtkGenericPeer");
+ widgetFID = (*env)->GetFieldID(env, cls, "widget",
+ "Lgnu/classpath/Pointer;");
+
+ /* Find the globalRef field in GtkGenericPeer. */
+ globalRefFID = (*env)->GetFieldID(env, cls, "globalRef",
+ "Lgnu/classpath/Pointer;");
+}
+
+/**
+ * Stores the GTK widget reference in the GtkGenericPeer object.
+ *
+ * @param env the JNI environment
+ * @param peer the actual peer object
+ * @param widget the widget reference to store
+ */
+void gtkpeer_set_widget(JNIEnv *env, jobject peer, void *widget)
+{
+ jobject obj;
+
+ /* Fetch the widget field object. */
+ obj = (*env)->GetObjectField(env, peer, widgetFID);
+ if (obj == NULL)
+ {
+ /* Create if necessary. */
+#if SIZEOF_VOID_P == 8
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jlong) widget);
+#else
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jint) widget);
+#endif
+ (*env)->SetObjectField(env, peer, widgetFID, obj);
+ }
+ else
+ {
+#if SIZEOF_VOID_P == 8
+ (*env)->SetLongField(env, obj, pointerDataFID, (jlong) widget);
+#else
+ (*env)->SetIntField(env, obj, pointerDataFID, (jint) widget);
+#endif
+ }
+}
+
+/**
+ * Retrieves the GTK widget reference from a GtkGenericPeer object.
+ *
+ * @param env the JNI environment
+ * @param peer the actual peer object
+ *
+ * @return the widget reference
+ */
+void* gtkpeer_get_widget(JNIEnv *env, jobject peer)
+{
+ jobject obj;
+ void *widget;
+
+ /* Fetch the widget field from the peer object. */
+ obj = (*env)->GetObjectField(env, peer, widgetFID);
+
+ /* Fetch actual widget pointer. */
+#if SIZEOF_VOID_P == 8
+ widget = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ widget = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ return widget;
+}
+
+
+/**
+ * Stores the global JNI reference of a peer inside the peer.
+ *
+ * @param env the JNI environment
+ * @param peer the peer object
+ */
+void gtkpeer_set_global_ref(JNIEnv *env, jobject peer)
+{
+ jobject obj;
+ void* globalRef;
+
+ /* Create global reference. */
+ globalRef = (*env)->NewGlobalRef(env, peer);
+
+ /* Fetch the globalRef field object. */
+ obj = (*env)->GetObjectField(env, peer, globalRefFID);
+ if (obj == NULL)
+ {
+ /* Create if necessary. */
+#if SIZEOF_VOID_P == 8
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jlong) globalRef);
+#else
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jint) globalRef);
+#endif
+ (*env)->SetObjectField(env, peer, globalRefFID, obj);
+ }
+ else
+ {
+#if SIZEOF_VOID_P == 8
+ (*env)->SetLongField(env, obj, pointerDataFID, (jlong) globalRef);
+#else
+ (*env)->SetIntField(env, obj, pointerDataFID, (jint) globalRef);
+#endif
+ }
+}
+
+/**
+ * Retrieves the global reference from a peer.
+ *
+ * @param env the JNI environment
+ * @param peer the peer object
+ *
+ * @return the global reference
+ */
+void* gtkpeer_get_global_ref(JNIEnv *env, jobject peer)
+{
+ jobject obj;
+ void *globalRef;
+
+ /* Fetch the globalRef field from the peer object. */
+ obj = (*env)->GetObjectField(env, peer, globalRefFID);
+
+ /* Fetch actual globalRef pointer. */
+#if SIZEOF_VOID_P == 8
+ globalRef = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ globalRef = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ return globalRef;
+}
+
+/**
+ * Deletes the global reference of a peer. This is necessary in order to
+ * allow the peer to be garbage collected.
+ *
+ * @param env the JNI environment
+ * @param peer the peer object.
+ */
+void gtkpeer_del_global_ref(JNIEnv* env, jobject peer)
+{
+ jobject obj;
+ void *globalRef;
+
+ /* Fetch the globalRef field from the peer object. */
+ obj = (*env)->GetObjectField(env, peer, globalRefFID);
+
+ /* Fetch actual globalRef pointer. */
+#if SIZEOF_VOID_P == 8
+ globalRef = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ globalRef = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ (*env)->DeleteGlobalRef(env, globalRef);
+}
+
+/**
+ * Initializes the fieldIDs for the display and screen fields.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_display_IDs(JNIEnv* env)
+{
+ jclass cls;
+
+ /* Find the display field ID in GdkGraphicsEnvironment. */
+ cls = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GdkGraphicsEnvironment");
+ displayFID = (*env)->GetFieldID(env, cls, "display",
+ "Lgnu/classpath/Pointer;");
+}
+
+/**
+ * Sets the native display pointer in the GdkGraphicsEnvironment object.
+ *
+ * @param env the JNI environment
+ * @param graphicsenv the GdkGraphicsEnvironment object
+ * @param display the native display pointer
+ */
+void gtkpeer_set_display(JNIEnv* env, jobject graphicsenv, void* display)
+{
+ jobject obj;
+
+ /* Fetch the display field object. */
+ obj = (*env)->GetObjectField(env, graphicsenv, displayFID);
+ if (obj == NULL)
+ {
+ /* Create if necessary. */
+#if SIZEOF_VOID_P == 8
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jlong) display);
+#else
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jint) display);
+#endif
+ (*env)->SetObjectField(env, graphicsenv, displayFID, obj);
+ }
+ else
+ {
+#if SIZEOF_VOID_P == 8
+ (*env)->SetLongField(env, obj, pointerDataFID, (jlong) display);
+#else
+ (*env)->SetIntField(env, obj, pointerDataFID, (jint) display);
+#endif
+ }
+}
+
+/**
+ * Fetches the native display pointer from the GdkGraphicsEnvironment object.
+ *
+ * @param env the JNI environment
+ * @param graphicsenv the GdkGraphicsEnvironment object
+ *
+ * @return the native display pointer
+ */
+void* gtkpeer_get_display(JNIEnv* env, jobject graphicsenv)
+{
+ jobject obj;
+ void *display;
+
+ /* Fetch the display field from the peer object. */
+ obj = (*env)->GetObjectField(env, graphicsenv, displayFID);
+
+ /* Fetch actual display pointer. */
+#if SIZEOF_VOID_P == 8
+ display = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ display = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ return display;
+}
+
+/**
+ * Initializes the fieldIDs for the screen field.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_screen_IDs(JNIEnv* env)
+{
+ jclass cls;
+
+ /* Find the display field ID in GdkScreenGraphicsDevice. */
+ cls = (*env)->FindClass(env,
+ "gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice");
+ screenFID = (*env)->GetFieldID(env, cls, "screen",
+ "Lgnu/classpath/Pointer;");
+}
+
+/**
+ * Sets the native screen in the GdkScreenGraphicsDevice object.
+ *
+ * @param env the JNI environment
+ * @param screen_graphics_device the GdkScreenGraphicsDevice object
+ * @param ptr the native screen pointer
+ */
+void gtkpeer_set_screen(JNIEnv* env, jobject screen_graphics_device,
+ void* ptr)
+{
+ jobject obj;
+
+ /* Fetch the screen field object. */
+ obj = (*env)->GetObjectField(env, screen_graphics_device, screenFID);
+ if (obj == NULL)
+ {
+ /* Create if necessary. */
+#if SIZEOF_VOID_P == 8
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jlong) ptr);
+#else
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jint) ptr);
+#endif
+ (*env)->SetObjectField(env, screen_graphics_device, screenFID, obj);
+ }
+ else
+ {
+#if SIZEOF_VOID_P == 8
+ (*env)->SetLongField(env, obj, pointerDataFID, (jlong) ptr);
+#else
+ (*env)->SetIntField(env, obj, pointerDataFID, (jint) ptr);
+#endif
+ }
+}
+
+/**
+ * Fetches the native screen pointer from the GdkScreenGraphicsDevice object.
+ *
+ * @param env the JNI environment
+ * @param screen_graphics_device the GdkScreenGraphicsDevice object
+ *
+ * @return the native screen pointer
+ */
+void* gtkpeer_get_screen(JNIEnv* env, jobject screen_graphics_device)
+{
+ jobject obj;
+ void *screen;
+
+ /* Fetch the display field from the peer object. */
+ obj = (*env)->GetObjectField(env, screen_graphics_device, screenFID);
+
+ /* Fetch actual display pointer. */
+#if SIZEOF_VOID_P == 8
+ screen = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ screen = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ return screen;
+}
+
+/**
+ * Initializes the field IDs for fonts.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_font_IDs(JNIEnv* env)
+{
+ jclass cls;
+
+ /* Find the nativeFont field ID in GdkFontPeer. */
+ cls = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GdkFontPeer");
+ fontFID = (*env)->GetFieldID(env, cls, "nativeFont",
+ "Lgnu/classpath/Pointer;");
+}
+
+/**
+ * Sets the native font in the nativeFont field in GdkFontPeer.
+ *
+ * @param env the JNI environment
+ * @param font_peer the font peer object
+ * @param font the actual native font reference
+ */
+void gtkpeer_set_font(JNIEnv* env, jobject font_peer, void* font)
+{
+ jobject obj;
+
+ /* Fetch the nativeFont field object. */
+ obj = (*env)->GetObjectField(env, font_peer, fontFID);
+ if (obj == NULL)
+ {
+ /* Create if necessary. */
+#if SIZEOF_VOID_P == 8
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jlong) font);
+#else
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jint) font);
+#endif
+ (*env)->SetObjectField(env, font_peer, fontFID, obj);
+ }
+ else
+ {
+#if SIZEOF_VOID_P == 8
+ (*env)->SetLongField(env, obj, pointerDataFID, (jlong) font);
+#else
+ (*env)->SetIntField(env, obj, pointerDataFID, (jint) font);
+#endif
+ }
+}
+
+/**
+ * Fetches the native font reference from the GdkFontPeer object.
+ *
+ * @param env the JNI environment
+ * @param font_peer the font peer object
+ *
+ * @return the native font structure
+ */
+void* gtkpeer_get_font(JNIEnv* env, jobject font_peer)
+{
+ jobject obj;
+ void *font;
+
+ /* Fetch the nativeFont field from the peer object. */
+ obj = (*env)->GetObjectField(env, font_peer, fontFID);
+
+ /* Fetch actual font pointer. */
+#if SIZEOF_VOID_P == 8
+ font = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ font = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ return font;
+}
+
+/**
+ * Initializes the field IDs for pixbuf decoder.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_pixbuf_IDs(JNIEnv* env)
+{
+ jclass cls;
+
+ /* Find the nativeFont field ID in GdkFontPeer. */
+ cls = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder");
+ pixbufLoaderFID = (*env)->GetFieldID(env, cls, "nativeDecoder",
+ "Lgnu/classpath/Pointer;");
+}
+
+/**
+ * Sets the native font in the nativeFont field in GdkFontPeer.
+ *
+ * @param env the JNI environment
+ * @param pixbuf_dec the pixbuf decoder object
+ * @param pixbuf_loader the native pixbuf loader
+ */
+void gtkpeer_set_pixbuf_loader(JNIEnv* env, jobject pixbuf_dec,
+ void* pixbuf_loader)
+{
+ jobject obj;
+
+ /* Fetch the nativeDecoder field object. */
+ obj = (*env)->GetObjectField(env, pixbuf_dec, pixbufLoaderFID);
+ if (obj == NULL)
+ {
+ /* Create if necessary. */
+#if SIZEOF_VOID_P == 8
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jlong) pixbuf_loader);
+#else
+ obj = (*env)->NewObject(env, pointerClass, pointerConstructorMID,
+ (jint) pixbuf_loader);
+#endif
+ (*env)->SetObjectField(env, pixbuf_dec, pixbufLoaderFID, obj);
+ }
+ else
+ {
+#if SIZEOF_VOID_P == 8
+ (*env)->SetLongField(env, obj, pointerDataFID, (jlong) pixbuf_loader);
+#else
+ (*env)->SetIntField(env, obj, pointerDataFID, (jint) pixbuf_loader);
+#endif
+ }
+}
+
+/**
+ * Fetches the native pixbuf loader reference from the GdkPixbufDecoder object.
+ *
+ * @param env the JNI environment
+ * @param pixbuf_dec the pixbuf decoder object
+ *
+ * @return the native pixbuf loader
+ */
+void* gtkpeer_get_pixbuf_loader(JNIEnv* env, jobject pixbuf_dec)
+{
+ jobject obj;
+ void *loader;
+
+ /* Fetch the nativeFont field from the peer object. */
+ obj = (*env)->GetObjectField(env, pixbuf_dec, pixbufLoaderFID);
+
+ /* Fetch actual font pointer. */
+#if SIZEOF_VOID_P == 8
+ loader = (void*) (*env)->GetLongField(env, obj, pointerDataFID);
+#else
+ loader = (void*) (*env)->GetIntField(env, obj, pointerDataFID);
+#endif
+ return loader;
+}
diff --git a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
index 065d20608f5..8b677aff7fd 100644
--- a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
+++ b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
@@ -42,7 +42,6 @@ exception statement from your version. */
#include <stdlib.h>
#include <string.h>
#include <config.h>
-#include "native_state.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <jni.h>
@@ -54,49 +53,173 @@ exception statement from your version. */
#define __attribute__(x) /* nothing */
#endif
-extern struct state_table *cp_gtk_native_state_table;
-extern struct state_table *cp_gtk_native_global_ref_table;
-extern struct state_table *cp_gtk_native_graphics2d_state_table;
+/**
+ * Initializes the IDs of the Pointer* classes.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_pointer_IDs(JNIEnv* env);
+
+/**
+ * Initializes the field IDs for the widget reference.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_widget_IDs(JNIEnv *env);
+
+/**
+ * Stores the GTK widget reference in the GtkComponentPeer object.
+ *
+ * @param env the JNI environment
+ * @param peer the actual peer object
+ * @param widget the widget reference to store
+ */
+void gtkpeer_set_widget(JNIEnv *env, jobject peer, void *widget);
+
+/**
+ * Retrieves the GTK widget reference from a GtkComponentPeer object.
+ *
+ * @param env the JNI environment
+ * @param peer the actual peer object
+ *
+ * @return the widget reference
+ */
+void* gtkpeer_get_widget(JNIEnv *env, jobject peer);
+
+/**
+ * Stores the global JNI reference of a peer inside the peer.
+ *
+ * @param env the JNI environment
+ * @param peer the peer object
+ */
+void gtkpeer_set_global_ref(JNIEnv *env, jobject peer);
+
+/**
+ * Retrieves the global reference from a peer.
+ *
+ * @param env the JNI environment
+ * @param peer the peer object
+ *
+ * @return the global reference
+ */
+void* gtkpeer_get_global_ref(JNIEnv *env, jobject peer);
+
+/**
+ * Deletes the global reference of a peer. This is necessary in order to
+ * allow the peer to be garbage collected.
+ *
+ * @param env the JNI environment
+ * @param peer the peer object.
+ */
+void gtkpeer_del_global_ref(JNIEnv* env, jobject peer);
+
+
+/**
+ * Initializes the fieldIDs for the display and screen fields.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_display_IDs(JNIEnv* env);
+
+/**
+ * Sets the native display pointer in the GdkGraphicsEnvironment object.
+ *
+ * @param env the JNI environment
+ * @param graphicsenv the GdkGraphicsEnvironment object
+ * @param display the native display pointer
+ */
+void gtkpeer_set_display(JNIEnv* env, jobject graphicsenv, void* display);
+
+/**
+ * Fetches the native display pointer from the GdkGraphicsEnvironment object.
+ *
+ * @param env the JNI environment
+ * @param graphicsenv the GdkGraphicsEnvironment object
+ *
+ * @return the native display pointer
+ */
+void* gtkpeer_get_display(JNIEnv* env, jobject graphicsenv);
+
+/**
+ * Initializes the fieldIDs for the screen field.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_screen_IDs(JNIEnv* env);
+
+/**
+ * Sets the native screen in the GdkScreenGraphicsDevice object.
+ *
+ * @param env the JNI environment
+ * @param screen_graphics_device the GdkScreenGraphicsDevice object
+ * @param ptr the native screen pointer
+ */
+void gtkpeer_set_screen(JNIEnv* env, jobject screen_graphics_device,
+ void* ptr);
+
+/**
+ * Fetches the native screen pointer from the GdkScreenGraphicsDevice object.
+ *
+ * @param env the JNI environment
+ * @param screen_graphics_device the GdkScreenGraphicsDevice object
+ *
+ * @return the native screen pointer
+ */
+void* gtkpeer_get_screen(JNIEnv* env, jobject screen_graphics_device);
+
+/**
+ * Initializes the field IDs for fonts.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_font_IDs(JNIEnv* env);
+
+/**
+ * Sets the native font in the nativeFont field in GdkFontPeer.
+ *
+ * @param env the JNI environment
+ * @param font_peer the font peer object
+ * @param font the actual native font reference
+ */
+void gtkpeer_set_font(JNIEnv* env, jobject font_peer, void* font);
+
+/**
+ * Fetches the native font reference from the GdkFontPeer object.
+ *
+ * @param env the JNI environment
+ * @param font_peer the font peer object
+ *
+ * @return the native font structure
+ */
+void* gtkpeer_get_font(JNIEnv* env, jobject font_peer);
+
+/**
+ * Initializes the field IDs for pixbuf decoder.
+ *
+ * @param env the JNI environment
+ */
+void gtkpeer_init_pixbuf_IDs(JNIEnv* env);
+
+/**
+ * Sets the native font in the nativeFont field in GdkFontPeer.
+ *
+ * @param env the JNI environment
+ * @param pixbuf_dec the pixbuf decoder object
+ * @param pixbuf_loader the native pixbuf loader
+ */
+void gtkpeer_set_pixbuf_loader(JNIEnv* env, jobject pixbuf_dec,
+ void* pixbuf_loader);
+
+/**
+ * Fetches the native pixbuf loader reference from the GdkPixbufDecoder object.
+ *
+ * @param env the JNI environment
+ * @param pixbuf_dec the pixbuf decoder object
+ *
+ * @return the native pixbuf loader
+ */
+void* gtkpeer_get_pixbuf_loader(JNIEnv* env, jobject pixbuf_dec);
-#define NSA_INIT(env, clazz) \
- do {cp_gtk_native_state_table = cp_gtk_init_state_table (env, clazz); \
- cp_gtk_native_global_ref_table = cp_gtk_init_state_table (env, clazz);} while (0)
-
-#define NSA_GET_PTR(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_state_table)
-
-#define NSA_SET_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, cp_gtk_native_state_table, (void *)ptr)
-
-#define NSA_DEL_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, cp_gtk_native_state_table)
-
-#define NSA_GET_GLOBAL_REF(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_global_ref_table)
-
-#define NSA_SET_GLOBAL_REF(env, obj) \
- do {jobject *globRefPtr; \
- globRefPtr = (jobject *) malloc (sizeof (jobject)); \
- *globRefPtr = (*env)->NewGlobalRef (env, obj); \
- cp_gtk_set_state (env, obj, cp_gtk_native_global_ref_table, (void *)globRefPtr);} while (0)
-
-#define NSA_DEL_GLOBAL_REF(env, obj) \
- do {jobject *globRefPtr = cp_gtk_get_state (env, obj, cp_gtk_native_global_ref_table); \
- cp_gtk_remove_state_slot (env, obj, cp_gtk_native_global_ref_table); \
- (*env)->DeleteGlobalRef (env, *globRefPtr); \
- free (globRefPtr);} while (0)
-
-#define NSA_G2D_INIT(env, clazz) \
- cp_gtk_native_graphics2d_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_G2D_PTR(env, obj) \
- cp_gtk_get_state (env, obj, cp_gtk_native_graphics2d_state_table)
-
-#define NSA_SET_G2D_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, cp_gtk_native_graphics2d_state_table, (void *)ptr)
-
-#define NSA_DEL_G2D_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, cp_gtk_native_graphics2d_state_table)
#define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
@@ -188,7 +311,7 @@ void cp_gtk_grab_current_drawable(GtkWidget *widget, GdkDrawable **draw,
GdkWindow **win);
/* JNI initialization functions */
-void cp_gtk_button_init_jni (void);
+void cp_gtk_button_init_jni (JNIEnv*);
void cp_gtk_checkbox_init_jni (void);
void cp_gtk_choice_init_jni (void);
void cp_gtk_component_init_jni (void);
@@ -200,11 +323,11 @@ void cp_gtk_textcomponent_init_jni (void);
void cp_gtk_window_init_jni (void);
/* Signal connection convience functions */
-void cp_gtk_component_connect_expose_signals (GObject *ptr, jobject *gref);
-void cp_gtk_component_connect_focus_signals (GObject *ptr, jobject *gref);
-void cp_gtk_component_connect_mouse_signals (GObject *ptr, jobject *gref);
-void cp_gtk_component_connect_signals (GObject *ptr, jobject *gref);
-void cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject *gref);
+void cp_gtk_component_connect_expose_signals (GObject *ptr, jobject gref);
+void cp_gtk_component_connect_focus_signals (GObject *ptr, jobject gref);
+void cp_gtk_component_connect_mouse_signals (GObject *ptr, jobject gref);
+void cp_gtk_component_connect_signals (GObject *ptr, jobject gref);
+void cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject gref);
/* Debugging */
void cp_gtk_print_current_thread (void);