[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: new gdk graphics enviroment support code

Kaffe CVS cvs-commits at kaffe.org
Sun Oct 24 05:23:44 PDT 2004


PatchSet 5351 
Date: 2004/10/24 12:19:31
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: new gdk graphics enviroment support code

2004-10-24  Dalibor Topic  <robilad at kaffe.org>

        * libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
        New file taken from GNU Classpath.

        * include/Makefile.am:
        Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h.

        * libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:
        Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c.

        * include/Makefile.in,
        libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:
        Regeneated.

        * libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:
        Resynced with GNU Classpath.

        2004-10-22  Andreas Tobler  <a.tobler at schweiz.ch>

        * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
        New File.
        (nativeGetNumFontsFamilies) New function.
        (nativeGetFontFamilies) Likewise.
        * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
        (getAvailableFontFamilyNames): Implement.

        2004-10-22  Michael Koch  <konqueror at gmx.de>

        * include/Makefile.am:
        Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h.
        * native/jni/gtk-peer/Makefile.am:
        Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c.

Members: 
	ChangeLog:1.2903->1.2904 
	include/Makefile.am:1.75->1.76 
	include/Makefile.in:1.190->1.191 
	libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.6->1.7 
	libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.11->1.12 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:INITIAL->1.1 
	libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2903 kaffe/ChangeLog:1.2904
--- kaffe/ChangeLog:1.2903	Sun Oct 24 10:48:23 2004
+++ kaffe/ChangeLog	Sun Oct 24 12:19:31 2004
@@ -1,5 +1,39 @@
 2004-10-24  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
+	New file taken from GNU Classpath.
+
+	* include/Makefile.am:
+	Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h.
+
+	* libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:
+	Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c.
+
+	* include/Makefile.in,
+	libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:
+	Regeneated.
+
+	* libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:
+        Resynced with GNU Classpath.
+
+	2004-10-22  Andreas Tobler  <a.tobler at schweiz.ch>
+
+        * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
+        New File.
+        (nativeGetNumFontsFamilies) New function.
+        (nativeGetFontFamilies) Likewise.
+        * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+        (getAvailableFontFamilyNames): Implement.
+
+	2004-10-22  Michael Koch  <konqueror at gmx.de>
+
+        * include/Makefile.am:
+        Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h.
+        * native/jni/gtk-peer/Makefile.am:
+        Added gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c.
+
+2004-10-24  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/gnu/java/awt/peer/ClasspathFontPeer.java:
         Resynced with GNU Classpath.
 
Index: kaffe/include/Makefile.am
diff -u kaffe/include/Makefile.am:1.75 kaffe/include/Makefile.am:1.76
--- kaffe/include/Makefile.am:1.75	Sat Oct  9 22:18:00 2004
+++ kaffe/include/Makefile.am	Sun Oct 24 12:19:34 2004
@@ -190,6 +190,7 @@
 	gnu_java_awt_peer_gtk_GdkGlyphVector.h \
 	gnu_java_awt_peer_gtk_GdkGraphics.h \
 	gnu_java_awt_peer_gtk_GdkGraphics2D.h \
+	gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h \
 	gnu_java_awt_peer_gtk_GdkPixbufDecoder.h \
 	gnu_java_awt_peer_gtk_GdkTextLayout.h \
 	gnu_java_awt_peer_gtk_GtkButtonPeer.h \
Index: kaffe/include/Makefile.in
diff -u kaffe/include/Makefile.in:1.190 kaffe/include/Makefile.in:1.191
--- kaffe/include/Makefile.in:1.190	Sat Oct  9 22:18:00 2004
+++ kaffe/include/Makefile.in	Sun Oct 24 12:19:34 2004
@@ -531,6 +531,7 @@
 	gnu_java_awt_peer_gtk_GdkGlyphVector.h \
 	gnu_java_awt_peer_gtk_GdkGraphics.h \
 	gnu_java_awt_peer_gtk_GdkGraphics2D.h \
+	gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h \
 	gnu_java_awt_peer_gtk_GdkPixbufDecoder.h \
 	gnu_java_awt_peer_gtk_GdkTextLayout.h \
 	gnu_java_awt_peer_gtk_GtkButtonPeer.h \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.6 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.7
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.6	Sat Oct  9 22:18:25 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am	Sun Oct 24 12:19:35 2004
@@ -15,6 +15,7 @@
 	gnu_java_awt_peer_gtk_GdkFontMetrics.c \
 	gnu_java_awt_peer_gtk_GdkFontPeer.c \
 	gnu_java_awt_peer_gtk_GdkGraphics.c \
+	gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
 	gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
 	gnu_java_awt_peer_gtk_GdkTextLayout.c \
 	gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.11 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.12
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.11	Sat Oct  9 22:18:25 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in	Sun Oct 24 12:19:35 2004
@@ -83,6 +83,7 @@
 	gnu_java_awt_peer_gtk_GdkFontMetrics.c \
 	gnu_java_awt_peer_gtk_GdkFontPeer.c \
 	gnu_java_awt_peer_gtk_GdkGraphics.c \
+	gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
 	gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
 	gnu_java_awt_peer_gtk_GdkTextLayout.c \
 	gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
@@ -123,6 +124,7 @@
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics.lo \
+	libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo \
 	libgtkpeer_la-gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo \
@@ -452,6 +454,7 @@
 	gnu_java_awt_peer_gtk_GdkFontMetrics.c \
 	gnu_java_awt_peer_gtk_GdkFontPeer.c \
 	gnu_java_awt_peer_gtk_GdkGraphics.c \
+	gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
 	gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
 	gnu_java_awt_peer_gtk_GdkTextLayout.c \
 	gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
@@ -583,6 +586,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkTextLayout.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GtkButtonPeer.Plo at am__quote@
@@ -679,6 +683,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gnu_java_awt_peer_gtk_GdkGraphics.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics.lo `test -f 'gnu_java_awt_peer_gtk_GdkGraphics.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkGraphics.c
+
+libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo: gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo `test -f 'gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Tpo" "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo `test -f 'gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
 
 libgtkpeer_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo: gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
 @am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo `test -f 'gnu_java_awt_peer_gtk_GdkPixbufDecoder.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkPixbufDecoder.c; \
===================================================================
Checking out kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
RCS:  /home/cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c	Sun Oct 24 12:23:43 2004
@@ -0,0 +1,97 @@
+/* gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+   This file is part of GNU Classpath.
+
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.
+
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include "gdkfont.h"
+#include "gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h"
+
+
+static gint
+cmp_families (const void *a, const void *b)
+{
+  const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
+  const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
+
+  return g_utf8_collate (a_name, b_name);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetFontFamilies
+(JNIEnv *env, jobject  self __attribute__((unused)), jobjectArray family_name)
+{
+  PangoContext *context;
+  PangoFontFamily **families;
+  int n_families, idx;
+
+  gdk_threads_enter ();
+
+  context = gdk_pango_context_get();
+  g_assert (context != NULL);
+
+  pango_context_list_families (context, &families, &n_families);
+
+  qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
+
+  for (idx = 0;  idx < n_families;  idx++)
+    {
+      const char *name_tmp =  pango_font_family_get_name (families[idx]);
+      jstring name = (*env)->NewStringUTF (env, name_tmp);
+      (*env)->SetObjectArrayElement (env, family_name, idx, name);
+    }
+  g_free (families);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetNumFontFamilies
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  PangoContext *context;
+  PangoFontFamily **families;
+  gint n_families;
+  jint num;
+
+  gdk_threads_enter ();
+
+  context = gdk_pango_context_get();
+  g_assert (context != NULL);
+
+  pango_context_list_families (context, &families, &n_families);
+
+  num = n_families;
+  g_free (families);
+  gdk_threads_leave ();
+  
+  return num;
+}
Index: kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:1.3 kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:1.4
--- kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:1.3	Sat Oct  9 22:18:49 2004
+++ kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java	Sun Oct 24 12:19:35 2004
@@ -68,16 +68,25 @@
   {
     return new GdkGraphics2D (image);
   }
+    native private int nativeGetNumFontFamilies ();
+    native private void nativeGetFontFamilies (String[] family_names);
 
   public Font[] getAllFonts ()
   {
     throw new java.lang.UnsupportedOperationException ();
   }
 
-  public String[] getAvailableFontFamilyNames ()
-  {
-    throw new java.lang.UnsupportedOperationException ();
-  }
+    public String[] getAvailableFontFamilyNames ()
+    {
+	String[] family_names;
+	int array_size;
+
+	array_size = nativeGetNumFontFamilies();
+	family_names = new String[array_size];
+
+	nativeGetFontFamilies(family_names);
+	return family_names;
+    }
 
   public String[] getAvailableFontFamilyNames (Locale l)
   {




More information about the kaffe mailing list