From bfd03af53013b43663c88995c6d5943815e8d75b Mon Sep 17 00:00:00 2001 From: doko Date: Sat, 4 Aug 2007 10:53:49 +0000 Subject: libjava/ 2007-08-04 Matthias Klose 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 * java/util/EnumMap.java (clone): Add cast. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127204 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/native/jni/Makefile.am | 10 +- libjava/classpath/native/jni/Makefile.in | 22 +- libjava/classpath/native/jni/classpath/Makefile.am | 3 +- libjava/classpath/native/jni/classpath/Makefile.in | 21 +- .../classpath/native/jni/classpath/native_state.c | 276 -------- .../classpath/native/jni/classpath/native_state.h | 71 -- .../classpath/native/jni/gconf-peer/Makefile.am | 3 +- .../classpath/native/jni/gconf-peer/Makefile.in | 20 +- .../native/jni/gstreamer-peer/GStreamerIOPeer.c | 772 +++++++++++++++++++++ .../native/jni/gstreamer-peer/Makefile.am | 22 + .../native/jni/gstreamer-peer/Makefile.in | 640 +++++++++++++++++ .../native/jni/gstreamer-peer/gstclasspathsrc.c | 332 +++++++++ .../native/jni/gstreamer-peer/gstclasspathsrc.h | 88 +++ .../native/jni/gstreamer-peer/gstinputstream.c | 494 +++++++++++++ .../native/jni/gstreamer-peer/gstinputstream.h | 99 +++ .../native/jni/gtk-peer/GtkDragSourceContextPeer.c | 18 +- libjava/classpath/native/jni/gtk-peer/Makefile.am | 4 +- libjava/classpath/native/jni/gtk-peer/Makefile.in | 24 +- .../native/jni/gtk-peer/cairographics2d.h | 1 - libjava/classpath/native/jni/gtk-peer/gdkdisplay.h | 24 - libjava/classpath/native/jni/gtk-peer/gdkfont.h | 42 -- .../gnu_java_awt_peer_gtk_CairoGraphics2D.c | 6 +- .../gnu_java_awt_peer_gtk_ComponentGraphics.c | 15 +- .../gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c | 8 +- .../gnu_java_awt_peer_gtk_FreetypeGlyphVector.c | 5 +- .../gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c | 27 +- .../gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c | 28 +- .../gnu_java_awt_peer_gtk_GdkPixbufDecoder.c | 25 +- ...gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c | 27 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c | 43 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c | 4 +- ...gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c | 6 +- .../gnu_java_awt_peer_gtk_GtkCheckboxPeer.c | 28 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c | 24 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c | 7 +- .../gnu_java_awt_peer_gtk_GtkComponentPeer.c | 74 +- .../gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c | 6 +- .../gnu_java_awt_peer_gtk_GtkFileDialogPeer.c | 26 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c | 22 +- .../gnu_java_awt_peer_gtk_GtkGenericPeer.c | 16 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c | 14 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c | 34 +- .../gnu_java_awt_peer_gtk_GtkMenuBarPeer.c | 10 +- .../gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c | 3 +- .../gnu_java_awt_peer_gtk_GtkMenuItemPeer.c | 18 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c | 16 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c | 14 +- .../gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c | 6 +- .../gnu_java_awt_peer_gtk_GtkScrollPanePeer.c | 16 +- .../gnu_java_awt_peer_gtk_GtkScrollbarPeer.c | 18 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c | 8 + .../gnu_java_awt_peer_gtk_GtkTextAreaPeer.c | 38 +- .../gnu_java_awt_peer_gtk_GtkTextFieldPeer.c | 38 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c | 14 +- .../gnu_java_awt_peer_gtk_GtkVolatileImage.c | 2 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c | 60 +- libjava/classpath/native/jni/gtk-peer/gtk_jawt.c | 8 +- libjava/classpath/native/jni/gtk-peer/gtkpeer.c | 584 ++++++++++++++++ libjava/classpath/native/jni/gtk-peer/gtkpeer.h | 221 ++++-- libjava/classpath/native/jni/java-io/Makefile.in | 15 +- libjava/classpath/native/jni/java-lang/Makefile.in | 15 +- libjava/classpath/native/jni/java-net/Makefile.in | 15 +- .../jni/java-net/gnu_java_net_VMPlainSocketImpl.c | 21 +- .../native/jni/java-net/java_net_VMInetAddress.c | 30 +- libjava/classpath/native/jni/java-net/javanet.c | 2 + libjava/classpath/native/jni/java-nio/Makefile.in | 15 +- .../native/jni/java-nio/gnu_java_nio_VMChannel.c | 78 ++- libjava/classpath/native/jni/java-util/Makefile.in | 15 +- libjava/classpath/native/jni/midi-alsa/Makefile.in | 15 +- libjava/classpath/native/jni/midi-dssi/Makefile.in | 15 +- .../classpath/native/jni/native-lib/Makefile.in | 15 +- libjava/classpath/native/jni/native-lib/cpio.c | 6 +- libjava/classpath/native/jni/native-lib/cpnet.c | 9 +- libjava/classpath/native/jni/native-lib/cpnet.h | 6 + libjava/classpath/native/jni/qt-peer/Makefile.in | 15 +- .../classpath/native/jni/qt-peer/qtfontmetrics.cpp | 4 +- libjava/classpath/native/jni/xmlj/Makefile.in | 15 +- libjava/classpath/native/jni/xmlj/xmlj_xpath.c | 1 - 78 files changed, 3863 insertions(+), 949 deletions(-) delete mode 100644 libjava/classpath/native/jni/classpath/native_state.c delete mode 100644 libjava/classpath/native/jni/classpath/native_state.h create mode 100644 libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c create mode 100644 libjava/classpath/native/jni/gstreamer-peer/Makefile.am create mode 100644 libjava/classpath/native/jni/gstreamer-peer/Makefile.in create mode 100644 libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c create mode 100644 libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h create mode 100644 libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c create mode 100644 libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h create mode 100644 libjava/classpath/native/jni/gtk-peer/gtkpeer.c (limited to 'libjava/classpath/native/jni') diff --git a/libjava/classpath/native/jni/Makefile.am b/libjava/classpath/native/jni/Makefile.am index 1105407993f..b820fe745d2 100644 --- a/libjava/classpath/native/jni/Makefile.am +++ b/libjava/classpath/native/jni/Makefile.am @@ -24,16 +24,20 @@ if CREATE_GCONF_PEER_LIBRARIES CLASSPATH_GCONF_PEER_DIR = gconf-peer endif +if CREATE_GSTREAMER_PEER_LIBRARIES + CLASSPATH_GSTREAMER_PEER_DIR = gstreamer-peer +endif + if CREATE_XMLJ_LIBRARY XMLJDIR = xmlj endif SUBDIRS = classpath $(JNIDIRS) \ $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR) \ - $(CLASSPATH_GCONF_PEER_DIR) + $(CLASSPATH_GCONF_PEER_DIR) $(CLASSPATH_GSTREAMER_PEER_DIR) DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \ - gtk-peer gconf-peer qt-peer xmlj midi-alsa midi-dssi \ - native-lib + gtk-peer gconf-peer gstreamer-peer qt-peer xmlj midi-alsa \ + midi-dssi native-lib all-local: cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh diff --git a/libjava/classpath/native/jni/Makefile.in b/libjava/classpath/native/jni/Makefile.in index d4ad33bca5d..00e6c51df77 100644 --- a/libjava/classpath/native/jni/Makefile.in +++ b/libjava/classpath/native/jni/Makefile.in @@ -106,6 +106,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@ @@ -144,8 +146,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@ @@ -169,6 +169,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@ @@ -241,8 +250,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@ @@ -320,14 +327,15 @@ vm_classes = @vm_classes@ @CREATE_GTK_PEER_LIBRARIES_TRUE@GTKDIR = gtk-peer @CREATE_QT_PEER_LIBRARIES_TRUE@CLASSPATH_QT_PEER_DIR = qt-peer @CREATE_GCONF_PEER_LIBRARIES_TRUE@CLASSPATH_GCONF_PEER_DIR = gconf-peer +@CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@CLASSPATH_GSTREAMER_PEER_DIR = gstreamer-peer @CREATE_XMLJ_LIBRARY_TRUE@XMLJDIR = xmlj SUBDIRS = classpath $(JNIDIRS) \ $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR) \ - $(CLASSPATH_GCONF_PEER_DIR) + $(CLASSPATH_GCONF_PEER_DIR) $(CLASSPATH_GSTREAMER_PEER_DIR) DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \ - gtk-peer gconf-peer qt-peer xmlj midi-alsa midi-dssi \ - native-lib + gtk-peer gconf-peer gstreamer-peer qt-peer xmlj midi-alsa \ + midi-dssi native-lib all: all-recursive diff --git a/libjava/classpath/native/jni/classpath/Makefile.am b/libjava/classpath/native/jni/classpath/Makefile.am index d996df63640..5436c42beec 100644 --- a/libjava/classpath/native/jni/classpath/Makefile.am +++ b/libjava/classpath/native/jni/classpath/Makefile.am @@ -4,8 +4,7 @@ EXTRA_DIST = classpath_jawt.h noinst_LTLIBRARIES = libclasspath.la libclasspath_la_SOURCES = jcl.c jcl.h \ - jnilink.c jnilink.h \ - native_state.c native_state.h + jnilink.c jnilink.h AM_LDFLAGS = @CLASSPATH_CONVENIENCE@ AM_CPPFLAGS = @CLASSPATH_INCLUDES@ diff --git a/libjava/classpath/native/jni/classpath/Makefile.in b/libjava/classpath/native/jni/classpath/Makefile.in index f9428576663..aff43aa76c9 100644 --- a/libjava/classpath/native/jni/classpath/Makefile.in +++ b/libjava/classpath/native/jni/classpath/Makefile.in @@ -63,7 +63,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libclasspath_la_LIBADD = -am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo native_state.lo +am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo libclasspath_la_OBJECTS = $(am_libclasspath_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/../../depcomp @@ -116,6 +116,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@ @@ -154,8 +156,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@ @@ -179,6 +179,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@ @@ -251,8 +260,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@ @@ -329,8 +336,7 @@ vm_classes = @vm_classes@ EXTRA_DIST = classpath_jawt.h noinst_LTLIBRARIES = libclasspath.la libclasspath_la_SOURCES = jcl.c jcl.h \ - jnilink.c jnilink.h \ - native_state.c native_state.h + jnilink.c jnilink.h AM_LDFLAGS = @CLASSPATH_CONVENIENCE@ AM_CPPFLAGS = @CLASSPATH_INCLUDES@ @@ -388,7 +394,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jnilink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/native_state.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/classpath/native_state.c b/libjava/classpath/native/jni/classpath/native_state.c deleted file mode 100644 index 2cb43d614cc..00000000000 --- a/libjava/classpath/native/jni/classpath/native_state.c +++ /dev/null @@ -1,276 +0,0 @@ -/* Magical NSA API -- Associate a C ptr with an instance of an object - Copyright (C) 1998, 2002 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 -#include -#include -#include "native_state.h" - -#define DEFAULT_TABLE_SIZE 97 - -struct state_table * -cp_gtk_init_state_table_with_size (JNIEnv * env, jclass clazz, jint size) -{ - struct state_table *table; - jfieldID hash; - jclass clazz_g; - - hash = (*env)->GetFieldID (env, clazz, "native_state", "I"); - if (hash == NULL) - return NULL; - - clazz_g = (*env)->NewGlobalRef (env, clazz); - if (clazz_g == NULL) - return NULL; - - table = (struct state_table *) malloc (sizeof (struct state_table)); - table->size = size; - table->head = (struct state_node **) calloc (sizeof (struct state_node *), - table->size); - table->hash = hash; - table->clazz = clazz_g; - - return table; -} - -struct state_table * -cp_gtk_init_state_table (JNIEnv * env, jclass clazz) -{ - return cp_gtk_init_state_table_with_size (env, clazz, DEFAULT_TABLE_SIZE); -} - -static void * -remove_node (struct state_node **head, jint obj_id) -{ - struct state_node *back_ptr = NULL; - struct state_node *node = *head; - - while (node != NULL) - { - if (node->key == obj_id) - { - void *return_value; - if (back_ptr == NULL) - *head = node->next; - else - back_ptr->next = node->next; - return_value = node->c_state; - free (node); - return return_value; - } - back_ptr = node; - node = node->next; - } - - return NULL; -} - -static void * -get_node (struct state_node **head, jint obj_id) -{ - struct state_node *back_ptr = NULL; - struct state_node *node = *head; - - while (node != NULL) - { - if (node->key == obj_id) - { - /* Move the node we found to the front of the list. */ - if (back_ptr != NULL) - { - back_ptr->next = node->next; - node->next = *head; - *head = node; - } - - /* Return the match. */ - return node->c_state; - } - - back_ptr = node; - node = node->next; - } - - return NULL; -} - -static void -add_node (struct state_node **head, jint obj_id, void *state) -{ - struct state_node *node = *head; - struct state_node *back_ptr = NULL; - - struct state_node *new_node; - - if (node != NULL) - { - while (node->next != NULL && obj_id != node->key) - { - back_ptr = node; - node = node->next; - } - - if (node->key == obj_id) - { - /* If we're updating a node, move it to the front of the - list. */ - if (back_ptr != NULL) - { - back_ptr->next = node->next; - node->next = *head; - *head = node; - } - node->c_state = state; - return; - } - } - - new_node = (struct state_node *) malloc (sizeof (struct state_node)); - new_node->key = obj_id; - new_node->c_state = state; - new_node->next = *head; - *head = new_node; -} - -#ifndef NDEBUG -static void -cp_gtk_check_compat (JNIEnv * env, jobject obj, struct state_table *table) -{ - jclass objclazz; - - objclazz = (*env)->GetObjectClass(env, obj); - assert ((*env)->IsAssignableFrom(env, objclazz, table->clazz)); - (*env)->DeleteLocalRef(env, objclazz); -} -#endif - -void -cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table, - jint obj_id, void *state) -{ - jint hash; - - hash = obj_id % table->size; - - (*env)->MonitorEnter (env, lock); - add_node (&table->head[hash], obj_id, state); - (*env)->MonitorExit (env, lock); -} - -void * -cp_gtk_get_state_oid (JNIEnv * env, jobject lock, struct state_table *table, - jint obj_id) -{ - jint hash; - void *return_value; - - hash = obj_id % table->size; - - (*env)->MonitorEnter (env, lock); - return_value = get_node (&table->head[hash], obj_id); - (*env)->MonitorExit (env, lock); - - return return_value; -} - -void * -cp_gtk_remove_state_oid (JNIEnv * env, jobject lock, struct state_table *table, - jint obj_id) -{ - jint hash; - void *return_value; - - hash = obj_id % table->size; - - (*env)->MonitorEnter (env, lock); - return_value = remove_node (&table->head[hash], obj_id); - (*env)->MonitorExit (env, lock); - - return return_value; -} - -int -cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state) -{ - jint obj_id; - -#ifndef NDEBUG - cp_gtk_check_compat(env, obj, table); -#endif - - obj_id = (*env)->GetIntField (env, obj, table->hash); - - if ((*env)->ExceptionOccurred (env) != NULL) - return -1; - - cp_gtk_set_state_oid (env, table->clazz, table, obj_id, state); - return 0; -} - -void * -cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table) -{ - jint obj_id; - -#ifndef NDEBUG - cp_gtk_check_compat(env, obj, table); -#endif - - obj_id = (*env)->GetIntField (env, obj, table->hash); - - if ((*env)->ExceptionOccurred (env) != NULL) - return NULL; - - return cp_gtk_get_state_oid (env, table->clazz, table, obj_id); -} - -void * -cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table) -{ - jint obj_id; - -#ifndef NDEBUG - cp_gtk_check_compat(env, obj, table); -#endif - - obj_id = (*env)->GetIntField (env, obj, table->hash); - - if ((*env)->ExceptionOccurred (env) != NULL) - return NULL; - - return cp_gtk_remove_state_oid (env, table->clazz, table, obj_id); -} diff --git a/libjava/classpath/native/jni/classpath/native_state.h b/libjava/classpath/native/jni/classpath/native_state.h deleted file mode 100644 index 641e588827d..00000000000 --- a/libjava/classpath/native/jni/classpath/native_state.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Magical NSA API -- Associate a C ptr with an instance of an object - Copyright (C) 1998 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. */ - -#ifndef JCL_NATIVE_STATE -#define JCL_NATIVE_STATE - -#include - -struct state_table -{ - jint size; /* number of slots, should be prime */ - jfieldID hash; /* field containing System.identityHashCode(this) */ - jclass clazz; /* lock aquired for reading/writing nodes */ - struct state_node **head; -}; - -struct state_node -{ - jint key; - void *c_state; - struct state_node *next; -}; - -struct state_table *cp_gtk_init_state_table_with_size (JNIEnv *, jclass, jint); -struct state_table *cp_gtk_init_state_table (JNIEnv *, jclass); - -/* lowlevel api */ -void cp_gtk_set_state_oid (JNIEnv *, jobject, struct state_table *, jint, void *); -void *cp_gtk_get_state_oid (JNIEnv *, jobject, struct state_table *, jint); -void *cp_gtk_remove_state_oid (JNIEnv *, jobject, struct state_table *, jint); - -/* highlevel api */ -int cp_gtk_set_state (JNIEnv *, jobject, struct state_table *, void *); -void *cp_gtk_get_state (JNIEnv *, jobject, struct state_table *); -void *cp_gtk_remove_state_slot (JNIEnv *, jobject, struct state_table *); - -#endif diff --git a/libjava/classpath/native/jni/gconf-peer/Makefile.am b/libjava/classpath/native/jni/gconf-peer/Makefile.am index 3008b3d7acd..56789462d23 100644 --- a/libjava/classpath/native/jni/gconf-peer/Makefile.am +++ b/libjava/classpath/native/jni/gconf-peer/Makefile.am @@ -2,8 +2,7 @@ nativeexeclib_LTLIBRARIES = libgconfpeer.la libgconfpeer_la_SOURCES = GConfNativePeer.c -libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \ - $(top_builddir)/native/jni/classpath/jcl.lo +libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo libgconfpeer_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version diff --git a/libjava/classpath/native/jni/gconf-peer/Makefile.in b/libjava/classpath/native/jni/gconf-peer/Makefile.in index 109df48959a..9c459465c82 100644 --- a/libjava/classpath/native/jni/gconf-peer/Makefile.in +++ b/libjava/classpath/native/jni/gconf-peer/Makefile.in @@ -71,7 +71,6 @@ am__installdirs = "$(DESTDIR)$(nativeexeclibdir)" nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(nativeexeclib_LTLIBRARIES) libgconfpeer_la_DEPENDENCIES = \ - $(top_builddir)/native/jni/classpath/native_state.lo \ $(top_builddir)/native/jni/classpath/jcl.lo am_libgconfpeer_la_OBJECTS = GConfNativePeer.lo libgconfpeer_la_OBJECTS = $(am_libgconfpeer_la_OBJECTS) @@ -126,6 +125,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@ @@ -164,8 +165,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@ @@ -189,6 +188,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@ @@ -261,8 +269,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@ @@ -336,9 +342,7 @@ toolexeclibdir = @toolexeclibdir@ vm_classes = @vm_classes@ nativeexeclib_LTLIBRARIES = libgconfpeer.la libgconfpeer_la_SOURCES = GConfNativePeer.c -libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \ - $(top_builddir)/native/jni/classpath/jcl.lo - +libgconfpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo libgconfpeer_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version AM_LDFLAGS = @CLASSPATH_MODULE@ @GCONF_LIBS@ @GDK_LIBS@ AM_CPPFLAGS = @CLASSPATH_INCLUDES@ diff --git a/libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c b/libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c new file mode 100644 index 00000000000..f5d52e8a4b4 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c @@ -0,0 +1,772 @@ +/* GStreamerIOPeer.c -- Implements native methods for class GStreamerNativePeer + 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 +#include + +#include + +#include +#include + +#include + +#include + +#include "jcl.h" + +#include "gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer.h" + +#include "gstclasspathsrc.h" +#include "gstinputstream.h" + +#define _GST_MALLOC_SIZE_ 256 + +typedef struct _AudioProperties AudioProperties; +struct _AudioProperties +{ + /* + * NOTE: descriptions of the properties are taken from: + * http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html#table-audio-types + */ + + /* decoder name */ + const char *name; + + /* audio endiannes */ + const char *endianness; + + /* header size */ + const char *header_size; + + /* mime */ + const char *mimetype; + + /* The sample rate of the data, in samples (per channel) per second */ + const char *samplerate; + + /* The number of channels of audio data */ + const char *channels; + + const char *layer; + + const char *bitrate; + + const char *framed; + + /* + * Defines if the values of the integer samples are signed or not. + * Signed samples use one bit to indicate sign (negative or positive) + * of the value. Unsigned samples are always positive. + */ + const char *signess; + + /* */ + const char *rate; + + /* Number of bits allocated per sample. */ + const char *width; + + /* + * The number of bits used per sample. + * If the depth is less than the width, the low bits are assumed to be the + * ones used. For example, a width of 32 and a depth of 24 means that + * each sample is stored in a 32 bit word, but only the low + * 24 bits are actually used. + */ + const char *depth; + + /* + * This is set in the case of the mpeg files. + */ + const char *type; + + gboolean done; + +}; + +/* ***** PRIVATE FUNCTIONS DECLARATION ***** */ + +static gboolean +set_strings (JNIEnv *env, const jclass GstHeader, + const AudioProperties *properties, jobject header); + +static gboolean +typefind_callback(GstElement *typefind, guint probability, const GstCaps *caps, + gpointer data); + +static void +element_added (GstBin *bin, GstElement *element, gpointer data); + +static void +new_decoded_pad (GstElement *decoder, GstPad *pad, + gboolean last, GstElement *pipeline); + +static gboolean +fill_info (GstElement *decoder, AudioProperties *properties); + +static gchar * +get_string_property (const GstStructure *structure, const gchar *property); + +static gchar * +get_boolean_property (const GstStructure *structure, const gchar *property); + +static gboolean +set_string (JNIEnv *env, const jclass GstHeader, jobject header, + const char *field, const gchar *property); + +static void +free_properties (AudioProperties *properties); + +static void +reset_properties (AudioProperties *properties); + +/* ***** END: PRIVATE FUNCTIONS DECLARATION ***** */ + +/* ***** NATIVE FUNCTIONS ***** */ + +JNIEXPORT jboolean JNICALL +Java_gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer_gstreamer_1get_1audio_1format_1stream + (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject header __attribute__ ((unused)), + jobject jstream __attribute__ ((unused))) +{ + GstInputStream *istream = NULL; + JavaVM *vm = NULL; + jclass GstHeader = NULL; + + GstElement *pipeline = NULL; + + GstElement *typefind = NULL; + GstElement *decodebin = NULL; + GstElement *source = NULL; + + AudioProperties *properties = NULL; + + jboolean result = JNI_FALSE; + + GstHeader = (*env)->GetObjectClass(env, header); + + gst_init (NULL, NULL); + + properties = (AudioProperties *) g_malloc0 (sizeof (AudioProperties)); + if (properties == NULL) + { + g_warning ("unable to allocate memory for properties"); + return JNI_FALSE; + } + + /* create the GstInputStream object */ + istream = g_object_new (GST_TYPE_INPUT_STREAM, NULL); + if (istream == NULL) + { + free_properties (properties); + + g_warning ("unable to create an istream"); + return JNI_FALSE; + } + + source = gst_element_factory_make ("classpathsrc", "source"); + if (source == NULL) + { + free_properties (properties); + g_free ((gpointer) istream); + + g_warning ("unable to create a source"); + return JNI_FALSE; + } + + /* store the vm and the input stream in the gstinputstream class */ + (*env)->GetJavaVM(env, &vm); + g_object_set (G_OBJECT (istream), GST_ISTREAM_JVM, vm, + GST_ISTREAM_READER, jstream, + NULL); + g_object_set (G_OBJECT (source), GST_CLASSPATH_SRC_ISTREAM, istream, NULL); + + pipeline = gst_pipeline_new ("pipe"); + if (pipeline == NULL) + { + gst_object_unref (GST_OBJECT (source)); + g_free ((gpointer) istream); + free_properties (properties); + + g_warning ("unable to create the pipeline"); + return JNI_FALSE; + } + + decodebin = gst_element_factory_make ("decodebin", "decodebin"); + if (decodebin == NULL) + { + gst_object_unref (GST_OBJECT (source)); + + g_free ((gpointer) istream); + free_properties(properties); + + gst_object_unref(GST_OBJECT(pipeline)); + + g_warning ("unable to create decodebin"); + return JNI_FALSE; + } + + g_signal_connect (decodebin, "new-decoded-pad", G_CALLBACK (new_decoded_pad), + pipeline); + + gst_bin_add_many (GST_BIN (pipeline), source, decodebin, NULL); + gst_element_link (source, decodebin); + + typefind = gst_bin_get_by_name (GST_BIN (decodebin), "typefind"); + if (typefind == NULL) + { + g_free ((gpointer) istream); + free_properties(properties); + + gst_object_unref(GST_OBJECT(pipeline)); + + g_warning ("unable to create decodebin"); + return JNI_FALSE; + } + + g_signal_connect (G_OBJECT (typefind), "have-type", + G_CALLBACK (typefind_callback), properties); + + gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING); + if (gst_element_get_state (pipeline, NULL, NULL, 100000) == + GST_STATE_CHANGE_FAILURE) + { + g_free ((gpointer) istream); + free_properties(properties); + gst_object_unref(GST_OBJECT(pipeline)); + + g_warning ("Failed to go into PLAYING state"); + return JNI_FALSE; + } + + result = JNI_FALSE; + if (fill_info (decodebin, properties)) + { + result = set_strings (env, GstHeader, properties, header); + } + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + + gst_object_unref (GST_OBJECT(pipeline)); + free_properties (properties); + + return result; +} + +JNIEXPORT jboolean JNICALL +Java_gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer_gstreamer_1get_1audio_1format_1file + (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject header) +{ + /* will contain the properties we need to put into the given GstHeader */ + AudioProperties *properties = NULL; + + /* source file */ + const char *file = NULL; + + /* GStreamer elements */ + GstElement *pipeline = NULL; + GstElement *source = NULL; + GstElement *decoder = NULL; + + GstElement *typefind = NULL; + + GstStateChangeReturn res; + + jboolean result = JNI_FALSE; + + /* java fields */ + jfieldID _fid = NULL; + jclass GstHeader = NULL; + jstring _file = NULL; + + GstHeader = (*env)->GetObjectClass(env, header); + _fid = (*env)->GetFieldID(env, GstHeader, "file", "Ljava/lang/String;"); + if (_fid == NULL) + { + return JNI_FALSE; /* failed to find the field */ + } + + _file = (*env)->GetObjectField(env, header, _fid); + file = JCL_jstring_to_cstring (env, _file); + if (file == NULL) + { + return JNI_FALSE; + } + + gst_init (NULL, NULL); + + properties = (AudioProperties *) g_malloc0 (sizeof (AudioProperties)); + if (properties == NULL) + { + free_properties (properties); + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + /* this is not really needed */ + reset_properties(properties); + + /* create the source element, will be used to read the file */ + source = gst_element_factory_make ("filesrc", "source"); + if (source == NULL) + { + free_properties (properties); + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + /* set the file name */ + g_object_set (G_OBJECT (source), "location", file, NULL); + + /* + * create the decoder element, this will decode the stream and retrieve + * its properties. + * We connect a signal to this element, to be informed when it is done + * in decoding the stream and to get the needed informations about the + * audio file. + */ + decoder = gst_element_factory_make ("decodebin", "decoder"); + if (decoder == NULL) + { + gst_object_unref (GST_OBJECT (source)); + free_properties(properties); + + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + g_signal_connect (decoder, "new-decoded-pad", G_CALLBACK (new_decoded_pad), + pipeline); + g_signal_connect (G_OBJECT (decoder), "element-added", + G_CALLBACK (element_added), properties); + + /* now, we create a pipeline and fill it with the other elements */ + pipeline = gst_pipeline_new ("pipeline"); + if (pipeline == NULL) + { + gst_object_unref (GST_OBJECT (source)); + gst_object_unref (GST_OBJECT (decoder)); + + free_properties(properties); + + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + /* + * we get the typefind from the decodebin to catch the additional properties + * that the decodebin does not expose to us + */ + typefind = gst_bin_get_by_name (GST_BIN (decoder), "typefind"); + if (typefind != NULL) + { + /* + * NOTE: the above is not a typo, we can live without the typefind, + * just, our stream detection will not be as accurate as we would. + * Anyway, if this fails, there is some problem, probabily a memory + * error. + */ + g_signal_connect (G_OBJECT (typefind), "have-type", + G_CALLBACK (typefind_callback), properties); + } + + gst_bin_add_many (GST_BIN (pipeline), source, decoder, NULL); + gst_element_link (source, decoder); + + /* + * now, we set the pipeline playing state to pause and traverse it + * to get the info we need. + */ + + res = gst_element_set_state (pipeline, GST_STATE_PAUSED); + if (res == GST_STATE_CHANGE_FAILURE) + { + JCL_free_cstring (env, _file, file); + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + free_properties(properties); + + return JNI_FALSE; + } + + /* (GstClockTime) 300000000 ? */ + res = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + if (res != GST_STATE_CHANGE_SUCCESS) + { + JCL_free_cstring (env, _file, file); + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + free_properties(properties); + + return JNI_FALSE; + } + + result = JNI_FALSE; + if (fill_info (decoder, properties)) + { + result = set_strings (env, GstHeader, properties, header); + } + + /* free stuff */ + JCL_free_cstring (env, _file, file); + gst_element_set_state (pipeline, GST_STATE_NULL); + + gst_object_unref (GST_OBJECT (pipeline)); + + free_properties (properties); + + return result; +} + +/* ***** END: NATIVE FUNCTIONS ***** */ + +/* ***** PRIVATE FUNCTIONS IMPLEMENTATION ***** */ +static gboolean typefind_callback(GstElement *typefind __attribute__ ((unused)), + guint probability __attribute__ ((unused)), + const GstCaps *caps, + gpointer data) +{ + GstStructure *structure = NULL; + AudioProperties *properties = NULL; + + const char *mpeg = NULL; + + properties = (AudioProperties *) data; + + structure = gst_caps_get_structure (caps, 0); + + /* MIMETYPE */ + properties->mimetype = gst_structure_get_name (structure); + mpeg = get_string_property(structure, "mpegversion"); + + if (mpeg != NULL) + { + properties->layer = get_string_property(structure, "layer"); + properties->type = (gchar *) g_malloc0 (_GST_MALLOC_SIZE_); + g_snprintf ((gpointer) properties->type, _GST_MALLOC_SIZE_, + "MPEG%sV%s", mpeg, + properties->layer); + + g_free ((gpointer) mpeg); + } + + return TRUE; +} + +static void +new_decoded_pad (GstElement *decoder __attribute__ ((unused)), + GstPad *pad, + gboolean last __attribute__ ((unused)), + GstElement *pipeline) +{ + GstElement *fakesink = NULL; + GstPad *sinkpad = NULL; + + fakesink = gst_element_factory_make ("fakesink", NULL); + gst_bin_add (GST_BIN (pipeline), fakesink); + + sinkpad = gst_element_get_pad (fakesink, "sink"); + if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sinkpad))) + { + gst_bin_remove (GST_BIN (pipeline), fakesink); + } + else + { + gst_element_set_state (fakesink, GST_STATE_PAUSED); + } +} + +static gboolean +set_strings (JNIEnv *env, const jclass GstHeader, + const AudioProperties *properties, jobject header) +{ + gboolean result = FALSE; + + /* + * we only need at least one of them to be sure we can handle this + * kind of audio data. + */ + + /* now, map our properties to the java class */ + set_string (env, GstHeader, header, "mimetype", properties->mimetype); + + if (set_string (env, GstHeader, header, "endianness", + properties->endianness)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "channels", + properties->channels)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "rate", + properties->rate)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "width", + properties->width)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "depth", + properties->depth)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "isSigned", + properties->signess)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "name", + properties->name)) result = JNI_TRUE; + + /* non primary properties */ + set_string (env, GstHeader, header, "layer", properties->layer); + set_string (env, GstHeader, header, "bitrate", properties->bitrate); + set_string (env, GstHeader, header, "framed", properties->framed); + set_string (env, GstHeader, header, "type", properties->type); + + return result; +} + +static gboolean fill_info (GstElement *decoder, AudioProperties *properties) +{ + GstIterator *it = NULL; + gpointer data = NULL; + gboolean result = FALSE; + + it = gst_element_iterate_src_pads (decoder); + while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) + { + GstPad *pad = GST_PAD (data); + GstCaps *caps; + + GstStructure *structure; + + const gchar *caps_string = NULL; + + caps = gst_pad_get_caps (pad); + caps_string = gst_caps_to_string (caps); + + if (g_str_has_prefix (caps_string, "video")) + { + /* no video support, this is an audio library */ + + g_free ((gpointer) caps_string); + gst_caps_unref (caps); + gst_object_unref (pad); + + continue; + } + + g_free ((gpointer) caps_string); + + structure = gst_caps_get_structure (GST_CAPS (caps), 0); + + /* fill the properties we need */ + + /* SIGNESS */ + properties->signess = get_boolean_property(structure, "signed"); + if (properties->signess != NULL) + { + result = TRUE; + } + + /* ENDIANNESS */ + properties->endianness = get_string_property(structure, "endianness"); + if (properties->endianness != NULL) + { + result = TRUE; + } + + /* CHANNELS */ + properties->channels = get_string_property(structure, "channels"); + if (properties->channels != NULL) + { + result = TRUE; + } + + /* RATE */ + properties->rate = get_string_property(structure, "rate"); + if (properties->rate != NULL) + { + result = TRUE; + } + + /* WIDTH */ + properties->width = get_string_property(structure, "width"); + if (properties->width != NULL) + { + result = TRUE; + } + + /* DEPTH */ + properties->depth = get_string_property(structure, "depth"); + if (properties->depth != NULL) + { + result = TRUE; + } + + gst_caps_unref (caps); + gst_object_unref (pad); + } + + return result; +} + +static void free_properties (AudioProperties *properties) +{ + if (properties->name != NULL) g_free((gpointer) properties->name); + if (properties->endianness != NULL) g_free((gpointer) properties->endianness); + if (properties->channels != NULL) g_free((gpointer) properties->channels); + if (properties->rate != NULL) g_free((gpointer) properties->rate); + if (properties->width != NULL) g_free((gpointer) properties->width); + if (properties->depth != NULL) g_free((gpointer) properties->depth); + if (properties->layer != NULL) g_free((gpointer) properties->layer); + if (properties->bitrate != NULL) g_free((gpointer) properties->bitrate); + if (properties->framed != NULL) g_free((gpointer) properties->framed); + + if (properties != NULL) g_free ((gpointer) properties); +} + +static void reset_properties (AudioProperties *properties) +{ + properties->done = FALSE; + properties->signess = FALSE; + properties->name = NULL; + properties->endianness = NULL; + properties->channels = NULL; + properties->rate = NULL; + properties->width = NULL; + properties->depth = NULL; + properties->layer = NULL; + properties->bitrate = NULL; + properties->framed = NULL; +} + +static gchar *get_string_property (const GstStructure *structure, + const gchar *property) +{ + int props = 0; + gchar *result = NULL; + + if (property == NULL) + { + return NULL; + } + + /* we don't need more */ + result = (gchar *) g_malloc0 (_GST_MALLOC_SIZE_); + if (result == NULL) + { + /* huston, we have a problem here... */ + return NULL; + } + + if (gst_structure_get_int (structure, property, &props)) + { + g_snprintf (result, _GST_MALLOC_SIZE_, "%d", props); + } + else + { + g_free ((gpointer) result); + return NULL; + } + + return result; +} + +static gchar *get_boolean_property (const GstStructure *structure, + const gchar *property) +{ + gchar *result = NULL; + gboolean props = FALSE; + + result = (gchar *) g_malloc0 (_GST_MALLOC_SIZE_); + if (result == NULL) + { + /* huston, we have a problem here... */ + return NULL; + } + + if (gst_structure_get_boolean (structure, property, &props)) + { + g_snprintf (result, _GST_MALLOC_SIZE_, "%s", (props ? "true" : "false" )); + } + else + { + g_free ((gpointer) result); + return NULL; + } + + return result; +} + +static gboolean set_string (JNIEnv *env, const jclass GstHeader, + jobject header, + const char *field, + const gchar *property) +{ + jfieldID _fid = NULL; + jstring property_string_field = NULL; + + if (property == NULL || field == NULL || header == NULL || GstHeader == NULL) + { + return JNI_FALSE; + } + + _fid = (*env)->GetFieldID(env, GstHeader, field, "Ljava/lang/String;"); + if (_fid == NULL) + { + return JNI_FALSE; /* failed to find the field */ + } + + property_string_field = (*env)->NewStringUTF(env, property); + if (property_string_field == NULL) + { + return JNI_FALSE; + } + + (*env)->SetObjectField(env, header, _fid, property_string_field); + + return JNI_TRUE; +} + +static void +element_added (GstBin *bin, GstElement *element, gpointer data) +{ + GstElementFactory *factory; + + factory = gst_element_get_factory (element); + ((AudioProperties *) data)->name = gst_element_factory_get_longname (factory); +} + +/* ***** END: PRIVATE FUNCTIONS IMPLEMENTATION ***** */ diff --git a/libjava/classpath/native/jni/gstreamer-peer/Makefile.am b/libjava/classpath/native/jni/gstreamer-peer/Makefile.am new file mode 100644 index 00000000000..c40170fc3d3 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/Makefile.am @@ -0,0 +1,22 @@ +nativeexeclib_LTLIBRARIES = libgstreamerpeer.la + +libgstreamerpeer_la_SOURCES = GStreamerIOPeer.c \ + gstinputstream.c \ + gstclasspathsrc.c \ + gstclasspathsrc.h \ + gstinputstream.h + +libgstreamerpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo + +libgstreamerpeer_la_LDFLAGS = $(AM_LDFLAGS) @GST_PLUGIN_LDFLAGS@ -avoid-version + +AM_LDFLAGS = @CLASSPATH_MODULE@ @GSTREAMER_LIBS@ @GSTREAMER_BASE_LIBS@ \ + @GSTREAMER_PLUGINS_BASE_LIBS@ @GDK_LIBS@ + +AM_CPPFLAGS = @CLASSPATH_INCLUDES@ + +# We cannot use -Wwrite-strings and the strict flags since +# gstreamer contain broken prototypes (by design). +AM_CFLAGS = @WARNING_CFLAGS@ -Wno-write-strings -Wno-missing-field-initializers \ + @ERROR_CFLAGS@ -Wno-unused-parameter @GSTREAMER_BASE_CFLAGS@ \ + @GDK_CFLAGS@ @GSTREAMER_CFLAGS@ @GSTREAMER_PLUGINS_BASE_CFLAGS@ diff --git a/libjava/classpath/native/jni/gstreamer-peer/Makefile.in b/libjava/classpath/native/jni/gstreamer-peer/Makefile.in new file mode 100644 index 00000000000..7d752f91f11 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/Makefile.in @@ -0,0 +1,640 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = native/jni/gstreamer-peer +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \ + $(top_srcdir)/../../config/lead-dot.m4 \ + $(top_srcdir)/../../config/multi.m4 \ + $(top_srcdir)/../../config/no-executables.m4 \ + $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \ + $(top_srcdir)/m4/acinclude.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/ax_func_which_gethostbyname_r.m4 \ + $(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(nativeexeclibdir)" +nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(nativeexeclib_LTLIBRARIES) +libgstreamerpeer_la_DEPENDENCIES = \ + $(top_builddir)/native/jni/classpath/jcl.lo +am_libgstreamerpeer_la_OBJECTS = GStreamerIOPeer.lo gstinputstream.lo \ + gstclasspathsrc.lo +libgstreamerpeer_la_OBJECTS = $(am_libgstreamerpeer_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/../../depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgstreamerpeer_la_SOURCES) +DIST_SOURCES = $(libgstreamerpeer_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@ +BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@ +CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@ +CLASSPATH_MODULE = @CLASSPATH_MODULE@ +COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@ +CP = @CP@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@ +CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@ +CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@ +CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@ +CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@ +CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@ +CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@ +CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@ +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@ +CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@ +CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@ +CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@ +CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@ +CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@ +CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@ +CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@ +CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@ +CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@ +CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@ +CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATE = @DATE@ +DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECJ = @ECJ@ +ECJ_JAR = @ECJ_JAR@ +EGREP = @EGREP@ +ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@ +ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXAMPLESDIR = @EXAMPLESDIR@ +EXEEXT = @EXEEXT@ +FASTJAR = @FASTJAR@ +FGREP = @FGREP@ +FIND = @FIND@ +FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ +FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ +FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ +FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@ +FOUND_JAVAC_FALSE = @FOUND_JAVAC_FALSE@ +FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@ +FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@ +FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@ +FOUND_KJC_FALSE = @FOUND_KJC_FALSE@ +FOUND_KJC_TRUE = @FOUND_KJC_TRUE@ +FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ +FREETYPE2_LIBS = @FREETYPE2_LIBS@ +GCJ = @GCJ@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GDK_CFLAGS = @GDK_CFLAGS@ +GDK_LIBS = @GDK_LIBS@ +GENINSRC_FALSE = @GENINSRC_FALSE@ +GENINSRC_TRUE = @GENINSRC_TRUE@ +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@ +INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@ +INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@ +INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JAVAC = @JAVAC@ +JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@ +JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@ +JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@ +JAY = @JAY@ +JAY_SKELETON = @JAY_SKELETON@ +JIKES = @JIKES@ +JIKESENCODING = @JIKESENCODING@ +JIKESWARNINGS = @JIKESWARNINGS@ +KJC = @KJC@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDEBUG = @LIBDEBUG@ +LIBICONV = @LIBICONV@ +LIBMAGIC = @LIBMAGIC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBVERSION = @LIBVERSION@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKDIR = @MKDIR@ +MOC = @MOC@ +MOZILLA_CFLAGS = @MOZILLA_CFLAGS@ +MOZILLA_LIBS = @MOZILLA_LIBS@ +NM = @NM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@ +PANGOFT2_LIBS = @PANGOFT2_LIBS@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PATH_TO_ESCHER = @PATH_TO_ESCHER@ +PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGIN_DIR = @PLUGIN_DIR@ +QT_CFLAGS = @QT_CFLAGS@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@ +REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@ +REMOVE = @REMOVE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@ +STRIP = @STRIP@ +USER_CLASSLIB = @USER_CLASSLIB@ +USER_JAVAH = @USER_JAVAH@ +USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ +USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ +USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ +USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ +USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ +USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@ +VERSION = @VERSION@ +VM_BINARY = @VM_BINARY@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +XSLT_CFLAGS = @XSLT_CFLAGS@ +XSLT_LIBS = @XSLT_LIBS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ZIP = @ZIP@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +default_toolkit = @default_toolkit@ +exec_prefix = @exec_prefix@ +glibjdir = @glibjdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +multi_basedir = @multi_basedir@ +nativeexeclibdir = @nativeexeclibdir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexeclibdir = @toolexeclibdir@ +vm_classes = @vm_classes@ +nativeexeclib_LTLIBRARIES = libgstreamerpeer.la +libgstreamerpeer_la_SOURCES = GStreamerIOPeer.c \ + gstinputstream.c \ + gstclasspathsrc.c \ + gstclasspathsrc.h \ + gstinputstream.h + +libgstreamerpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo +libgstreamerpeer_la_LDFLAGS = $(AM_LDFLAGS) @GST_PLUGIN_LDFLAGS@ -avoid-version +AM_LDFLAGS = @CLASSPATH_MODULE@ @GSTREAMER_LIBS@ @GSTREAMER_BASE_LIBS@ \ + @GSTREAMER_PLUGINS_BASE_LIBS@ @GDK_LIBS@ + +AM_CPPFLAGS = @CLASSPATH_INCLUDES@ + +# We cannot use -Wwrite-strings and the strict flags since +# gstreamer contain broken prototypes (by design). +AM_CFLAGS = @WARNING_CFLAGS@ -Wno-write-strings -Wno-missing-field-initializers \ + @ERROR_CFLAGS@ -Wno-unused-parameter @GSTREAMER_BASE_CFLAGS@ \ + @GDK_CFLAGS@ @GSTREAMER_CFLAGS@ @GSTREAMER_PLUGINS_BASE_CFLAGS@ + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/gstreamer-peer/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu native/jni/gstreamer-peer/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)" + @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \ + else :; fi; \ + done + +uninstall-nativeexeclibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \ + done + +clean-nativeexeclibLTLIBRARIES: + -test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES) + @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgstreamerpeer.la: $(libgstreamerpeer_la_OBJECTS) $(libgstreamerpeer_la_DEPENDENCIES) + $(LINK) -rpath $(nativeexeclibdir) $(libgstreamerpeer_la_LDFLAGS) $(libgstreamerpeer_la_OBJECTS) $(libgstreamerpeer_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GStreamerIOPeer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstclasspathsrc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstinputstream.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-nativeexeclibLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-nativeexeclibLTLIBRARIES install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-nativeexeclibLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c new file mode 100644 index 00000000000..afce1f1d4c2 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c @@ -0,0 +1,332 @@ +/*gstclasspathsrc.c - Class file for the GstClasspathPlugin + 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* + * We don't really use version numbering here, we give it the same version + * number of classpath, so that gstreamer is happy. + * TODO: Maybe this should be moved in config.h instead? + */ +#define CLASSPATH_GST_PLUGIN_VERSION PACKAGE_VERSION + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include "gstclasspathsrc.h" +#include "gstinputstream.h" + +GST_DEBUG_CATEGORY_STATIC (gst_classpath_src_debug); +#define GST_CAT_DEFAULT gst_classpath_src_debug + +enum +{ + ARG_0, + ARG_INPUTSTREAM +}; + +static const GstElementDetails gst_classpath_src_details = +GST_ELEMENT_DETAILS ("ClasspathSrc", + "Source/Network", + "Read from a java input stream", + "Mario Torre "); + +static GstStaticPadTemplate _template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +/* ***** plugin init ***** */ + +static void +_do_init (GType filesrc_type __attribute__ ((unused))) +{ + GST_DEBUG_CATEGORY_INIT (gst_classpath_src_debug, "classpathsrc", + 0, "classpathsrc"); +} + +GST_BOILERPLATE_FULL (GstClasspathSrc, gst_classpath_src, GstPushSrc, + GST_TYPE_PUSH_SRC, _do_init); + +static gboolean +plugin_init (GstPlugin *plugin) +{ + return gst_element_register (plugin, "classpathsrc", + GST_RANK_NONE, GST_TYPE_CLASSPATH_SRC); +} + +GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "classpathsrc", + "Java InputStream Reader", + plugin_init, CLASSPATH_GST_PLUGIN_VERSION, + GST_LICENSE_UNKNOWN, + "Classpath", "http://www.classpath.org/") + +/* ***** public class methods ***** */ + +static void gst_classpath_src_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); + +static void gst_classpath_src_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +static void gst_classpath_src_finalize (GObject *object); + +static gboolean gst_classpath_src_start (GstBaseSrc *basesrc); + +static gboolean gst_classpath_src_stop (GstBaseSrc *basesrc); + +static GstFlowReturn gst_classpath_src_create (GstPushSrc *src, + GstBuffer **buffer); + +/* ***** public class methods: end ***** */ + +static void +gst_classpath_src_base_init (gpointer gclass) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (gclass); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&_template)); + + gst_element_class_set_details (gstelement_class, &gst_classpath_src_details); +} + +static void +gst_classpath_src_class_init (GstClasspathSrcClass *klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstBaseSrcClass *gstbasesrc_class; + GstPushSrcClass *gstpushsrc_class; + + GParamSpec *pspec; + + gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); + gstbasesrc_class = GST_BASE_SRC_CLASS (klass); + gstpushsrc_class = GST_PUSH_SRC_CLASS (klass); + + /* getter and setters */ + + gobject_class->set_property = gst_classpath_src_set_property; + gobject_class->get_property = gst_classpath_src_get_property; + + /* register properties */ + pspec = g_param_spec_pointer (GST_CLASSPATH_SRC_ISTREAM, + "GstInputStream instance", + "GstInputStream instance", + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, ARG_INPUTSTREAM, pspec); + + /* register callbacks */ + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_classpath_src_finalize); + + gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_classpath_src_start); + gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_classpath_src_stop); + + gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_classpath_src_create); +} + +/* ***** */ + +static void +gst_classpath_src_init (GstClasspathSrc *src, + GstClasspathSrcClass * g_class __attribute__ ((unused))) +{ + src->istream = NULL; + src->read_position = 0; +} + +static void +gst_classpath_src_finalize (GObject *object) +{ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/* ************************************************************************** */ + +static void +gst_classpath_src_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstClasspathSrc *src; + + g_return_if_fail (GST_IS_CLASSPATH_SRC (object)); + + src = GST_CLASSPATH_SRC (object); + + GST_OBJECT_LOCK (src); + switch (prop_id) + { + case ARG_INPUTSTREAM: + { + GST_STATE_LOCK (src); + { + GstState state; + state = GST_STATE (src); + + if (state != GST_STATE_READY && state != GST_STATE_NULL) + { + GST_DEBUG_OBJECT (src, "setting location in wrong state"); + GST_STATE_UNLOCK (src); + break; + } + } + GST_STATE_UNLOCK (src); + + if (GST_IS_INPUT_STREAM (g_value_get_pointer (value))) + { + src->istream = g_value_get_pointer (value); + } + else + { + GST_INFO_OBJECT (src, "invalid instance of GstInputStream"); + } + } + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + GST_OBJECT_UNLOCK (src); +} + +static void +gst_classpath_src_get_property (GObject *object, + guint prop_id __attribute__ ((unused)), + GValue *value __attribute__ ((unused)), + GParamSpec *pspec __attribute__ ((unused))) +{ + /* TODO */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/* ************************************************************************** */ + +static GstFlowReturn +gst_classpath_src_create (GstPushSrc *basesrc, + GstBuffer **buffer) +{ + GstClasspathSrc *src; + int read = -1; + + src = GST_CLASSPATH_SRC (basesrc); + + /* create the buffer */ + *buffer = gst_buffer_new_and_alloc (2048); + if (*buffer == NULL) + { + return GST_FLOW_ERROR; + } + + GST_BUFFER_SIZE (*buffer) = 0; + + GST_OBJECT_LOCK (src); + read = gst_input_stream_read (src->istream, (int *) GST_BUFFER_DATA (*buffer), 0, + 2048); + GST_OBJECT_UNLOCK (src); + + if (G_UNLIKELY (read < 0)) + { + gst_buffer_unref (*buffer); + return GST_FLOW_UNEXPECTED; + } + + GST_OBJECT_LOCK (src); + + GST_BUFFER_SIZE (*buffer) = read; + GST_BUFFER_OFFSET (*buffer) = src->read_position; + GST_BUFFER_OFFSET_END (*buffer) = src->read_position + read; + + src->read_position += read; + + GST_OBJECT_UNLOCK (src); + + gst_buffer_set_caps (*buffer, GST_PAD_CAPS (GST_BASE_SRC_PAD (src))); + + return GST_FLOW_OK; +} + +static gboolean +gst_classpath_src_start (GstBaseSrc *basesrc) +{ + GstClasspathSrc *src; + + src = GST_CLASSPATH_SRC (basesrc); + + if (src->istream == NULL) + { + GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), + ("GstInputStream is still null. you need to pass a valid InputStream")); + + return FALSE; + } + GST_OBJECT_LOCK (src); + src->read_position = 0; + GST_OBJECT_UNLOCK (src); + + return TRUE; +} + +static gboolean +gst_classpath_src_stop (GstBaseSrc *basesrc __attribute__ ((unused))) +{ + /* nothing to do */ + return TRUE; +} diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h new file mode 100644 index 00000000000..f5fa6c83d4f --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h @@ -0,0 +1,88 @@ +/*gstclasspathsrc.h - Header file for the GstClasspathPlugin + 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. */ + +#ifndef __GST_CLASSPATH_SRC_H__ +#define __GST_CLASSPATH_SRC_H__ + +#include +#include + +#include "gstinputstream.h" + +G_BEGIN_DECLS + +/* #defines don't like whitespacey bits */ +#define GST_TYPE_CLASSPATH_SRC (gst_classpath_src_get_type()) + +#define GST_CLASSPATH_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CLASSPATH_SRC,GstClasspathSrc)) + +#define GST_CLASSPATH_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CLASSPATH_SRC,GstClasspathSrcClass)) + +#define GST_IS_CLASSPATH_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CLASSPATH_SRC)) + +#define GST_IS_CLASSPATH_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CLASSPATH_SRC)) + +typedef struct _GstClasspathSrc GstClasspathSrc; +typedef struct _GstClasspathSrcClass GstClasspathSrcClass; + +struct _GstClasspathSrc +{ + GstPushSrc element; + + /* TODO: move in a private structure */ + GstInputStream *istream; + int read_position; +}; + +struct _GstClasspathSrcClass +{ + GstPushSrcClass parent_class; +}; + +GType gst_classpath_src_get_type (void); + +/* exported properties */ + +#define GST_CLASSPATH_SRC_ISTREAM "input-stream" + +G_END_DECLS + +#endif /* __GST_CLASSPATH_SRC_H__ */ diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c new file mode 100644 index 00000000000..eb4969682f8 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c @@ -0,0 +1,494 @@ +/*gstinputstream.c - Header file for the GstClasspathPlugin + 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 +#include + +#include +#include + +#include + +#include +#include + +#include "gstinputstream.h" + +struct _GstInputStreamPrivate +{ + JavaVM *vm; + jobject *reader; + + gboolean eof; + guint8 *buffer; + long size; + long length; + + gboolean disposed; +}; + +#define INPUT_STREAM_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_INPUT_STREAM, GstInputStreamPrivate)) + +/* properties */ + +enum +{ + ARG_0, + ARG_JVM, + ARG_READER +}; + +/* ***** */ + +static JNIEnv *gst_input_stream_get_jenv(GstInputStream *self); + +static void gst_input_stream_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); + +static void gst_input_stream_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +static void gst_input_stream_instance_init (GTypeInstance *instance, + gpointer g_class); + +static void gst_input_stream_class_init (gpointer g_class, + gpointer g_class_data); + +static GObject * +gst_input_stream_constructor (GType type, guint n_construct_properties, + GObjectConstructParam *construct_properties); + +static void +gst_input_stream_dispose (GObject *obj); + +static void +gst_input_stream_finalize (GObject *obj); + +/* ************************************************************************** */ + +/* class methods */ + +int +gst_input_stream_read (GstInputStream *self, int *data, int offset, + int length) +{ + /* TODO: cache */ + jmethodID _readID = NULL; + jclass InputStream = NULL; + + JNIEnv *env = NULL; + + int ret = -1; + jbyteArray buffer; + jbyte *bytes = NULL; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return -1; + } + + env = gst_input_stream_get_jenv (self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_read failed to get java env"); + return -1; + } + + buffer = (*env)->NewByteArray (env, length); + if (buffer == NULL) + { + g_warning ("GstInputStream::gst_input_stream_read called, failed"); + return -1; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _readID = (*env)->GetMethodID(env, InputStream, "read", "([BII)I"); + if (_readID == NULL) + { + (*env)->DeleteLocalRef(env, buffer); + return -1; + } + + ret = (*env)->CallIntMethod (env, self->priv->reader, _readID, buffer, 0, + length); + if (ret == -1) + { + (*env)->DeleteLocalRef(env, buffer); + return ret; + } + + bytes = (*env)->GetByteArrayElements (env, buffer, NULL); + + /* copy bytes and release */ + memcpy (data + offset, bytes, ret); + + (*env)->ReleaseByteArrayElements (env, buffer, bytes, 0); + (*env)->DeleteLocalRef (env, buffer); + + return ret; +} + +gboolean +gst_input_stream_available (GstInputStream *self, guint64 *size) +{ + /* TODO: caching */ + + jmethodID _availableID = NULL; + jclass InputStream = NULL; + JNIEnv *env = NULL; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return FALSE; + } + + env = gst_input_stream_get_jenv(self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_available failed to get java env"); + return FALSE; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _availableID = (*env)->GetMethodID(env, InputStream, "available", "()I"); + if (_availableID == NULL) + { + return FALSE; + } + + *size = (*env)->CallIntMethod (env, self->priv->reader, _availableID); + + return TRUE; +} + +void gst_input_stream_reset (GstInputStream *self) +{ + jmethodID _resetID = NULL; + jclass InputStream = NULL; + JNIEnv *env = NULL; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return; + } + + env = gst_input_stream_get_jenv(self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_reset failed to get java env"); + return; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _resetID = (*env)->GetMethodID(env, InputStream, "reset", "()V"); + if (_resetID == NULL) + { + return; + } + + (*env)->CallVoidMethod (env, self->priv->reader, _resetID); +} + +long gst_input_stream_skip (GstInputStream *self, long size) +{ + jmethodID _seekID = NULL; + jclass InputStream = NULL; + JNIEnv *env = NULL; + + long skipped = -1; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return skipped; + } + + env = gst_input_stream_get_jenv(self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_skip failed to get java env"); + return size; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _seekID = (*env)->GetMethodID(env, InputStream, "skip", "(J)J"); + if (_seekID == NULL) + { + return skipped; + } + + size = (*env)->CallIntMethod (env, self->priv->reader, _seekID, size); + if (size != 0) + { + return skipped; + } + + return skipped; +} + +gboolean gst_input_stream_can_seek (GstInputStream *self) +{ + if (gst_input_stream_skip(self, 0) != 0) + { + g_warning ("GstInputStream::gst_input_stream_can_seek CANNOT seek"); + return FALSE; + } + + return TRUE; +} + +/* ************************************************************************** */ + +/* getter and setter */ + +static void +gst_input_stream_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GstInputStream *self = GST_INPUT_STREAM (object); + + switch (property_id) + { + case ARG_JVM: + { + self->priv->vm = g_value_get_pointer(value); + } + break; + + case ARG_READER: + { + self->priv->reader = g_value_get_pointer(value); + } + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); + break; + } /* switch */ +} + +static void +gst_input_stream_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GstInputStream *self = GST_INPUT_STREAM (object); + + switch (property_id) + { + case ARG_JVM: + { + g_value_set_pointer (value, self->priv->vm); + } + break; + + case ARG_READER: + { + g_value_set_pointer (value, self->priv->reader); + } + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); + break; + } /* switch */ +} + +/* ************************************************************************** */ + +static void +gst_input_stream_instance_init (GTypeInstance *instance, + gpointer g_class __attribute__ ((unused))) +{ + GstInputStream *self = GST_INPUT_STREAM (instance); + + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_INPUT_STREAM, + GstInputStreamPrivate); + + self->priv->vm = NULL; + self->priv->reader = NULL; + self->priv->disposed = FALSE; + self->priv->eof = FALSE; + self->priv->buffer = NULL; + self->priv->size = 0; + self->priv->length = 0; +} + +static void +gst_input_stream_class_init (gpointer g_class, + gpointer g_class_data __attribute__ ((unused))) +{ + GObjectClass *gobject_class; + GstInputStreamClass *klass; + GObjectClass *parent_class; + + GParamSpec *pspec; + + gobject_class = G_OBJECT_CLASS (g_class); + klass = GST_INPUT_STREAM_CLASS (g_class); + gobject_class = G_OBJECT_CLASS (g_class); + + g_type_class_add_private (klass, sizeof (GstInputStreamPrivate)); + + gobject_class->set_property = gst_input_stream_set_property; + gobject_class->get_property = gst_input_stream_get_property; + gobject_class->dispose = gst_input_stream_dispose; + gobject_class->finalize = gst_input_stream_finalize; + gobject_class->constructor = gst_input_stream_constructor; + + parent_class = g_type_class_peek_parent (klass); + + /* register properties */ + pspec = g_param_spec_pointer (GST_ISTREAM_JVM, + "Set the java environment property", + "Set the java environment property", + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, ARG_JVM, pspec); + + pspec = g_param_spec_pointer (GST_ISTREAM_READER, + "Set the java reader property", + "Set the java reader property", + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, ARG_READER, pspec); + +} + +/* class constructors */ + +static GObject * +gst_input_stream_constructor (GType type, guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GObject *obj; + GObjectClass *parent_class; + + /* parent */ + GstInputStreamClass *klass; + klass = GST_INPUT_STREAM_CLASS (g_type_class_peek (GST_TYPE_INPUT_STREAM)); + parent_class = g_type_class_peek_parent (klass); + obj = parent_class->constructor (type, n_construct_properties, + construct_properties); + return obj; +} + +static void +gst_input_stream_dispose (GObject *obj) +{ + GObjectClass *parent_class; + GstInputStream *self = GST_INPUT_STREAM (obj); + if (self->priv->disposed) + { + /* If dispose did already run, return. */ + return; + } + + /* Make sure dispose does not run twice. */ + self->priv->disposed = TRUE; + + if (self->priv->buffer != NULL) + g_free(self->priv->buffer); + + /* Chain up to the parent class */ + parent_class = g_type_class_peek_parent (GST_INPUT_STREAM_CLASS (obj)); + G_OBJECT_CLASS (parent_class)->dispose (obj); +} + +static void +gst_input_stream_finalize (GObject *obj) +{ + /* nothing else to do */ + GObjectClass *parent_class = + g_type_class_peek_parent (GST_INPUT_STREAM_CLASS (obj)); + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +static JNIEnv * +gst_input_stream_get_jenv(GstInputStream *self) +{ + void *env = NULL; + + if ((*self->priv->vm)->GetEnv(self->priv->vm, &env, JNI_VERSION_1_2) != JNI_OK) + { + if ((*self->priv->vm)->AttachCurrentThreadAsDaemon(self->priv->vm, + &env, NULL) < 0) + { + g_warning ("GstInputStream:- env not attached"); + return NULL; + } + } + + return (JNIEnv *) env; +} + +GType gst_input_stream_get_type (void) +{ + static GType type = 0; + + if (type == 0) + { + static const GTypeInfo info = { + sizeof (GstInputStreamClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + gst_input_stream_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GstInputStream), + 0, /* n_preallocs */ + gst_input_stream_instance_init /* instance_init */ + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "GstInputStreamType", + &info, 0); + } + + return type; +} diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h new file mode 100644 index 00000000000..1930412fe16 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h @@ -0,0 +1,99 @@ +/*gstinputstream.h - Header file for the GstClasspathPlugin + 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. */ + +#ifndef __GST_INPUT_STREAM_H__ +#define __GST_INPUT_STREAM_H__ + +#include + +/* TODO: is a gobject overkill for that? */ + +G_BEGIN_DECLS + +/* #defines don't like whitespacey bits */ +#define GST_TYPE_INPUT_STREAM (gst_input_stream_get_type()) + +#define GST_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INPUT_STREAM,GstInputStream)) + +#define GST_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_INPUT_STREAM,GstInputStreamClass)) + +#define GST_IS_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INPUT_STREAM)) + +#define GST_IS_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_INPUT_STREAM)) + +typedef struct _GstInputStream GstInputStream; +typedef struct _GstInputStreamClass GstInputStreamClass; +typedef struct _GstInputStreamPrivate GstInputStreamPrivate; + +struct _GstInputStream +{ + GObject parent; + + /* instance members */ + GstInputStreamPrivate *priv; +}; + +struct _GstInputStreamClass +{ + GObjectClass parent_class; +}; + +GType gst_input_stream_get_type (void); + +int gst_input_stream_read (GstInputStream *self, int *data, int offset, + int length); + +gboolean gst_input_stream_available (GstInputStream *self, guint64 *size); + +gboolean gst_input_stream_can_seek (GstInputStream *self); + +long gst_input_stream_skip (GstInputStream *self, long size); + +void gst_input_stream_reset (GstInputStream *self); + +/* exported properties */ + +#define GST_ISTREAM_JVM "vm" +#define GST_ISTREAM_READER "reader" + +G_END_DECLS + +#endif /* __GST_INPUT_STREAM_H__ */ 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 #include @@ -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 #include #include -#include "native_state.h" #include #include 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 #include -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 #include #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 #include #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, "", "(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 #include -#include "native_state.h" #include "gnu_java_awt_peer_gtk_GdkPixbufDecoder.h" #include #include -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 "", "(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 "", "(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, "", "(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 @@ -39,6 +39,13 @@ exception statement from your version. */ #include "gtkpeer.h" #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, "", + "(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, "", + "(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 #include #include -#include "native_state.h" #include #include @@ -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); diff --git a/libjava/classpath/native/jni/java-io/Makefile.in b/libjava/classpath/native/jni/java-io/Makefile.in index a3c39829e6b..42bb7cd4a37 100644 --- a/libjava/classpath/native/jni/java-io/Makefile.in +++ b/libjava/classpath/native/jni/java-io/Makefile.in @@ -127,6 +127,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@ @@ -165,8 +167,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@ @@ -190,6 +190,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@ @@ -262,8 +271,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@ diff --git a/libjava/classpath/native/jni/java-lang/Makefile.in b/libjava/classpath/native/jni/java-lang/Makefile.in index 3c8780471e1..a7b436b5e49 100644 --- a/libjava/classpath/native/jni/java-lang/Makefile.in +++ b/libjava/classpath/native/jni/java-lang/Makefile.in @@ -141,6 +141,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@ @@ -179,8 +181,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@ @@ -204,6 +204,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@ @@ -276,8 +285,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@ diff --git a/libjava/classpath/native/jni/java-net/Makefile.in b/libjava/classpath/native/jni/java-net/Makefile.in index b2f7efced6e..3fdf64d3d2c 100644 --- a/libjava/classpath/native/jni/java-net/Makefile.in +++ b/libjava/classpath/native/jni/java-net/Makefile.in @@ -137,6 +137,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@ @@ -175,8 +177,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@ @@ -200,6 +200,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@ @@ -272,8 +281,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@ diff --git a/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c b/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c index cdfbe739789..a59604c04af 100644 --- a/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c +++ b/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c @@ -69,6 +69,7 @@ exception statement from your version. */ #include "gnu_java_net_VMPlainSocketImpl.h" #define THROW_NO_NETWORK(env) JCL_ThrowException (env, "java/lang/InternalError", "this platform not configured for network support") +#define THROW_NO_IPV6(env) JCL_ThrowException (env, "java/lang/InternalError", "IPv6 support not available") /* * Class: gnu_java_net_VMPlainSocketImpl @@ -120,7 +121,7 @@ Java_gnu_java_net_VMPlainSocketImpl_bind6 (JNIEnv *env, jclass c __attribute__((unused)), jint fd, jbyteArray addr, jint port) { - /* FIXME! Add check if we have IPv6! */ +#ifdef HAVE_INET6 struct sockaddr_in6 sockaddr; jbyte *elems; int ret; @@ -141,6 +142,9 @@ Java_gnu_java_net_VMPlainSocketImpl_bind6 (JNIEnv *env, if (-1 == ret) JCL_ThrowException (env, IO_EXCEPTION, strerror (errno)); +#else + THROW_NO_IPV6(env); +#endif } @@ -442,8 +446,7 @@ Java_gnu_java_net_VMPlainSocketImpl_setMulticastInterface6 (JNIEnv *env, #endif /* HAVE_INET6 */ #else (void) fd; - JCL_ThrowException (env, "java/lang/InternalError", - "socket options not supported"); + THROW_NO_IPV6(env); #endif /* HAVE_SETSOCKOPT */ } @@ -582,8 +585,7 @@ Java_gnu_java_net_VMPlainSocketImpl_join6 (JNIEnv *env, #else (void) fd; (void) addr; - JCL_ThrowException (env, "java/lang/InternalError", - "IPv6 support not available"); + THROW_NO_IPV6(env); #endif /* HAVE_INET6 */ #else (void) fd; @@ -657,8 +659,7 @@ Java_gnu_java_net_VMPlainSocketImpl_leave6 (JNIEnv *env, #else (void) fd; (void) addr; - JCL_ThrowException (env, "java/lang/InternalError", - "IPv6 support not available"); + THROW_NO_IPV6(env); #endif /* HAVE_INET6 */ #else (void) fd; @@ -763,8 +764,7 @@ Java_gnu_java_net_VMPlainSocketImpl_joinGroup6 (JNIEnv *env, #else (void) fd; (void) addr; - JCL_ThrowException (env, "java/lang/InternalError", - "IPv6 support not available"); + THROW_NO_IPV6(env); #endif /* HAVE_INET6 */ #else (void) fd; @@ -865,8 +865,7 @@ Java_gnu_java_net_VMPlainSocketImpl_leaveGroup6 (JNIEnv *env, #else (void) fd; (void) addr; - JCL_ThrowException (env, "java/lang/InternalError", - "IPv6 support not available"); + THROW_NO_IPV6(env); #endif /* HAVE_INET6 */ #else (void) fd; diff --git a/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c b/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c index fc921ecef1f..43f2d9146dd 100644 --- a/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c +++ b/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c @@ -163,10 +163,12 @@ Java_java_net_VMInetAddress_getHostByAddr (JNIEnv * env, addr = cpnet_newIPV4Address(env); cpnet_bytesToIPV4Address (addr, octets); break; +#ifdef HAVE_INET6 case 16: addr = cpnet_newIPV6Address(env); cpnet_bytesToIPV6Address (addr, octets); break; +#endif default: JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Bad IP Address"); return (jstring) NULL; @@ -245,9 +247,9 @@ Java_java_net_VMInetAddress_getHostByName (JNIEnv * env, /* Now loop and copy in each address */ for (i = 0; i < addresses_count; i++) { - if (cpnet_isIPV6Address (addresses[i])) + if (cpnet_isIPV4Address (addresses[i])) { - ret_octets = (*env)->NewByteArray (env, 16); + ret_octets = (*env)->NewByteArray (env, 4); if (!ret_octets) { @@ -258,15 +260,16 @@ Java_java_net_VMInetAddress_getHostByName (JNIEnv * env, octets = (*env)->GetByteArrayElements (env, ret_octets, 0); - cpnet_IPV6AddressToBytes (addresses[i], octets); + cpnet_IPV4AddressToBytes (addresses[i], octets); (*env)->ReleaseByteArrayElements (env, ret_octets, octets, 0); (*env)->SetObjectArrayElement (env, addrs, i, ret_octets); } - else if (cpnet_isIPV4Address (addresses[i])) +#ifdef HAVE_INET6 + else if (cpnet_isIPV6Address (addresses[i])) { - ret_octets = (*env)->NewByteArray (env, 4); + ret_octets = (*env)->NewByteArray (env, 16); if (!ret_octets) { @@ -277,12 +280,13 @@ Java_java_net_VMInetAddress_getHostByName (JNIEnv * env, octets = (*env)->GetByteArrayElements (env, ret_octets, 0); - cpnet_IPV4AddressToBytes (addresses[i], octets); + cpnet_IPV6AddressToBytes (addresses[i], octets); (*env)->ReleaseByteArrayElements (env, ret_octets, octets, 0); (*env)->SetObjectArrayElement (env, addrs, i, ret_octets); } +#endif else { JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Internal Error"); @@ -336,9 +340,9 @@ Java_java_net_VMInetAddress_aton (JNIEnv *env, if (!address) return (jbyteArray) NULL; - if (cpnet_isIPV6Address (address)) + if (cpnet_isIPV4Address (address)) { - ret_octets = (jbyteArray) (*env)->NewByteArray (env, 16); + ret_octets = (jbyteArray) (*env)->NewByteArray (env, 4); if (!ret_octets) { @@ -349,13 +353,14 @@ Java_java_net_VMInetAddress_aton (JNIEnv *env, octets = (*env)->GetByteArrayElements (env, ret_octets, 0); - cpnet_IPV6AddressToBytes (address, octets); + cpnet_IPV4AddressToBytes (address, octets); (*env)->ReleaseByteArrayElements (env, ret_octets, octets, 0); } - else if (cpnet_isIPV4Address (address)) +#ifdef HAVE_INET6 + else if (cpnet_isIPV6Address (address)) { - ret_octets = (jbyteArray) (*env)->NewByteArray (env, 4); + ret_octets = (jbyteArray) (*env)->NewByteArray (env, 16); if (!ret_octets) { @@ -366,10 +371,11 @@ Java_java_net_VMInetAddress_aton (JNIEnv *env, octets = (*env)->GetByteArrayElements (env, ret_octets, 0); - cpnet_IPV4AddressToBytes (address, octets); + cpnet_IPV6AddressToBytes (address, octets); (*env)->ReleaseByteArrayElements (env, ret_octets, octets, 0); } +#endif else { JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Internal Error"); diff --git a/libjava/classpath/native/jni/java-net/javanet.c b/libjava/classpath/native/jni/java-net/javanet.c index 1d2f7202a17..1f093f4aa72 100644 --- a/libjava/classpath/native/jni/java-net/javanet.c +++ b/libjava/classpath/native/jni/java-net/javanet.c @@ -395,10 +395,12 @@ _javanet_get_ip_netaddr (JNIEnv * env, jobject addr) netaddr = cpnet_newIPV4Address(env); cpnet_bytesToIPV4Address(netaddr, octets); break; +#ifdef HAVE_INET6 case 16: netaddr = cpnet_newIPV6Address(env); cpnet_bytesToIPV6Address(netaddr, octets); break; +#endif default: /* This should not happen as we have checked before. * But that way we shut the compiler warnings */ diff --git a/libjava/classpath/native/jni/java-nio/Makefile.in b/libjava/classpath/native/jni/java-nio/Makefile.in index bf6243ed4be..390a278da60 100644 --- a/libjava/classpath/native/jni/java-nio/Makefile.in +++ b/libjava/classpath/native/jni/java-nio/Makefile.in @@ -135,6 +135,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@ @@ -173,8 +175,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@ @@ -198,6 +198,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@ @@ -270,8 +279,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@ diff --git a/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c b/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c index c8df841a1d6..a5bbd71262c 100644 --- a/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c +++ b/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c @@ -771,6 +771,10 @@ Java_gnu_java_nio_VMChannel_receive (JNIEnv *env, if (JCL_init_buffer (env, &buf, dst) == -1) JCL_ThrowException (env, IO_EXCEPTION, "loading buffer failed"); +#ifndef HAVE_MSG_WAITALL +#define MSG_WAITALL 0 +#endif + ret = cpnio_recvfrom (fd, &(buf.ptr[buf.position + buf.offset]), buf.limit - buf.position, MSG_WAITALL, sockaddr, &slen); @@ -1582,14 +1586,84 @@ Java_gnu_java_nio_VMChannel_available (JNIEnv *env, jclass c __attribute__((unused)), jint fd) { +#if defined (FIONREAD) + jint avail = 0; +#if defined(ENOTTY) && defined(HAVE_FSTAT) + struct stat statBuffer; + off_t n; +#endif + /* NIODBG("fd: %d", fd); */ if (ioctl (fd, FIONREAD, &avail) == -1) - JCL_ThrowException (env, IO_EXCEPTION, strerror (errno)); + { +#if defined(ENOTTY) && defined(HAVE_FSTAT) + if (errno == ENOTTY) + { + if ((fstat (fd, &statBuffer) == 0) && S_ISREG (statBuffer.st_mode)) + { + n = lseek (fd, 0, SEEK_CUR); + if (n != -1) + { + avail = statBuffer.st_size - n; + return avail; + } + } + } +#endif + JCL_ThrowException (env, IO_EXCEPTION, strerror (errno)); + } /* NIODBG("avail: %d", avail); */ return avail; + +#elif defined(HAVE_FSTAT) + + jint avail = 0; + + struct stat statBuffer; + off_t n; + + if ((fstat (fd, &statBuffer) == 0) && S_ISREG (statBuffer.st_mode)) + { + n = lseek (fd, 0, SEEK_CUR); + if (n != -1) + { + avail = statBuffer.st_size - n; + return avail; + } + } + JCL_ThrowException (env, IO_EXCEPTION, strerror (errno)); + +#elif defined(HAVE_SELECT) + + jint avail = 0; + fd_set filedescriptset; + struct timeval tv; + + FD_ZERO (&filedescriptset); + FD_SET (fd,&filedescriptset); + memset (&tv, 0, sizeof(tv)); + + switch (select (fd+1, &filedescriptset, NULL, NULL, &tv)) + { + case -1: + break; + case 0: + avail = 0; + return avail; + default: + avail = 1; + return avail; + } + JCL_ThrowException (env, IO_EXCEPTION, strerror (errno)); + +#else + + JCL_ThrowException (env, IO_EXCEPTION, "No native method for available"); + +#endif } @@ -1627,7 +1701,7 @@ Java_gnu_java_nio_VMChannel_open (JNIEnv *env, nmode = (nmode | ((nmode == O_RDWR || nmode == O_WRONLY) ? O_CREAT : 0) | ((mode & CPNIO_APPEND) ? O_APPEND : - ((nmode == O_RDWR || nmode == O_WRONLY) ? O_TRUNC : 0)) + ((nmode == O_WRONLY) ? O_TRUNC : 0)) | ((mode & CPNIO_EXCL) ? O_EXCL : 0) | ((mode & CPNIO_SYNC) ? O_SYNC : 0)); diff --git a/libjava/classpath/native/jni/java-util/Makefile.in b/libjava/classpath/native/jni/java-util/Makefile.in index 389de4e1686..af44e11b43e 100644 --- a/libjava/classpath/native/jni/java-util/Makefile.in +++ b/libjava/classpath/native/jni/java-util/Makefile.in @@ -124,6 +124,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@ @@ -162,8 +164,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@ @@ -187,6 +187,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@ @@ -259,8 +268,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@ diff --git a/libjava/classpath/native/jni/midi-alsa/Makefile.in b/libjava/classpath/native/jni/midi-alsa/Makefile.in index 6028c58b8ae..80187067de8 100644 --- a/libjava/classpath/native/jni/midi-alsa/Makefile.in +++ b/libjava/classpath/native/jni/midi-alsa/Makefile.in @@ -127,6 +127,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@ @@ -165,8 +167,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@ @@ -190,6 +190,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@ @@ -262,8 +271,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@ diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.in b/libjava/classpath/native/jni/midi-dssi/Makefile.in index 711eba8edaa..9eacf1c2d66 100644 --- a/libjava/classpath/native/jni/midi-dssi/Makefile.in +++ b/libjava/classpath/native/jni/midi-dssi/Makefile.in @@ -127,6 +127,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@ @@ -165,8 +167,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@ @@ -190,6 +190,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@ @@ -262,8 +271,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@ diff --git a/libjava/classpath/native/jni/native-lib/Makefile.in b/libjava/classpath/native/jni/native-lib/Makefile.in index bc87d788213..558750eab7a 100644 --- a/libjava/classpath/native/jni/native-lib/Makefile.in +++ b/libjava/classpath/native/jni/native-lib/Makefile.in @@ -116,6 +116,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@ @@ -154,8 +156,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@ @@ -179,6 +179,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@ @@ -251,8 +260,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@ diff --git a/libjava/classpath/native/jni/native-lib/cpio.c b/libjava/classpath/native/jni/native-lib/cpio.c index ac3c0b5e79c..743968bd36c 100644 --- a/libjava/classpath/native/jni/native-lib/cpio.c +++ b/libjava/classpath/native/jni/native-lib/cpio.c @@ -158,14 +158,14 @@ JNIEXPORT int cpio_availableBytes (int fd, jlong *bytes_available) off_t n; int result; - *bytes_available = 0 + *bytes_available = 0; if ((fstat (fd, &statBuffer) == 0) && S_ISREG (statBuffer.st_mode)) { n = lseek (fd, 0, SEEK_CUR); if (n != -1) { *bytes_available = statBuffer.st_size - n; - result = 0; + result = CPNATIVE_OK; } else { @@ -189,7 +189,7 @@ JNIEXPORT int cpio_availableBytes (int fd, jlong *bytes_available) FD_SET (fd,&filedescriptset); memset (&tv, 0, sizeof(tv)); - switch (select (fd+1, &filedescriptset, NULL, NULL, &timeval)) \ + switch (select (fd+1, &filedescriptset, NULL, NULL, &tv)) { case -1: result=errno; diff --git a/libjava/classpath/native/jni/native-lib/cpnet.c b/libjava/classpath/native/jni/native-lib/cpnet.c index 22ce69e2797..0444981131b 100644 --- a/libjava/classpath/native/jni/native-lib/cpnet.c +++ b/libjava/classpath/native/jni/native-lib/cpnet.c @@ -693,6 +693,7 @@ jint cpnet_getHostByName (JNIEnv *env, const char *hostname, cpnet_address ***ad cpnet_bytesToIPV4Address(addr_arr[i], (jbyte *)hret.h_addr_list[i]); } break; +#ifdef HAVE_INET6 case AF_INET6: for (i = 0; i < counter; i++) { @@ -700,6 +701,7 @@ jint cpnet_getHostByName (JNIEnv *env, const char *hostname, cpnet_address ***ad cpnet_bytesToIPV6Address(addr_arr[i], (jbyte *)hret.h_addr_list[i]); } break; +#endif default: *addresses_count = 0; JCL_free(env, addr_arr); @@ -732,12 +734,14 @@ jint cpnet_getHostByAddr (JNIEnv *env UNUSED, cpnet_address *addr, char *hostnam addr_len = sizeof(haddr.addr_v4->sin_addr); addr_type = AF_INET; } +#ifdef HAVE_INET6 else if (haddr.addr_v6->sin6_family == AF_INET6) { raw_addr = &haddr.addr_v6->sin6_addr; addr_type = AF_INET6; addr_len = sizeof(haddr.addr_v6->sin6_addr); } +#endif else return EINVAL; @@ -762,7 +766,8 @@ jint cpnet_getHostByAddr (JNIEnv *env UNUSED, cpnet_address *addr, char *hostnam jint cpnet_aton (JNIEnv *env, const char *hostname, cpnet_address **addr) { jbyte *bytes = NULL; -#ifdef HAVE_INET_PTON + +#if defined(HAVE_INET_PTON) && defined(HAVE_INET6) jbyte inet6_addr[16]; #endif @@ -789,7 +794,7 @@ jint cpnet_aton (JNIEnv *env, const char *hostname, cpnet_address **addr) return 0; } -#ifdef HAVE_INET_PTON +#if defined(HAVE_INET_PTON) && defined(HAVE_INET6) if (inet_pton (AF_INET6, hostname, inet6_addr) > 0) { *addr = cpnet_newIPV6Address(env); diff --git a/libjava/classpath/native/jni/native-lib/cpnet.h b/libjava/classpath/native/jni/native-lib/cpnet.h index 10963262731..72850b4c8c6 100644 --- a/libjava/classpath/native/jni/native-lib/cpnet.h +++ b/libjava/classpath/native/jni/native-lib/cpnet.h @@ -117,6 +117,7 @@ static inline void cpnet_setIPV4Any(cpnet_address *addr) netaddr->sin_addr.s_addr = INADDR_ANY; } +#ifdef HAVE_INET6 static inline cpnet_address *cpnet_newIPV6Address(JNIEnv * env) { cpnet_address * addr = (cpnet_address *)JCL_malloc(env, sizeof(cpnet_address) + sizeof(struct sockaddr_in6)); @@ -128,6 +129,7 @@ static inline cpnet_address *cpnet_newIPV6Address(JNIEnv * env) return addr; } +#endif static inline void cpnet_freeAddress(JNIEnv * env, cpnet_address *addr) { @@ -156,12 +158,14 @@ static inline jboolean cpnet_isAddressEqual(cpnet_address *addr1, cpnet_address return memcmp(addr1->data, addr2->data, addr1->len) == 0; } +#ifdef HAVE_INET6 static inline jboolean cpnet_isIPV6Address(cpnet_address *addr) { struct sockaddr_in *ipaddr = (struct sockaddr_in *)&(addr->data[0]); return ipaddr->sin_family == AF_INET6; } +#endif static inline jboolean cpnet_isIPV4Address(cpnet_address *addr) { @@ -194,6 +198,7 @@ static inline void cpnet_bytesToIPV4Address(cpnet_address *netaddr, jbyte *octet ipaddr->sin_addr.s_addr = htonl(sysaddr); } +#ifdef HAVE_INET6 static inline void cpnet_IPV6AddressToBytes(cpnet_address *netaddr, jbyte *octets) { struct sockaddr_in6 *ipaddr = (struct sockaddr_in6 *)&(netaddr->data[0]); @@ -207,5 +212,6 @@ static inline void cpnet_bytesToIPV6Address(cpnet_address *netaddr, jbyte *octet memcpy(&ipaddr->sin6_addr, octets, 16); } +#endif #endif diff --git a/libjava/classpath/native/jni/qt-peer/Makefile.in b/libjava/classpath/native/jni/qt-peer/Makefile.in index 8d268163b86..ad19aa739ba 100644 --- a/libjava/classpath/native/jni/qt-peer/Makefile.in +++ b/libjava/classpath/native/jni/qt-peer/Makefile.in @@ -142,6 +142,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@ @@ -180,8 +182,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@ @@ -205,6 +205,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@ @@ -277,8 +286,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@ diff --git a/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp b/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp index fd56b287856..f2f61822d3f 100644 --- a/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp +++ b/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp @@ -127,11 +127,11 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_dispose * Returns JNI_TRUE if a character is displayable. */ JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_canDisplay -(JNIEnv *env, jobject obj, jchar c) +(JNIEnv *env, jobject obj, jint c) { QFontMetrics *fm = getFontMetrics( env, obj ); assert( fm ); - bool result = fm->inFont( QChar( (unsigned short)c ) ); + bool result = fm->inFont( QChar( (unsigned int) c ) ); return (result ? JNI_TRUE : JNI_FALSE); } diff --git a/libjava/classpath/native/jni/xmlj/Makefile.in b/libjava/classpath/native/jni/xmlj/Makefile.in index 079f7f4df05..016f97f7eca 100644 --- a/libjava/classpath/native/jni/xmlj/Makefile.in +++ b/libjava/classpath/native/jni/xmlj/Makefile.in @@ -126,6 +126,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@ @@ -164,8 +166,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@ @@ -189,6 +189,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@ @@ -261,8 +270,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@ diff --git a/libjava/classpath/native/jni/xmlj/xmlj_xpath.c b/libjava/classpath/native/jni/xmlj/xmlj_xpath.c index 6d014cefc91..6aabaad23ef 100644 --- a/libjava/classpath/native/jni/xmlj/xmlj_xpath.c +++ b/libjava/classpath/native/jni/xmlj/xmlj_xpath.c @@ -39,7 +39,6 @@ exception statement from your version. */ #include "gnu_xml_libxmlj_dom_GnomeElement.h" #include "gnu_xml_libxmlj_dom_GnomeXPathExpression.h" #include "gnu_xml_libxmlj_dom_GnomeXPathNodeList.h" -#include "gnu_xml_libxmlj_dom_GnomeXPathNSResolver.h" #include "gnu_xml_libxmlj_dom_GnomeXPathResult.h" #include "xmlj_node.h" #include "xmlj_util.h" -- cgit v1.2.1