PatchSet 5546 Date: 2005/02/15 09:34:20 Author: jserv Branch: HEAD Tag: (none) Log: Implements JAWT (AWT Native Interface).
2005-02-15 Jim Huang <[EMAIL PROTECTED]> * include/jawt.h, include/jawt_md.h, libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c, libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c, libraries/clib/classpath/classpath_jawt.h: New files. Merge GCJ's AWT Native Interface implementation, which was brought by Thomas Fitzsimmons <[EMAIL PROTECTED]>. * include/Makefile.am, libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am: Add jawt headers and implementation. * include/Makefile.in, libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in: Regenerated. Members: ChangeLog:1.3590->1.3591 include/Makefile.am:1.91->1.92 include/Makefile.in:1.216->1.217 include/jawt.h:INITIAL->1.1 include/jawt_md.h:INITIAL->1.1 libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.12->1.13 libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.28->1.29 libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:INITIAL->1.1 libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c:INITIAL->1.1 libraries/clib/classpath/classpath_jawt.h:INITIAL->1.1 Index: kaffe/ChangeLog diff -u kaffe/ChangeLog:1.3590 kaffe/ChangeLog:1.3591 --- kaffe/ChangeLog:1.3590 Mon Feb 14 22:52:27 2005 +++ kaffe/ChangeLog Tue Feb 15 09:34:20 2005 @@ -1,3 +1,22 @@ +2005-02-15 Jim Huang <[EMAIL PROTECTED]> + + * include/jawt.h, + include/jawt_md.h, + libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c, + libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c, + libraries/clib/classpath/classpath_jawt.h: + New files. + Merge GCJ's AWT Native Interface implementation, which + was brought by Thomas Fitzsimmons <[EMAIL PROTECTED]>. + + * include/Makefile.am, + libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am: + Add jawt headers and implementation. + + * include/Makefile.in, + libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in: + Regenerated. + 2005-02-14 Dalibor Topic <[EMAIL PROTECTED]> Resynced with GNU Classpath. Index: kaffe/include/Makefile.am diff -u kaffe/include/Makefile.am:1.91 kaffe/include/Makefile.am:1.92 --- kaffe/include/Makefile.am:1.91 Mon Feb 14 20:01:21 2005 +++ kaffe/include/Makefile.am Tue Feb 15 09:34:23 2005 @@ -208,6 +208,12 @@ endif endif +if COND_CLASSPATH_GTK_AWT + JAWT_HDRS = \ + jawt.h \ + jawt_md.h +endif + NOINSTALL_JNI_DERIVED_HDRS = \ java_math_BigInteger.h \ java_lang_ref_Reference.h \ @@ -273,8 +279,8 @@ jni.h \ jni_cpp.h \ jvmpi.h \ - kaffe_jni.h - + kaffe_jni.h \ + $(JAWT_HDRS) nodist_pkginclude_HEADERS = \ $(INSTALL_DERIVED_HDRS) \ Index: kaffe/include/Makefile.in diff -u kaffe/include/Makefile.in:1.216 kaffe/include/Makefile.in:1.217 --- kaffe/include/Makefile.in:1.216 Mon Feb 14 20:01:23 2005 +++ kaffe/include/Makefile.in Tue Feb 15 09:34:23 2005 @@ -49,7 +49,7 @@ build_triplet = @build@ host_triplet = @host@ subdir = include -DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \ +DIST_COMMON = $(am__include_HEADERS_DIST) $(noinst_HEADERS) \ $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -80,6 +80,8 @@ CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = +am__include_HEADERS_DIST = jni.h jni_cpp.h jvmpi.h kaffe_jni.h jawt.h \ + jawt_md.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -548,6 +550,10 @@ @COND_NATIVE_SOUND_TRUE@@[EMAIL PROTECTED] = $(LIBTRITONUSALSA_JNI_HDRS) @COND_NATIVE_SOUND_TRUE@@[EMAIL PROTECTED] = $(LIBTRITONUSESD_JNI_HDRS) @COND_CLASSPATH_GTK_AWT_TRUE@@[EMAIL PROTECTED] = $(LIBGTKPEER_JNI_HDRS) [EMAIL PROTECTED]@JAWT_HDRS = \ [EMAIL PROTECTED]@ jawt.h \ [EMAIL PROTECTED]@ jawt_md.h + NOINSTALL_JNI_DERIVED_HDRS = \ java_math_BigInteger.h \ java_lang_ref_Reference.h \ @@ -605,7 +611,8 @@ jni.h \ jni_cpp.h \ jvmpi.h \ - kaffe_jni.h + kaffe_jni.h \ + $(JAWT_HDRS) nodist_pkginclude_HEADERS = \ $(INSTALL_DERIVED_HDRS) \ =================================================================== Checking out kaffe/include/jawt.h RCS: /home/cvs/kaffe/kaffe/include/jawt.h,v VERS: 1.1 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/include/jawt.h Tue Feb 15 09:39:13 2005 @@ -0,0 +1,100 @@ +/* jawt.h -- the machine-independent parts of the AWT Native Interface + Copyright (C) 2005 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. */ + + +/* + * The AWT Native Interface allows direct access to native screen + * resources from within a Canvas's paint method. + */ + +#ifndef __jawt_h__ +#define __jawt_h__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define JAWT_VERSION_1_3 0x10003 +#define JAWT_VERSION_1_4 0x10004 + +#define JAWT_LOCK_ERROR 0x1 +#define JAWT_LOCK_CLIP_CHANGED 0x2 +#define JAWT_LOCK_BOUNDS_CHANGED 0x4 +#define JAWT_LOCK_SURFACE_CHANGED 0x8 + +struct _JAWT_DrawingSurfaceInfo +{ + void* platformInfo; +}; + +struct _JAWT_DrawingSurface +{ + jint (JNICALL* Lock) (struct _JAWT_DrawingSurface*); + void (JNICALL* Unlock) (struct _JAWT_DrawingSurface*); + + struct _JAWT_DrawingSurfaceInfo* (JNICALL* GetDrawingSurfaceInfo) (struct _JAWT_DrawingSurface*); + void (JNICALL* FreeDrawingSurfaceInfo) (struct _JAWT_DrawingSurfaceInfo*); + + struct _JAWT_DrawingSurfaceInfo* surface_info; + + /* FIXME: also include bounding rectangle of drawing surface. */ + /* FIXME: also include current clipping region. */ +}; + +struct _JAWT +{ + void (JNICALL *Lock) (JNIEnv*); + void (JNICALL *Unlock) (JNIEnv*); + + struct _JAWT_DrawingSurface* (JNICALL* GetDrawingSurface) (JNIEnv*, jobject); + void (JNICALL* FreeDrawingSurface) (struct _JAWT_DrawingSurface*); + + jint version; +}; + +typedef struct _JAWT_DrawingSurfaceInfo JAWT_DrawingSurfaceInfo; +typedef struct _JAWT_DrawingSurface JAWT_DrawingSurface; +typedef struct _JAWT JAWT; + +JNIEXPORT jboolean JNICALL JAWT_GetAWT (JNIEnv* env, struct _JAWT* awt); + +#ifdef __cplusplus +} +#endif + +#endif /* __jawt_h__ */ =================================================================== Checking out kaffe/include/jawt_md.h RCS: /home/cvs/kaffe/kaffe/include/jawt_md.h,v VERS: 1.1 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/include/jawt_md.h Tue Feb 15 09:39:13 2005 @@ -0,0 +1,64 @@ +/* jawt_md.h -- the X11-dependent parts of the AWT Native Interface + Copyright (C) 2005 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. */ + + +#ifndef __jawt_md_h__ +#define __jawt_md_h__ + +#include <jni.h> +#include <jawt.h> +#include <X11/Xlib.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct _JAWT_X11DrawingSurfaceInfo +{ + Display* display; + Drawable drawable; + VisualID visualID; +}; + +typedef struct _JAWT_X11DrawingSurfaceInfo JAWT_X11DrawingSurfaceInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* __jawt_md_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.12 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.13 --- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.12 Mon Feb 14 20:01:24 2005 +++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am Tue Feb 15 09:34:24 2005 @@ -1,4 +1,4 @@ -native_LTLIBRARIES = libgtkpeer.la +native_LTLIBRARIES = libgtkpeer.la libjawt.la # Gtk/Cairo JNI sources. if GTK_CAIRO @@ -48,7 +48,8 @@ gnu_java_awt_peer_gtk_GtkWindowPeer.c \ gthread-jni.c \ gthread-jni.h \ - gtkpeer.h + gtk_jawt.c \ + gtkpeer.h libgtkpeer_la_CFLAGS = \ $(CFLAGS_PG) @@ -75,3 +76,18 @@ @X_LIBS@ \ -lXtst +libjawt_la_SOURCES = jawt.c +libjawt_la_CFLAGS = \ + $(CFLAGS_PG) + +libjawt_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + @X_CFLAGS@ \ + -I$(top_srcdir)/libraries/clib/classpath/ \ + -I$(top_builddir)/include/ +libjawt_la_LIBADD = \ + libgtkpeer.la \ + $(top_builddir)/kaffe/kaffevm/libkaffevm.la +libjawt_la_LDFLAGS = \ + @CLASSPATH_MODULE@ \ + @X_LIBS@ Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.28 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.29 --- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.28 Mon Feb 14 20:01:24 2005 +++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in Tue Feb 15 09:34:24 2005 @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(libgtkpeer_la_SOURCES) +SOURCES = $(libgtkpeer_la_SOURCES) $(libjawt_la_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -116,7 +116,7 @@ gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \ gnu_java_awt_peer_gtk_GtkToolkit.c \ gnu_java_awt_peer_gtk_GtkWindowPeer.c gthread-jni.c \ - gthread-jni.h gtkpeer.h + gthread-jni.h gtk_jawt.c gtkpeer.h @[EMAIL PROTECTED] = libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo am_libgtkpeer_la_OBJECTS = $(am__objects_1) \ libgtkpeer_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo \ @@ -155,8 +155,12 @@ libgtkpeer_la-gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo \ libgtkpeer_la-gnu_java_awt_peer_gtk_GtkToolkit.lo \ libgtkpeer_la-gnu_java_awt_peer_gtk_GtkWindowPeer.lo \ - libgtkpeer_la-gthread-jni.lo + libgtkpeer_la-gthread-jni.lo libgtkpeer_la-gtk_jawt.lo libgtkpeer_la_OBJECTS = $(am_libgtkpeer_la_OBJECTS) +libjawt_la_DEPENDENCIES = libgtkpeer.la \ + $(top_builddir)/kaffe/kaffevm/libkaffevm.la +am_libjawt_la_OBJECTS = libjawt_la-jawt.lo +libjawt_la_OBJECTS = $(am_libjawt_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/config -I$(top_builddir)/include/kaffe depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp am__depfiles_maybe = depfiles @@ -167,8 +171,8 @@ $(AM_CFLAGS) $(CFLAGS) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libgtkpeer_la_SOURCES) -DIST_SOURCES = $(am__libgtkpeer_la_SOURCES_DIST) +SOURCES = $(libgtkpeer_la_SOURCES) $(libjawt_la_SOURCES) +DIST_SOURCES = $(am__libgtkpeer_la_SOURCES_DIST) $(libjawt_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -447,7 +451,7 @@ target_alias = @target_alias@ toolslibdir = @toolslibdir@ with_engine = @with_engine@ -native_LTLIBRARIES = libgtkpeer.la +native_LTLIBRARIES = libgtkpeer.la libjawt.la # Gtk/Cairo JNI sources. @[EMAIL PROTECTED] = \ @@ -495,7 +499,8 @@ gnu_java_awt_peer_gtk_GtkWindowPeer.c \ gthread-jni.c \ gthread-jni.h \ - gtkpeer.h + gtk_jawt.c \ + gtkpeer.h libgtkpeer_la_CFLAGS = \ $(CFLAGS_PG) @@ -522,6 +527,24 @@ @X_LIBS@ \ -lXtst +libjawt_la_SOURCES = jawt.c +libjawt_la_CFLAGS = \ + $(CFLAGS_PG) + +libjawt_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + @X_CFLAGS@ \ + -I$(top_srcdir)/libraries/clib/classpath/ \ + -I$(top_builddir)/include/ + +libjawt_la_LIBADD = \ + libgtkpeer.la \ + $(top_builddir)/kaffe/kaffevm/libkaffevm.la + +libjawt_la_LDFLAGS = \ + @CLASSPATH_MODULE@ \ + @X_LIBS@ + all: all-am .SUFFIXES: @@ -584,6 +607,8 @@ done libgtkpeer.la: $(libgtkpeer_la_OBJECTS) $(libgtkpeer_la_DEPENDENCIES) $(LINK) -rpath $(nativedir) $(libgtkpeer_la_LDFLAGS) $(libgtkpeer_la_OBJECTS) $(libgtkpeer_la_LIBADD) $(LIBS) +libjawt.la: $(libjawt_la_OBJECTS) $(libjawt_la_DEPENDENCIES) + $(LINK) -rpath $(nativedir) $(libjawt_la_LDFLAGS) $(libjawt_la_OBJECTS) $(libjawt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -629,6 +654,8 @@ @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ [EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ [EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -916,6 +943,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gthread-jni.c' object='libgtkpeer_la-gthread-jni.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gthread-jni.lo `test -f 'gthread-jni.c' || echo '$(srcdir)/'`gthread-jni.c + +libgtkpeer_la-gtk_jawt.lo: gtk_jawt.c [EMAIL PROTECTED]@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gtk_jawt.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gtk_jawt.Tpo" -c -o libgtkpeer_la-gtk_jawt.lo `test -f 'gtk_jawt.c' || echo '$(srcdir)/'`gtk_jawt.c; \ [EMAIL PROTECTED]@ then mv -f "$(DEPDIR)/libgtkpeer_la-gtk_jawt.Tpo" "$(DEPDIR)/libgtkpeer_la-gtk_jawt.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gtk_jawt.Tpo"; exit 1; fi [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='gtk_jawt.c' object='libgtkpeer_la-gtk_jawt.lo' libtool=yes @AMDEPBACKSLASH@ [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ [EMAIL PROTECTED]@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gtk_jawt.lo `test -f 'gtk_jawt.c' || echo '$(srcdir)/'`gtk_jawt.c + +libjawt_la-jawt.lo: jawt.c [EMAIL PROTECTED]@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libjawt_la_CPPFLAGS) $(CPPFLAGS) $(libjawt_la_CFLAGS) $(CFLAGS) -MT libjawt_la-jawt.lo -MD -MP -MF "$(DEPDIR)/libjawt_la-jawt.Tpo" -c -o libjawt_la-jawt.lo `test -f 'jawt.c' || echo '$(srcdir)/'`jawt.c; \ [EMAIL PROTECTED]@ then mv -f "$(DEPDIR)/libjawt_la-jawt.Tpo" "$(DEPDIR)/libjawt_la-jawt.Plo"; else rm -f "$(DEPDIR)/libjawt_la-jawt.Tpo"; exit 1; fi [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='jawt.c' object='libjawt_la-jawt.lo' libtool=yes @AMDEPBACKSLASH@ [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ [EMAIL PROTECTED]@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libjawt_la_CPPFLAGS) $(CPPFLAGS) $(libjawt_la_CFLAGS) $(CFLAGS) -c -o libjawt_la-jawt.lo `test -f 'jawt.c' || echo '$(srcdir)/'`jawt.c mostlyclean-libtool: -rm -f *.lo =================================================================== Checking out kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c RCS: /home/cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c,v VERS: 1.1 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c Tue Feb 15 09:39:13 2005 @@ -0,0 +1,166 @@ +/* gtk_jawt.c -- GTK implementation of classpath_jawt.h + Copyright (C) 2005 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 "gtkpeer.h" +#include <gtk/gtk.h> +#include <gdk/gdkx.h> +#include "classpath_jawt.h" + +jint +classpath_jawt_get_awt_version () +{ + return CLASSPATH_JAWT_VERSION; +} + +Display* +classpath_jawt_get_default_display (JNIEnv* env, jobject canvas) +{ + GdkDisplay *display; + Display *xdisplay; + GtkWidget *widget; + void *ptr; + jobject peer; + jclass class_id; + jmethodID method_id; + + /* retrieve peer object */ + class_id = (*env)->GetObjectClass (env, canvas); + + method_id = (*env)->GetMethodID (env, class_id, + "getPeer", + "()Ljava/awt/peer/ComponentPeer;"); + + peer = (*env)->CallObjectMethod (env, canvas, method_id); + + ptr = NSA_GET_PTR (env, peer); + + gdk_threads_enter (); + + widget = GTK_WIDGET (ptr); + + /* widget should be realized before Canvas.paint is called. */ + g_assert (GTK_WIDGET_REALIZED (widget)); + + display = gtk_widget_get_display (widget); + + xdisplay = GDK_DISPLAY_XDISPLAY (display); + + gdk_threads_leave (); + + return xdisplay; +} + +VisualID +classpath_jawt_get_visualID (JNIEnv* env, jobject canvas) +{ + GtkWidget *widget; + Visual *visual; + void *ptr; + jobject peer; + jclass class_id; + jmethodID method_id; + + class_id = (*env)->GetObjectClass (env, canvas); + + method_id = (*env)->GetMethodID (env, class_id, + "getPeer", + "()Ljava/awt/peer/ComponentPeer;"); + + peer = (*env)->CallObjectMethod (env, canvas, method_id); + + ptr = NSA_GET_PTR (env, peer); + + gdk_threads_enter (); + + widget = GTK_WIDGET (ptr); + + g_assert (GTK_WIDGET_REALIZED (widget)); + + visual = gdk_x11_visual_get_xvisual (gtk_widget_get_visual (widget)); + g_assert (visual != NULL); + + gdk_threads_leave (); + + return visual->visualid; +} + +Drawable +classpath_jawt_get_drawable (JNIEnv* env, jobject canvas) +{ + GtkWidget *widget; + int drawable; + void *ptr; + jobject peer; + jclass class_id; + jmethodID method_id; + + class_id = (*env)->GetObjectClass (env, canvas); + + method_id = (*env)->GetMethodID (env, class_id, + "getPeer", + "()Ljava/awt/peer/ComponentPeer;"); + + peer = (*env)->CallObjectMethod (env, canvas, method_id); + + ptr = NSA_GET_PTR (env, peer); + + gdk_threads_enter (); + + widget = GTK_WIDGET (ptr); + + g_assert (GTK_WIDGET_REALIZED (widget)); + + drawable = GDK_DRAWABLE_XID (widget->window); + + gdk_threads_leave (); + + return drawable; +} + +jint +classpath_jawt_lock () +{ + gdk_threads_enter (); + return 0; +} + +void +classpath_jawt_unlock () +{ + gdk_threads_leave (); +} =================================================================== Checking out kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c RCS: /home/cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c,v VERS: 1.1 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c Tue Feb 15 09:39:13 2005 @@ -0,0 +1,180 @@ +/* jawt.c -- X11 implementation of the AWT Native Interface + Copyright (C) 2005 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 <jni.h> +#include <jawt.h> +#include <jawt_md.h> +#include <stdlib.h> +#include "classpath_jawt.h" +#include "native.h" + +/* JAWT_DrawingSurface function declarations */ + +static jint (JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface); +static void (JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface); +static JAWT_DrawingSurfaceInfo* (JNICALL _Jv_GetDrawingSurfaceInfo) + (JAWT_DrawingSurface* surface); +static void (JNICALL _Jv_FreeDrawingSurfaceInfo) + (JAWT_DrawingSurfaceInfo* surface_info); + +/* JAWT function declarations */ + +static JAWT_DrawingSurface* (JNICALL _Jv_GetDrawingSurface) (JNIEnv* env, + jobject canvas); +static void (JNICALL _Jv_FreeDrawingSurface) (JAWT_DrawingSurface* surface); +static void (JNICALL _Jv_JAWT_Lock) (JNIEnv*); +static void (JNICALL _Jv_JAWT_Unlock) (JNIEnv*); + +JNIEXPORT jboolean JNICALL +JAWT_GetAWT (JNIEnv* env, JAWT* awt) +{ + jint retrieved_version; + + retrieved_version = classpath_jawt_get_awt_version (); + + if (awt->version > retrieved_version) + return JNI_FALSE; + + awt->GetDrawingSurface = _Jv_GetDrawingSurface; + awt->FreeDrawingSurface = _Jv_FreeDrawingSurface; + awt->Lock = _Jv_JAWT_Lock; + awt->Unlock = _Jv_JAWT_Unlock; + + return JNI_TRUE; +} + +/* JAWT_DrawingSurface functions */ + +static jint +(JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface) +{ + /* lock the drawing surface */ + return classpath_jawt_lock (); +} + +static void +(JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface) +{ + classpath_jawt_unlock (); +} + +static JAWT_DrawingSurfaceInfo* +(JNICALL _Jv_GetDrawingSurfaceInfo) (JAWT_DrawingSurface* surface) +{ + if (surface == NULL) + return NULL; + + return surface->surface_info; +} + +static void +(JNICALL _Jv_FreeDrawingSurfaceInfo) (JAWT_DrawingSurfaceInfo* surface_info) +{ + JAWT_X11DrawingSurfaceInfo* surface_info_x11; + + if (surface_info == NULL) + return; + + surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface_info->platformInfo; + + surface_info_x11->display = NULL; + surface_info_x11->drawable = 0; + surface_info_x11->visualID = 0; + + KFREE(surface_info); + surface_info = NULL; +} + +/* JAWT functions */ + +static JAWT_DrawingSurface* +(JNICALL _Jv_GetDrawingSurface) (JNIEnv* env, jobject canvas) +{ + JAWT_DrawingSurface* surface; + JAWT_X11DrawingSurfaceInfo* surface_info_x11; + + surface = (JAWT_DrawingSurface*) KMALLOC(sizeof (JAWT_DrawingSurface)); + + if (surface == NULL) + return NULL; + + /* initialize function pointers */ + surface->GetDrawingSurfaceInfo = _Jv_GetDrawingSurfaceInfo; + surface->FreeDrawingSurfaceInfo = _Jv_FreeDrawingSurfaceInfo; + + surface->Lock = _Jv_Lock; + surface->Unlock = _Jv_Unlock; + + surface->surface_info = (JAWT_DrawingSurfaceInfo*) KMALLOC(sizeof (JAWT_DrawingSurfaceInfo)); + + if (surface->surface_info == NULL) + return NULL; + + surface->surface_info->platformInfo = KMALLOC(sizeof (JAWT_X11DrawingSurfaceInfo)); + + if (surface->surface_info->platformInfo == NULL) + return NULL; + + surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface->surface_info->platformInfo; + + surface_info_x11->display = classpath_jawt_get_default_display (env, canvas); + surface_info_x11->drawable = classpath_jawt_get_drawable (env, canvas); + surface_info_x11->visualID = classpath_jawt_get_visualID (env, canvas); + + /* FIXME: also include bounding rectangle of drawing surface */ + /* FIXME: also include current clipping region */ + + return surface; +} + +static void +(JNICALL _Jv_FreeDrawingSurface) (JAWT_DrawingSurface* surface) +{ + KFREE(surface); +} + +static void +(JNICALL _Jv_JAWT_Lock) (JNIEnv* env) +{ + classpath_jawt_lock (); +} + +static void +(JNICALL _Jv_JAWT_Unlock) (JNIEnv* env) +{ + classpath_jawt_unlock (); +} =================================================================== Checking out kaffe/libraries/clib/classpath/classpath_jawt.h RCS: /home/cvs/kaffe/kaffe/libraries/clib/classpath/classpath_jawt.h,v VERS: 1.1 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/libraries/clib/classpath/classpath_jawt.h Tue Feb 15 09:39:13 2005 @@ -0,0 +1,60 @@ +/* classpath_awt.h -- libjawt's interface to the peer library + Copyright (C) 2005 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. */ + +/* + * libjawt.so is linked directly to the peer library with -l. This + * header declares all the functions that libjawt.so needs -- X-based + * peer libraries wanting to support libjawt.so must implement these + * functions. + */ + +#ifndef __classpath_jawt_h__ +#define __classpath_jawt_h__ + +#include <jni.h> +#include <X11/Xlib.h> + +#define CLASSPATH_JAWT_VERSION 0x10004 + +jint classpath_jawt_get_awt_version (); +Display* classpath_jawt_get_default_display (JNIEnv* env, jobject canvas); +Drawable classpath_jawt_get_drawable (JNIEnv* env, jobject canvas); +VisualID classpath_jawt_get_visualID (JNIEnv* env, jobject canvas); +jint classpath_jawt_lock (); +void classpath_jawt_unlock (); + +#endif /* __classpath_jawt_h__ */ _______________________________________________ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe