configure: Regenerate.

2006-06-13  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* configure.ac (--enable-plugin): New option.
	(ac_configure_args): Add --enable-tool-wrappers.
	(ac_configure_args): Add --disable-plugin unless --enable-plugin
	was specified.
	* gcj/Makefile.in: Regenerate.
	* sources.am (gnu_java_net_source_files): Add
	classpath/gnu/java/net/IndexListParser.java.
	(property_files): Remove
	classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties,
	classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties.
	Add
	classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties,
	classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties,
	classpath/resource/gnu/classpath/tools/getopt/Messages.properties,
	classpath/resource/gnu/classpath/tools/jar/messages.properties,
	classpath/resource/gnu/classpath/tools/jarsigner/messages.properties,
	classpath/resource/gnu/classpath/tools/keytool/messages.properties,
	classpath/resource/gnu/classpath/tools/native2ascii/messages.properties,
	classpath/resource/gnu/classpath/tools/serialver/messages.properties.
	* classpath/Makefile.in: Regenerate.
	* classpath/native/jni/gtk-peer/cairographics2d.h,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c:
	Merge from GNU Classpath.
	* classpath/native/Makefile.in: Regenerate.
	* classpath/native/jawt/Makefile.in: Regenerate.
	* classpath/native/jawt/Makefile.am: Install libjawt.so in GCJ's
	versioned library directory.
	* classpath/native/Makefile.am: Add plugin directory if
	--enable-plugin was specified.
	* classpath/native/plugin/Makefile.in: Regenerate.  *
	classpath/native/plugin/Makefile.am: Install libgcjwebplugin.so in
	GCJ's versioned library directory.
	* classpath/resource/gnu/classpath/tools/native2ascii/messages.properties:
	New file.
	* classpath/resource/gnu/classpath/tools/getopt/Messages.properties:
	Likewise.
	* classpath/resource/gnu/classpath/tools/jarsigner/messages.properties:
	Likewise.
	* classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties:
	Remove file.
	* classpath/resource/gnu/classpath/tools/keytool/messages.properties:
	New file.
	* classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties:
	Remove file.
	* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties:
	New file.
	* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties:
	Likewise.
	* classpath/resource/gnu/classpath/tools/jar/messages.properties:
	Likewise.
	* classpath/resource/gnu/classpath/tools/serialver/messages.properties:
	Likewise.
	* classpath/gnu/java/net/IndexListParser.java:
	Likewise.
	* classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
	classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
	classpath/gnu/java/awt/peer/gtk/CairoSurface.java,
	classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,
	classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
	classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
	classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,
	classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,
	classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
	classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java,
	classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java,
	classpath/gnu/java/awt/java2d/PolyEdge.java,
	classpath/gnu/java/awt/java2d/AbstractGraphics2D.java: Merge from
	GNU Classpath.
	* classpath/tools/toolwrapper.c: Replace tools.zip reference with
	libgcj-tools-4.2.0.jar.
	* classpath/tools/Makefile.in: Regenerate.
	* classpath/tools/Makefile.am: Rename tools.zip to
	libgcj-tools-4.2.0.jar.  Install libgcj-tools-4.2.0.jar in
	$(datadir)/java.
	* classpath/javax/swing/JTabbedPane.java,
	classpath/javax/swing/text/DefaultStyledDocument.java,
	classpath/javax/swing/text/html/HTMLDocument.java,
	classpath/javax/swing/text/GapContent.java,
	classpath/javax/swing/JComponent.java,
	classpath/javax/swing/RepaintManager.java,
	classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java,
	classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,
	classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
	classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,
	classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,
	classpath/javax/swing/plaf/metal/MetalButtonUI.java,
	classpath/java/text/Bidi.java,
	classpath/java/awt/image/BufferedImage.java,
	classpath/java/awt/datatransfer/DataFlavor.java,
	classpath/java/awt/geom/AffineTransform.java,
	classpath/java/awt/dnd/DropTargetDropEvent.java,
	classpath/java/awt/dnd/DropTargetContext.java,
	classpath/java/awt/font/TextLayout.java,
	classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,
	classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
	classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,
	classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h,
	classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h,
	classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h: Merge from
	GNU Classpath.
	* classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h,
	classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,
	classpath/native/jni/gtk-peer/gtkcairopeer.h,
	classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
	Remove files.
	* classpath/Makefile.am (SUBDIRS, DIST_SUBDIRS): Include tools
	directory.
	* include/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r114633
This commit is contained in:
Thomas Fitzsimmons
2006-06-14 03:38:34 +00:00
committed by Thomas Fitzsimmons
parent e3d437c056
commit 648e8d6dd3
102 changed files with 3933 additions and 4458 deletions
+6 -2
View File
@@ -8,6 +8,10 @@ if CREATE_GTK_PEER_LIBRARIES
JAWTDIR = jawt
endif
SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) target
DIST_SUBDIRS = fdlibm jni jawt target
if CREATE_PLUGIN
PLUGINDIR = plugin
endif
SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) $(PLUGINDIR) target
DIST_SUBDIRS = fdlibm jni jawt plugin target
+3 -2
View File
@@ -278,8 +278,9 @@ target_vendor = @target_vendor@
vm_classes = @vm_classes@
@CREATE_JNI_LIBRARIES_TRUE@JNIDIR = jni
@CREATE_GTK_PEER_LIBRARIES_TRUE@JAWTDIR = jawt
SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) target
DIST_SUBDIRS = fdlibm jni jawt target
@CREATE_PLUGIN_TRUE@PLUGINDIR = plugin
SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) $(PLUGINDIR) target
DIST_SUBDIRS = fdlibm jni jawt plugin target
all: all-recursive
.SUFFIXES:
+9 -1
View File
@@ -1,8 +1,16 @@
nativeexeclib_LTLIBRARIES = libjawt.la
## GCJ LOCAL: install this library in GCJ's versioned library
## directory
gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
gcjversionedlib_LTLIBRARIES = libjawt.la
libjawt_la_SOURCES = jawt.c
libjawt_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
## GCJ LOCAL: encode the library path and use GCJ's library version
libjawt_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
-version-info `grep -v '^\#' $(top_srcdir)/../libtool-version`
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ @XTEST_LIBS@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+37 -31
View File
@@ -58,9 +58,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
am__installdirs = "$(DESTDIR)$(gcjversionedlibdir)"
gcjversionedlibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(gcjversionedlib_LTLIBRARIES)
libjawt_la_DEPENDENCIES = \
$(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
am_libjawt_la_OBJECTS = jawt.lo
@@ -295,9 +295,14 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
nativeexeclib_LTLIBRARIES = libjawt.la
gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
gcjversionedlib_LTLIBRARIES = libjawt.la
libjawt_la_SOURCES = jawt.c
libjawt_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
libjawt_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
-version-info `grep -v '^\#' $(top_srcdir)/../libtool-version`
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ @XTEST_LIBS@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
@@ -339,35 +344,35 @@ $(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)
install-gcjversionedlibLTLIBRARIES: $(gcjversionedlib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
test -z "$(gcjversionedlibdir)" || $(mkdir_p) "$(DESTDIR)$(gcjversionedlibdir)"
@list='$(gcjversionedlib_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"; \
echo " $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gcjversionedlibdir)/$$f'"; \
$(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gcjversionedlibdir)/$$f"; \
else :; fi; \
done
uninstall-nativeexeclibLTLIBRARIES:
uninstall-gcjversionedlibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
@set -x; list='$(gcjversionedlib_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"; \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gcjversionedlibdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gcjversionedlibdir)/$$p"; \
done
clean-nativeexeclibLTLIBRARIES:
-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
clean-gcjversionedlibLTLIBRARIES:
-test -z "$(gcjversionedlib_LTLIBRARIES)" || rm -f $(gcjversionedlib_LTLIBRARIES)
@list='$(gcjversionedlib_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
libjawt.la: $(libjawt_la_OBJECTS) $(libjawt_la_DEPENDENCIES)
$(LINK) -rpath $(nativeexeclibdir) $(libjawt_la_LDFLAGS) $(libjawt_la_OBJECTS) $(libjawt_la_LIBADD) $(LIBS)
$(LINK) -rpath $(gcjversionedlibdir) $(libjawt_la_LDFLAGS) $(libjawt_la_OBJECTS) $(libjawt_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -487,7 +492,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
for dir in "$(DESTDIR)$(gcjversionedlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -516,7 +521,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
clean-am: clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
@@ -535,9 +540,9 @@ info: info-am
info-am:
install-data-am:
install-data-am: install-gcjversionedlibLTLIBRARIES
install-exec-am: install-nativeexeclibLTLIBRARIES
install-exec-am:
install-info: install-info-am
@@ -563,20 +568,21 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
uninstall-am: uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
.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 \
.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
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-gcjversionedlibLTLIBRARIES install-info \
install-info-am install-man 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
tags uninstall uninstall-am \
uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
# 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.
@@ -113,7 +113,4 @@ struct cairographics2d
char *pattern_pixels;
};
cairo_t *cp_gtk_get_cairo_t(JNIEnv *env,
jobject cairographics2dobj);
#endif
@@ -51,33 +51,6 @@ exception statement from your version. */
static void install_font_peer(cairo_t *cr, struct peerfont *pfont);
static void update_pattern_transform (struct cairographics2d *gr);
static struct cairographics2d *getPointer(JNIEnv *env, jobject obj);
static struct cairographics2d *
getPointer(JNIEnv *env, jobject obj)
{
jclass cls;
jlong value;
jfieldID nofid;
cls = (*env)->GetObjectClass( env, obj );
nofid = (*env)->GetFieldID( env, cls, "nativePointer", "J" );
value = (*env)->GetLongField( env, obj, nofid );
(*env)->DeleteLocalRef( env, cls );
return JLONG_TO_PTR(struct cairographics2d, value);
}
/**
* Returns the cairo_t * associated with a CairoGraphics2D object,
* This is used by GdkTextLayout.
*/
cairo_t *cp_gtk_get_cairo_t(JNIEnv *env,
jobject cairographics2dobj)
{
struct cairographics2d *gr = getPointer(env, cairographics2dobj);
g_assert(gr != NULL);
return gr->cr;
}
/**
* Allocates the cairographics2d structure.
@@ -106,9 +79,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_init
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer(env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
if (gr == NULL)
return;
@@ -136,7 +110,8 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
(JNIEnv *env, jobject obj,
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer,
jdouble x1, jdouble y1,
jdouble x2, jdouble y2,
jint r1, jint g1, jint b1, jint a1,
@@ -147,7 +122,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
cairo_pattern_t* pattern;
cairo_extend_t extend;
gr = getPointer (env, obj);
gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert( gr != NULL );
pattern = cairo_pattern_create_linear(x1, y1, x2, y2);
@@ -169,12 +144,13 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels
(JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jintArray jarr, jint w, jint h, jint stride)
{
struct cairographics2d *gr = NULL;
jint *jpixels = NULL;
gr = getPointer (env, obj);
gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
if (gr->pattern)
@@ -210,12 +186,13 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels
(JNIEnv *env, jobject obj, jintArray java_pixels,
jint w, jint h, jint stride, jdoubleArray java_matrix)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jintArray java_pixels,
jint w, jint h, jint stride, jdoubleArray java_matrix, jdouble alpha)
{
jint *native_pixels = NULL;
jdouble *native_matrix = NULL;
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL);
@@ -241,7 +218,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels
if (gr->pattern)
cairo_pattern_set_filter (p, cairo_pattern_get_filter (gr->pattern));
cairo_set_source (gr->cr, p);
cairo_paint (gr->cr);
if (alpha == 1.)
cairo_paint (gr->cr);
else
cairo_paint_with_alpha(gr->cr, alpha);
cairo_pattern_destroy (p);
cairo_surface_destroy (surf);
}
@@ -253,10 +234,13 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
(JNIEnv *env, jobject obj, jdoubleArray java_matrix)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdoubleArray java_matrix)
{
jdouble *native_matrix = NULL;
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (obj != NULL);
g_assert (gr != NULL);
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
g_assert (native_matrix != NULL);
@@ -270,6 +254,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
native_matrix[0], native_matrix[1],
native_matrix[2], native_matrix[3],
native_matrix[4], native_matrix[5]);
g_assert (gr != NULL);
cairo_set_matrix (gr->cr, &mat);
}
@@ -279,11 +264,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
(JNIEnv *env, jobject obj,
jobject font,
jfloat x, jfloat y, jint n,
jintArray java_codes,
jfloatArray java_positions)
(JNIEnv *env, jobject obj, jlong pointer,
jobject font,
jfloat x, jfloat y, jint n,
jintArray java_codes,
jfloatArray java_positions)
{
struct cairographics2d *gr = NULL;
@@ -297,7 +282,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
g_assert (java_codes != NULL);
g_assert (java_positions != NULL);
gr = getPointer (env, obj);
gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
@@ -329,9 +314,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator
(JNIEnv *env, jobject obj, jint op)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jint op)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
switch ((enum java_awt_alpha_composite_rule) op)
@@ -388,9 +374,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor
(JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble r, jdouble g, jdouble b, jdouble a)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_set_source_rgba (gr->cr, r, g, b, a);
@@ -398,9 +385,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule
(JNIEnv *env, jobject obj, jint rule)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jint rule)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
switch ((enum java_awt_geom_path_iterator_winding_rule) rule)
@@ -419,9 +407,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
(JNIEnv *env, jobject obj, jdouble width, int cap, int join, double miterLimit)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble width, int cap, int join, double miterLimit)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
/* set width */
@@ -468,10 +457,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash
(JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
(JNIEnv *env, jobject obj __attribute__((unused)),
jlong pointer, jdoubleArray dashes, jint ndash, jdouble offset)
{
jdouble *dasharr = NULL;
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
dasharr = (*env)->GetDoubleArrayElements (env, dashes, NULL);
@@ -484,9 +474,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_new_path (gr->cr);
@@ -494,9 +485,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo
(JNIEnv *env, jobject obj, jdouble x, jdouble y)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble x, jdouble y)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_move_to (gr->cr, x, y);
@@ -504,9 +496,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo
(JNIEnv *env, jobject obj, jdouble x, jdouble y)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble x, jdouble y)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_line_to (gr->cr, x, y);
@@ -514,18 +507,21 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoCurveTo
(JNIEnv *env, jobject obj, jdouble x1, jdouble y1, jdouble x2, jdouble y2, jdouble x3, jdouble y3)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble x1, jdouble y1,
jdouble x2, jdouble y2, jdouble x3, jdouble y3)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo
(JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble dx, jdouble dy)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_rel_move_to (gr->cr, dx, dy);
@@ -533,9 +529,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo
(JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble dx, jdouble dy)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_rel_line_to (gr->cr, dx, dy);
@@ -543,9 +540,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo
(JNIEnv *env, jobject obj, jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3);
@@ -553,18 +552,20 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle
(JNIEnv *env, jobject obj, jdouble x, jdouble y, jdouble width, jdouble height)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble x, jdouble y, jdouble width, jdouble height)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
cairo_rectangle (gr->cr, x, y, width, height);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_close_path (gr->cr);
@@ -572,9 +573,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_stroke (gr->cr);
@@ -582,19 +584,29 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFill
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jdouble alpha)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_fill (gr->cr);
if (alpha == 1.0)
cairo_fill (gr->cr);
else
{
cairo_save(gr->cr);
cairo_clip(gr->cr);
cairo_paint_with_alpha(gr->cr, alpha);
cairo_restore(gr->cr);
}
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer( env, obj );
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert( gr != NULL );
cairo_clip( gr->cr );
@@ -602,9 +614,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer( env, obj );
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_reset_clip( gr->cr );
@@ -612,9 +625,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip
(JNIEnv *env, jobject obj)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer)
{
struct cairographics2d *gr = getPointer( env, obj );
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_clip_preserve( gr->cr );
@@ -622,9 +636,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter
(JNIEnv *env, jobject obj, jint filter)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong pointer, jint filter)
{
struct cairographics2d *gr = getPointer (env, obj);
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
if (gr->pattern == NULL)
@@ -650,6 +665,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter
}
}
/************************** FONT STUFF ****************************/
static void
install_font_peer(cairo_t *cr,
@@ -700,4 +716,3 @@ update_pattern_transform (struct cairographics2d *gr)
cairo_pattern_set_matrix (gr->pattern, &mat);
}
@@ -50,7 +50,6 @@ exception statement from your version. */
#define BUFFER "bufferPointer"
/* prototypes */
static void *getNativeObject( JNIEnv *env, jobject obj, const char *pointer );
static void setNativeObject( JNIEnv *env, jobject obj, void *ptr, const char *pointer );
/**
@@ -65,7 +64,7 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_create (JNIEnv *env, jobject obj, jint w
setNativeObject(env, obj, data, BUFFER);
surface = cairo_image_surface_create_for_data
(data, CAIRO_FORMAT_ARGB32, width, height, stride);
(data, CAIRO_FORMAT_ARGB32, width, height, stride * 4);
setNativeObject(env, obj, surface, SURFACE);
}
@@ -74,14 +73,16 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_create (JNIEnv *env, jobject obj, jint w
* Destroy the surface
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_destroy (JNIEnv *env, jobject obj)
Java_gnu_java_awt_peer_gtk_CairoSurface_destroy
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong surfacePointer, jlong bufferPointer)
{
void *buffer;
cairo_surface_t* surface = (cairo_surface_t *)getNativeObject(env, obj, SURFACE);
cairo_surface_t* surface = JLONG_TO_PTR(void, surfacePointer);
if( surface != NULL )
cairo_surface_destroy(surface);
buffer = getNativeObject(env, obj, BUFFER);
buffer = JLONG_TO_PTR(void, bufferPointer);
if( buffer != NULL )
g_free(buffer);
}
@@ -90,9 +91,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_destroy (JNIEnv *env, jobject obj)
* Gets a pixel
*/
JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem (JNIEnv *env, jobject obj, jint i)
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong bufferPointer, jint i)
{
jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
jint *pixeldata = JLONG_TO_PTR(void, bufferPointer);
if( pixeldata == NULL )
return 0;
@@ -105,9 +108,10 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem (JNIEnv *env, jobject obj,
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem
(JNIEnv *env, jobject obj, jint i, jint val)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong bufferPointer, jint i, jint val)
{
jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
jint *pixeldata = JLONG_TO_PTR(void, bufferPointer);
if( pixeldata == NULL )
return;
@@ -119,13 +123,14 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem
* Gets all pixels in an array
*/
JNIEXPORT jintArray JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_getPixels
(JNIEnv *env, jobject obj, int size)
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetPixels
(JNIEnv *env __attribute((unused)), jobject obj __attribute((unused)),
jlong bufferPointer, int size)
{
jint *pixeldata, *jpixdata;
jintArray jpixels;
pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
pixeldata = JLONG_TO_PTR(void, bufferPointer);
g_assert(pixeldata != NULL);
jpixels = (*env)->NewIntArray (env, size);
@@ -140,8 +145,8 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_getPixels
* Sets all pixels by an array.
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels
(JNIEnv *env, jobject obj, jintArray jpixels)
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetPixels
(JNIEnv *env, jobject obj, jlong bufferPointer, jintArray jpixels)
{
jint *pixeldata, *jpixdata;
int size;
@@ -161,7 +166,7 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels
g_assert (field != 0);
height = (*env)->GetIntField (env, obj, field);
pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
pixeldata = JLONG_TO_PTR(void, bufferPointer);
g_assert(pixeldata != NULL);
jpixdata = (*env)->GetIntArrayElements (env, jpixels, NULL);
@@ -174,15 +179,15 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface
(JNIEnv *env, jobject obj, jobject context, jdoubleArray java_matrix)
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeDrawSurface
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong surfacePointer, jlong context, jdoubleArray java_matrix, double alpha)
{
cairo_t *cr;
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, context);
cairo_t *cr = gr->cr;
jdouble *native_matrix = NULL;
cairo_surface_t* surface = (cairo_surface_t *)getNativeObject(env, obj, SURFACE);
cairo_surface_t* surface = JLONG_TO_PTR(void, surfacePointer);
g_assert(surface != NULL);
cr = cp_gtk_get_cairo_t(env, context);
g_assert(cr != NULL);
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
@@ -202,7 +207,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface
cairo_pattern_set_matrix (p, &mat);
cairo_set_source(cr, p);
cairo_paint(cr);
if (alpha == 1.0)
cairo_paint(cr);
else
cairo_paint_with_alpha(cr, alpha);
cairo_pattern_destroy(p);
}
@@ -211,10 +220,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface
JNIEXPORT jlong JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer
(JNIEnv *env, jobject obj, jint size)
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong bufferPointer, jint size)
{
jint *dst;
jint *src = (jint *)getNativeObject(env, obj, BUFFER);
jint *src = JLONG_TO_PTR(void, bufferPointer);
int i;
int t;
@@ -236,9 +246,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer
* Create and return a cairo context for drawing to the surface.
*/
JNIEXPORT jlong JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_newCairoContext (JNIEnv *env, jobject obj)
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeNewCairoContext
(JNIEnv *env __attribute((unused)), jobject obj __attribute((unused)),
jlong surfacePointer)
{
cairo_surface_t* surface = (cairo_surface_t *)getNativeObject(env, obj, SURFACE);
cairo_surface_t* surface = JLONG_TO_PTR(cairo_surface_t, surfacePointer);
cairo_t *ptr;
g_assert(surface != NULL);
ptr = cairo_create(surface);
@@ -251,17 +263,15 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_newCairoContext (JNIEnv *env, jobject ob
* copyArea.
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative (JNIEnv *env,
jobject obj,
jint x, jint y,
jint w, jint h,
jint dx, jint dy,
jint stride)
Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative2
(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
jlong bufferPointer,
jint x, jint y, jint w, jint h, jint dx, jint dy, jint stride)
{
int row;
int srcOffset, dstOffset;
jint *temp;
jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
jint *pixeldata = JLONG_TO_PTR(jint, bufferPointer);
g_assert( pixeldata != NULL );
temp = g_malloc( h * w * 4 );
@@ -294,19 +304,3 @@ setNativeObject( JNIEnv *env, jobject obj, void *ptr, const char *pointer )
(*env)->SetLongField( env, obj, nofid, value );
(*env)->DeleteLocalRef( env, cls );
}
/**
* Gets the native object field.
*/
static void *
getNativeObject( JNIEnv *env, jobject obj, const char *pointer )
{
jclass cls;
jlong value;
jfieldID nofid;
cls = (*env)->GetObjectClass( env, obj );
nofid = (*env)->GetFieldID( env, cls, pointer, "J" );
value = (*env)->GetLongField( env, obj, nofid );
(*env)->DeleteLocalRef( env, cls );
return JLONG_TO_PTR(void, value);
}
@@ -186,7 +186,11 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_disposeSurface
surface = cairo_get_target (gr->cr);
if (surface != NULL)
cairo_surface_destroy (surface);
{
gdk_threads_enter();
cairo_surface_destroy (surface);
gdk_threads_leave();
}
}
JNIEXPORT jlong JNICALL
@@ -275,7 +279,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
(JNIEnv *env, jobject obj __attribute__ ((unused)), jobject peer,
jobject img, jint x, jint y, jint w, jint h)
jlong img, jint x, jint y, jint w, jint h)
{
GdkPixmap *pixmap;
GtkWidget *widget = NULL;
@@ -289,7 +293,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
widget = GTK_WIDGET (ptr);
g_assert (widget != NULL);
pixmap = cp_gtk_get_pixmap( env, img );
pixmap = JLONG_TO_PTR(GdkPixmap, img);
gc = gdk_gc_new(widget->window);
gdk_draw_drawable(widget->window,
@@ -81,24 +81,37 @@ getFont(JNIEnv *env, jobject obj)
return (PangoFcFont *)pfont->font;
}
JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyph
(JNIEnv *env, jobject obj, jint codepoint)
JNIEXPORT jintArray JNICALL
Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs
(JNIEnv *env, jobject obj, jintArray codepoints)
{
FT_Face ft_face;
jint glyph_index;
jintArray retArray;
PangoFcFont *font;
jint *values, *cpvals;
jint length;
int i;
font = getFont(env, obj);
ft_face = pango_fc_font_lock_face( font );
g_assert (ft_face != NULL);
glyph_index = FT_Get_Char_Index( ft_face, codepoint );
length = (*env)->GetArrayLength (env, codepoints);
cpvals = (*env)->GetIntArrayElements (env, codepoints, NULL);
retArray = (*env)->NewIntArray (env, length);
values = (*env)->GetIntArrayElements (env, retArray, NULL);
for( i = 0; i < length; i++ )
values[i] = FT_Get_Char_Index( ft_face, cpvals[i] );
(*env)->ReleaseIntArrayElements (env, retArray, values, 0);
(*env)->ReleaseIntArrayElements (env, codepoints, cpvals, 0);
pango_fc_font_unlock_face (font);
return glyph_index;
return retArray;
}
JNIEXPORT jobject JNICALL
@@ -143,7 +156,7 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative
FT_Set_Transform( ft_face, NULL, NULL );
if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_DEFAULT ) != 0 )
if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_NO_BITMAP ) != 0 )
{
pango_fc_font_unlock_face( font );
printf("Couldn't load glyph %i\n", glyphIndex);
@@ -1,758 +0,0 @@
/* gdkgraphics.c
Copyright (C) 1999 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 "gdkfont.h"
#include "gnu_java_awt_peer_gtk_GdkGraphics.h"
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
static jmethodID initComponentGraphicsUnlockedID;
/*
* AWT applications may call Graphics methods from threads other than
* the GDK main thread, so we must call XFlush after each batch of
* drawing operations, otherwise animations flicker. Flushing after
* every graphics operation is excessive and negatively affects
* performance (PR 26486). We set the maximum frequency to 50 times
* per second, or a minimum period of 20 milliseconds between calls to
* XFlush. See gnu.classpath.examples.awt.AnimationApplet for an
* example applet that requires these XFlush calls.
*/
static short flush_scheduled = 0;
static gboolean flush (gpointer data __attribute__((unused)))
{
gdk_threads_enter ();
XFlush (GDK_DISPLAY ());
flush_scheduled = 0;
gdk_threads_leave ();
return FALSE;
}
/* The minimum time period between calls to XFlush, in
milliseconds. */
#define MINIMUM_FLUSH_PERIOD 20
/* schedule_flush must be called with the GDK lock held. */
static void
schedule_flush ()
{
if (!flush_scheduled)
{
g_timeout_add (MINIMUM_FLUSH_PERIOD, flush, NULL);
flush_scheduled = 1;
}
}
void
cp_gtk_graphics_init_jni (void)
{
jclass gdkgraphics;
gdkgraphics = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
"gnu/java/awt/peer/gtk/GdkGraphics");
initComponentGraphicsUnlockedID =
(*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics,
"initComponentGraphicsUnlocked",
"()V");
}
struct state_table *cp_gtk_native_graphics_state_table;
static struct state_table *native_graphics_global_ref_table;
#define NSA_GLOBAL_G_INIT(env, clazz) \
native_graphics_global_ref_table = cp_gtk_init_state_table (env, clazz)
#define NSA_GET_GLOBAL_G_REF(env, obj) \
cp_gtk_get_state (env, obj, native_graphics_global_ref_table)
#define NSA_SET_GLOBAL_G_REF(env, obj) \
do {jobject *globRefPtr; \
globRefPtr = (jobject *) malloc (sizeof (jobject)); \
*globRefPtr = (*env)->NewGlobalRef (env, obj); \
cp_gtk_set_state (env, obj, native_graphics_global_ref_table, (void *)globRefPtr);} while (0)
#define NSA_DEL_GLOBAL_G_REF(env, obj) \
do {jobject *globRefPtr = cp_gtk_get_state (env, obj, native_graphics_global_ref_table); \
cp_gtk_remove_state_slot (env, obj, native_graphics_global_ref_table); \
(*env)->DeleteGlobalRef (env, *globRefPtr); \
free (globRefPtr);} while (0)
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_initStaticState
(JNIEnv *env, jclass clazz)
{
gdk_threads_enter();
NSA_G_INIT (env, clazz);
NSA_GLOBAL_G_INIT (env, clazz);
gdk_threads_leave();
}
#define GDK_STABLE_IS_PIXMAP(d) (GDK_IS_PIXMAP(d))
static GdkPoint *translate_points (JNIEnv *env, jintArray xpoints,
jintArray ypoints, jint npoints,
jint x_offset, jint y_offset);
static void realize_cb (GtkWidget *widget, jobject jgraphics);
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeCopyState
(JNIEnv *env, jobject obj, jobject old)
{
struct graphics *g = NULL;
struct graphics *g_old = NULL;
gdk_threads_enter ();
g = (struct graphics *) g_malloc (sizeof (struct graphics));
g_old = (struct graphics *) NSA_GET_G_PTR (env, old);
*g = *g_old;
g->gc = gdk_gc_new (g->drawable);
gdk_gc_copy (g->gc, g_old->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
g_object_ref (g->drawable);
else /* GDK_IS_WINDOW (g->drawable) */
g_object_ref (g->drawable);
if (g->cm != NULL)
g_object_ref (g->cm);
NSA_SET_G_PTR (env, obj, g);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
(JNIEnv *env, jobject obj, jint width, jint height)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) g_malloc (sizeof (struct graphics));
g->x_offset = g->y_offset = 0;
g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
gdk_rgb_get_visual ()->depth);
g->cm = gdk_rgb_get_colormap ();
if (g->cm != NULL)
g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
(JNIEnv *env, jobject obj, jobject source)
{
struct graphics *g = NULL;
GdkPixmap *pixmap = NULL;
gdk_threads_enter ();
pixmap = cp_gtk_image_get_pixmap (env, source);
g_assert(pixmap != NULL);
g_object_ref (pixmap);
g = (struct graphics *) g_malloc (sizeof (struct graphics));
g->x_offset = g->y_offset = 0;
g->drawable = (GdkDrawable *)pixmap;
g->cm = gdk_drawable_get_colormap (g->drawable);
if (g->cm != NULL)
g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
(JNIEnv *env, jobject obj, jobject peer)
{
struct graphics *g = NULL;
void *ptr = NULL;
GtkWidget *widget = NULL;
GdkColor color;
g = (struct graphics *) g_malloc (sizeof (struct graphics));
ptr = NSA_GET_PTR (env, peer);
g->x_offset = 0;
g->y_offset = 0;
widget = GTK_WIDGET (ptr);
g->drawable = (GdkDrawable *) widget->window;
g_object_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
if (g->cm != NULL)
g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
color = widget->style->fg[GTK_STATE_NORMAL];
NSA_SET_G_PTR (env, obj, g);
}
/* copy the native state of the peer (GtkWidget *) to the native state
of the graphics object */
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
(JNIEnv *env, jobject obj, jobject peer)
{
gdk_threads_enter ();
Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
(env, obj, peer);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals
(JNIEnv *env, jobject obj, jobject peer)
{
void *ptr = NULL;
jobject *gref = NULL;
gdk_threads_enter ();
NSA_SET_GLOBAL_G_REF (env, obj);
gref = NSA_GET_GLOBAL_G_REF (env, obj);
ptr = NSA_GET_PTR (env, peer);
g_signal_connect_after (G_OBJECT (ptr), "realize",
G_CALLBACK (realize_cb), *gref);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeDispose
(JNIEnv *env, jobject obj)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_DEL_G_PTR (env, obj);
/* check if dispose has been called already */
if (!g)
{
gdk_threads_leave ();
return;
}
XFlush (GDK_DISPLAY ());
if (g->gc != NULL)
g_object_unref (g->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
g_object_unref (g->drawable);
else if (g->drawable != NULL)
g_object_unref (g->drawable);
if (g->cm != NULL)
g_object_unref (g->cm);
g_free (g);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
(JNIEnv *env, jobject obj, jint x, jint y)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
g->x_offset += x;
g->y_offset += y;
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
(JNIEnv *env, jobject obj, jobject font, jstring str, jint x, jint y)
{
struct peerfont *pfont = NULL;
struct graphics *g = NULL;
const char *cstr = NULL;
const char *sTmp = NULL;
char *tmp = NULL;
char *p = NULL;
int count = 0;
int charSize = 0;
int baseline_y = 0;
PangoLayoutIter *iter = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
g_assert (g != NULL);
pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
g_assert (pfont != NULL);
cstr = (*env)->GetStringUTFChars (env, str, NULL);
g_assert (cstr != NULL);
charSize = sizeof(char);
p = malloc((strlen(cstr) + 1) * charSize);
g_assert (p != NULL);
tmp = p;
sTmp = cstr;
for (; *sTmp != '\0'; sTmp++)
if (((unsigned char) *sTmp) >= ' ')
{
*p = *sTmp;
count++;
p++;
}
*p = '\0';
p = realloc(tmp, (count + 1) * charSize);
g_assert (p != NULL);
pango_layout_set_text (pfont->layout, p, -1);
free(p);
pango_layout_set_font_description (pfont->layout, pfont->desc);
iter = pango_layout_get_iter (pfont->layout);
baseline_y = pango_layout_iter_get_baseline (iter);
gdk_draw_layout (g->drawable, g->gc,
x + g->x_offset,
y + g->y_offset - PANGO_PIXELS (baseline_y),
pfont->layout);
pango_layout_iter_free (iter);
pango_layout_set_text (pfont->layout, "", -1);
schedule_flush ();
(*env)->ReleaseStringUTFChars (env, str, cstr);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
(JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_line (g->drawable, g->gc,
x + g->x_offset, y + g->y_offset,
x2 + g->x_offset, y2 + g->y_offset);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_rectangle (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset, width, height);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_rectangle (g->drawable, g->gc, FALSE,
x + g->x_offset, y + g->y_offset, width, height);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
(JNIEnv *env, jobject obj, jint x, jint y,
jint width, jint height, jint dx, jint dy)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_drawable ((GdkWindow *)g->drawable,
g->gc,
(GdkWindow *)g->drawable,
x + g->x_offset, y + g->y_offset,
x + g->x_offset + dx, y + g->y_offset + dy,
width, height);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g = NULL;
GdkGCValues saved;
GtkWidget *widget = NULL;
union widget_union w;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
if (!g)
{
gdk_threads_leave ();
return;
}
if (GDK_IS_WINDOW (g->drawable))
{
w.widget = &widget;
gdk_window_get_user_data (GDK_WINDOW (g->drawable), w.void_widget);
if (widget == NULL || !GTK_IS_EVENT_BOX (widget))
gdk_window_clear_area ((GdkWindow *) g->drawable,
x + g->x_offset, y + g->y_offset,
width, height);
}
else
{
gdk_gc_get_values (g->gc, &saved);
gdk_gc_set_background (g->gc, &(saved.background));
gdk_draw_rectangle (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset, width, height);
gdk_gc_set_foreground (g->gc, &(saved.foreground));
}
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
(JNIEnv *env, jobject obj, jint func)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_gc_set_function (g->gc, func);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
(JNIEnv *env, jobject obj, jint red, jint green, jint blue)
{
GdkColor color;
struct graphics *g = NULL;
gdk_threads_enter ();
color.red = red << 8;
color.green = green << 8;
color.blue = blue << 8;
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
if (g->cm != NULL)
gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
gdk_gc_set_foreground (g->gc, &color);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
jint angle1, jint angle2)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, FALSE,
x + g->x_offset, y + g->y_offset,
width, height, angle1 << 6, angle2 << 6);
schedule_flush ();
gdk_threads_leave ();
}
static GdkPoint *
translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
jint npoints, jint x_offset, jint y_offset)
{
GdkPoint *points;
jint *x, *y;
int i;
/* allocate one more point than necessary, in case we need to tack
on an extra due to the semantics of Java polygons. */
points = g_malloc (sizeof (GdkPoint) * (npoints + 1));
x = (*env)->GetIntArrayElements (env, xpoints, NULL);
y = (*env)->GetIntArrayElements (env, ypoints, NULL);
for (i = 0; i < npoints; i++)
{
points[i].x = x[i] + x_offset;
points[i].y = y[i] + y_offset;
}
(*env)->ReleaseIntArrayElements (env, xpoints, x, JNI_ABORT);
(*env)->ReleaseIntArrayElements (env, ypoints, y, JNI_ABORT);
return points;
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
jint npoints)
{
struct graphics *g = NULL;
GdkPoint *points = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
points = translate_points (env, xpoints, ypoints, npoints,
g->x_offset, g->y_offset);
gdk_draw_lines (g->drawable, g->gc, points, npoints);
schedule_flush ();
g_free (points);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
jint npoints)
{
struct graphics *g = NULL;
GdkPoint *points = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
points = translate_points (env, xpoints, ypoints, npoints,
g->x_offset, g->y_offset);
/* make sure the polygon is closed, per Java semantics.
if it's not, we close it. */
if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
points[npoints++] = points[0];
gdk_draw_lines (g->drawable, g->gc, points, npoints);
schedule_flush ();
g_free (points);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
jint npoints)
{
struct graphics *g = NULL;
GdkPoint *points = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
points = translate_points (env, xpoints, ypoints, npoints,
g->x_offset, g->y_offset);
gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
schedule_flush ();
g_free (points);
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
jint angle1, jint angle2)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset,
width, height, angle1 << 6, angle2 << 6);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, FALSE,
x + g->x_offset, y + g->y_offset,
width, height, 0, 23040);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g = NULL;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset,
width, height, 0, 23040);
schedule_flush ();
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g = NULL;
GdkRectangle rectangle;
gdk_threads_enter ();
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
rectangle.x = x + g->x_offset;
rectangle.y = y + g->y_offset;
rectangle.width = width;
rectangle.height = height;
gdk_gc_set_clip_rectangle (g->gc, &rectangle);
gdk_threads_leave ();
}
static void
realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject jgraphics)
{
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(),
jgraphics,
initComponentGraphicsUnlockedID);
NSA_DEL_GLOBAL_G_REF (cp_gtk_gdk_env(), jgraphics);
}
File diff suppressed because it is too large Load Diff
@@ -278,7 +278,7 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
(JNIEnv *env, jclass clazz)
{
jclass dataOutputClass;
jclass writerClass;
(*env)->GetJavaVM(env, &vm);
@@ -296,9 +296,9 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
"(Ljava/lang/String;Z)"
"Lgnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec;");
dataOutputClass = (*env)->FindClass(env, "java/io/DataOutput");
dataOutputWriteID = (*env)->GetMethodID (env, dataOutputClass,
writerClass = (*env)->FindClass
(env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder$GdkPixbufWriter");
dataOutputWriteID = (*env)->GetMethodID (env, writerClass,
"write", "([B)V");
query_formats (env, clazz);
@@ -344,7 +344,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpDone
struct stream_save_request
{
JNIEnv *env;
jobject *stream;
jobject *writer;
};
static gboolean
@@ -358,30 +358,23 @@ save_to_stream(const gchar *buf,
jbyteArray jbuf;
jbyte *cbuf;
/* FIXME. Don't call user code directly on this thread.
Store bytes and signal a "pump" thread to deliver to user code.
Then we don't have to drop/acquire any locks. */
gdk_threads_leave ();
jbuf = (*(ssr->env))->NewByteArray ((ssr->env), count);
cbuf = (*(ssr->env))->GetByteArrayElements ((ssr->env), jbuf, NULL);
memcpy (cbuf, buf, count);
(*(ssr->env))->ReleaseByteArrayElements ((ssr->env), jbuf, cbuf, 0);
(*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->stream),
(*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->writer),
dataOutputWriteID, jbuf);
(*(ssr->env))->DeleteLocalRef((ssr->env), jbuf);
gdk_threads_enter ();
return TRUE;
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage
(JNIEnv *env, jclass clazz __attribute__((unused)),
(JNIEnv *env, jclass clazz __attribute__((unused)),
jintArray jarr, jstring jenctype, jint width, jint height,
jboolean hasAlpha, jobject stream)
jboolean hasAlpha, jobject writer)
{
GdkPixbuf* pixbuf;
jint *ints;
@@ -391,7 +384,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage
int i;
struct stream_save_request ssr;
ssr.stream = &stream;
ssr.writer = &writer;
ssr.env = env;
ints = (*env)->GetIntArrayElements (env, jarr, NULL);
@@ -44,6 +44,7 @@
#include <pango/pangofc-font.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include "jcl.h"
#include "native_state.h"
#include "gdkfont.h"
#include "gnu_java_awt_peer_gtk_GdkTextLayout.h"
@@ -239,23 +240,21 @@ Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkTextLayout_cairoDrawGdkTextLayout
(JNIEnv *env, jobject obj, jobject cairographics, jfloat x, jfloat y)
(JNIEnv *env, jobject obj, jlong cg2d, jfloat x, jfloat y)
{
/*
* FIXME: Some day we expect either cairo or pango will know how to make
* a pango layout paint to a cairo surface. that day is not yet here.
*/
cairo_t *cr;
struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, cg2d);
cairo_t *cr = gr->cr;
struct textlayout *tl = NULL;
PangoLayoutIter *i = NULL;
PangoLayoutRun *run = NULL;
cairo_glyph_t *glyphs = NULL;
gint n_glyphs = 0;
g_assert (cairographics != NULL);
cr = cp_gtk_get_cairo_t(env, cairographics);
tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, obj);
g_assert (cr != NULL);
@@ -47,11 +47,6 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkVolatileImage.h"
#include "cairographics2d.h"
/* prototypes */
static void *getNativeObject( JNIEnv *env, jobject obj );
/* static void setNativeObject( JNIEnv *env, jobject obj, void *ptr ); */
GdkPixmap *cp_gtk_get_pixmap( JNIEnv *env, jobject obj);
/**
* Creates a cairo surface, ARGB32, native ordering, premultiplied alpha.
@@ -91,9 +86,11 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_init (JNIEnv *env,
* Destroy the surface
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy (JNIEnv *env, jobject obj)
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy
(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
jlong pointer)
{
GdkPixmap* pixmap = getNativeObject(env, obj);
GdkPixmap* pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
if( pixmap != NULL )
{
gdk_threads_enter();
@@ -106,8 +103,8 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy (JNIEnv *env, jobject obj)
* Gets all pixels in an array
*/
JNIEXPORT jintArray JNICALL
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels
(JNIEnv *env, jobject obj)
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeGetPixels
(JNIEnv *env, jobject obj, jlong pointer)
{
/* jint *pixeldata, *jpixdata; */
jint *jpixdata;
@@ -126,7 +123,7 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels
g_assert (field != 0);
height = (*env)->GetIntField (env, obj, field);
pixmap = GDK_PIXMAP(getNativeObject(env, obj));
pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
g_assert(pixmap != NULL);
gdk_threads_enter();
@@ -149,11 +146,12 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels
* Copy area
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_copyArea
(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h, jint dx, jint dy)
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeCopyArea
(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
jlong pointer, jint x, jint y, jint w, jint h, jint dx, jint dy)
{
GdkPixbuf *pixbuf;
GdkPixmap* pixmap = getNativeObject(env, obj);
GdkPixmap* pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
g_assert (pixmap != NULL);
@@ -169,14 +167,15 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_copyArea
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_drawVolatile
(JNIEnv *env, jobject obj, jlong ptr, jint x, jint y, jint w, jint h)
Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeDrawVolatile
(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
jlong pointer, jlong srcptr, jint x, jint y, jint w, jint h)
{
GdkPixmap *dst, *src;
GdkGC *gc;
src = JLONG_TO_PTR(GdkPixmap, ptr);
dst = getNativeObject(env, obj);
src = JLONG_TO_PTR(GdkPixmap, srcptr);
dst = JLONG_TO_PTR(GdkPixmap, pointer);
g_assert (src != NULL);
g_assert (dst != NULL);
@@ -194,23 +193,3 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_drawVolatile
gdk_threads_leave();
}
GdkPixmap *cp_gtk_get_pixmap( JNIEnv *env, jobject obj)
{
return (GdkPixmap *)getNativeObject(env, obj);
}
/**
* Gets the native object field.
*/
static void *
getNativeObject( JNIEnv *env, jobject obj )
{
jclass cls;
jlong value;
jfieldID nofid;
cls = (*env)->GetObjectClass( env, obj );
nofid = (*env)->GetFieldID( env, cls, "nativePointer", "J" );
value = (*env)->GetLongField( env, obj, nofid );
(*env)->DeleteLocalRef( env, cls );
return JLONG_TO_PTR(void, value);
}
@@ -1,93 +0,0 @@
#ifndef __GTKCAIROPEER_H__
#define __GTKCAIROPEER_H__
/* gtkcairopeer.h -- Some global variables and #defines
Copyright (C) 1998, 1999 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 <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
/*
A graphics2d struct is both simpler and uglier than a graphics
struct.
Most of the graphics2d drawing state is held in the referenced cairo_t
and corresponding cairo_surface_t, so we can ignore it.
In addition to the cairo_t, we need to hold an extra reference to the
underlying GdkDrawable so its refcount matches the lifecycle of the java
Graphics object which is peering with us; also a reference to a byte
buffer and cairo_surface_t which contain the pattern you're drawing from
(if it exists).
Finally, it is possible that we are using a non-RENDER capable X server,
therefore we will be drawing to an cairo_surface_t which is actually a
pixbuf. When this is the case, the pointer to a GdkPixbuf will be
non-NULL and any drawing operation needs to be bracketed by pixbuf
load/save operations. If the GdkPixbuf pointer is NULL, we will treat
the cairo_surface_t as RENDER-capable.
*/
struct graphics2d
{
cairo_t *cr;
cairo_surface_t *surface;
GdkDrawable *drawable;
GdkWindow *win;
GdkPixbuf *drawbuf;
char *pattern_pixels;
cairo_surface_t *pattern_surface;
cairo_pattern_t *pattern;
gboolean debug;
enum
{
MODE_DRAWABLE_WITH_RENDER,
MODE_DRAWABLE_NO_RENDER,
MODE_JAVA_ARRAY
}
mode;
/* Support for MODE_JAVA_ARRAY */
jintArray jarray;
jint width, height;
jint *javabuf;
jint *javabuf_copy;
jboolean isCopy;
};
#endif /* __GTKCAIROPEER_H */
+11 -4
View File
@@ -1,17 +1,24 @@
lib_LTLIBRARIES = libgcjwebplugin.la
## GCJ LOCAL: install this library in GCJ's versioned library
## directory
gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
gcjversionedlib_LTLIBRARIES = libgcjwebplugin.la
libgcjwebplugin_la_SOURCES = gcjwebplugin.cc
libgcjwebplugin_la_CXXFLAGS = \
-Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/appletviewer\"" \
-Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \
-DPLUGIN_DATA_DIRECTORY="\"$(PLUGIN_DIR)/gcjwebplugin-data\"" \
$(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
libgcjwebplugin_la_LDFLAGS = -avoid-version \
## GCJ LOCAL: encode the library path and use GCJ's library version
libgcjwebplugin_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
-version-info `grep -v '^\#' $(top_srcdir)/../libtool-version` \
$(GLIB_LIBS) $(GTK_LIBS) \
-lstdc++
install-plugin: $(lib_LTLIBRARIES)
## GCJ LOCAL: depend on gcjversionedlib_LTLIBRARIES
install-plugin: $(gcjversionedlib_LTLIBRARIES)
$(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR)
$(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR)
+38 -34
View File
@@ -58,9 +58,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__installdirs = "$(DESTDIR)$(gcjversionedlibdir)"
gcjversionedlibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(gcjversionedlib_LTLIBRARIES)
libgcjwebplugin_la_LIBADD =
am_libgcjwebplugin_la_OBJECTS = libgcjwebplugin_la-gcjwebplugin.lo
libgcjwebplugin_la_OBJECTS = $(am_libgcjwebplugin_la_OBJECTS)
@@ -294,14 +294,17 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
lib_LTLIBRARIES = libgcjwebplugin.la
gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
gcjversionedlib_LTLIBRARIES = libgcjwebplugin.la
libgcjwebplugin_la_SOURCES = gcjwebplugin.cc
libgcjwebplugin_la_CXXFLAGS = \
-Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/appletviewer\"" \
-Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \
-DPLUGIN_DATA_DIRECTORY="\"$(PLUGIN_DIR)/gcjwebplugin-data\"" \
$(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
libgcjwebplugin_la_LDFLAGS = -avoid-version \
libgcjwebplugin_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
-version-info `grep -v '^\#' $(top_srcdir)/../libtool-version` \
$(GLIB_LIBS) $(GTK_LIBS) \
-lstdc++
@@ -338,35 +341,35 @@ $(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-libLTLIBRARIES: $(lib_LTLIBRARIES)
install-gcjversionedlibLTLIBRARIES: $(gcjversionedlib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
test -z "$(gcjversionedlibdir)" || $(mkdir_p) "$(DESTDIR)$(gcjversionedlibdir)"
@list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
echo " $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gcjversionedlibdir)/$$f'"; \
$(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gcjversionedlibdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
uninstall-gcjversionedlibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
@set -x; list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gcjversionedlibdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gcjversionedlibdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
clean-gcjversionedlibLTLIBRARIES:
-test -z "$(gcjversionedlib_LTLIBRARIES)" || rm -f $(gcjversionedlib_LTLIBRARIES)
@list='$(gcjversionedlib_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
libgcjwebplugin.la: $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS)
$(CXXLINK) -rpath $(gcjversionedlibdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -493,7 +496,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
for dir in "$(DESTDIR)$(gcjversionedlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -522,7 +525,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-am: clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
@@ -541,9 +544,9 @@ info: info-am
info-am:
install-data-am:
install-data-am: install-gcjversionedlibLTLIBRARIES
install-exec-am: install-libLTLIBRARIES
install-exec-am:
install-info: install-info-am
@@ -569,23 +572,24 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
uninstall-am: uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool 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-libLTLIBRARIES install-man install-strip installcheck \
.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
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-gcjversionedlibLTLIBRARIES install-info \
install-info-am install-man 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-libLTLIBRARIES
tags uninstall uninstall-am \
uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
install-plugin: $(lib_LTLIBRARIES)
install-plugin: $(gcjversionedlib_LTLIBRARIES)
$(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR)
$(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR)
+59 -38
View File
@@ -79,6 +79,10 @@ exception statement from your version. */
g_printerr ("%s:%d: thread %p: Error: %s: %s\n", __FILE__, __LINE__, \
g_thread_self (), first, second)
#define PLUGIN_ERROR_THREE(first, second, third) \
g_printerr ("%s:%d: thread %p: Error: %s: %s: %s\n", __FILE__, \
__LINE__, g_thread_self (), first, second, third)
// Plugin information passed to about:plugins.
#define PLUGIN_NAME "GCJ Web Browser Plugin"
#define PLUGIN_DESC "The " PLUGIN_NAME " executes Java applets."
@@ -120,7 +124,6 @@ exception statement from your version. */
// Security dialog messages.
#define RESPONSE_TRUST_APPLET "Trust Applet"
#define RESPONSE_TRUST_APPLET_ADD_TO_LIST "Trust Applet and Add to Whitelist"
#define WHITELIST_FILENAME PLUGIN_DATA_DIRECTORY "/whitelist.txt"
#define SECURITY_WARNING \
"%s wants to load an applet.\n" \
"GNU Classpath's security implementation is not complete.\n" \
@@ -132,7 +135,7 @@ exception statement from your version. */
" and run this applet from now on, without asking.\n" \
"The whitelist is a list of the URLs from which you trust" \
" applets.\n" \
"Your whitelist file is \"" WHITELIST_FILENAME "\"."
"Your whitelist file is \" %s \"."
#define FAILURE_MESSAGE \
"This page wants to load an applet.\n" \
"The appletviewer is missing or not installed properly in \"" \
@@ -144,9 +147,15 @@ static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
// Browser function table.
static NPNetscapeFuncs browserFunctions;
// Data directory for plugin.
static gchar* data_directory;
// Whitelist filename
static gchar* whitelist_filename;
// Keeps track of initialization. NP_Initialize should only be
// called once.
bool initialized = false;
gboolean initialized = false;
// GCJPluginData stores all the data associated with a single plugin
// instance. A separate plugin instance is created for each <APPLET>
@@ -314,21 +323,40 @@ GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
" Browser not Mozilla-based?");
goto cleanup_appletviewer_mutex;
}
// Open the user's documentbase whitelist.
whitelist_file = g_io_channel_new_file (whitelist_filename,
"a+", &channel_error);
if (!whitelist_file)
{
if (channel_error)
{
PLUGIN_ERROR_THREE ("Failed to open whitelist file",
whitelist_filename,
channel_error->message);
g_error_free (channel_error);
channel_error = NULL;
}
else
PLUGIN_ERROR_TWO ("Failed to open whitelist file",
whitelist_filename);
return NPERR_GENERIC_ERROR;
}
if (!plugin_user_trusts_documentbase (documentbase))
{
PLUGIN_ERROR ("User does not trust applet.");
np_error = NPERR_GENERIC_ERROR;
goto cleanup_appletviewer_mutex;
}
// Create appletviewer-to-plugin pipe which we refer to as the input
// pipe.
// data->in_pipe_name
data->in_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY
"/gcj-%s-appletviewer-to-plugin",
data->instance_string);
data->in_pipe_name = g_strdup_printf ("%s/gcj-%s-appletviewer-to-plugin",
data_directory, data->instance_string);
if (!data->in_pipe_name)
{
PLUGIN_ERROR ("Failed to create input pipe name.");
@@ -349,9 +377,8 @@ GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
// output pipe.
// data->out_pipe_name
data->out_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY
"/gcj-%s-plugin-to-appletviewer",
data->instance_string);
data->out_pipe_name = g_strdup_printf ("%s/gcj-%s-plugin-to-appletviewer",
data_directory, data->instance_string);
if (!data->out_pipe_name)
{
@@ -952,7 +979,7 @@ plugin_user_trusts_documentbase (char* documentbase)
channel_error = NULL;
}
else
PLUGIN_ERROR ("Failed to open whitelist file.");
PLUGIN_ERROR ("Failed to read line from whitelist file.");
g_free (whitelist_entry);
whitelist_entry = NULL;
break;
@@ -1061,7 +1088,7 @@ plugin_ask_user_about_documentbase (char* documentbase)
SECURITY_WARNING,
documentbase);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
SECURITY_DESCRIPTION);
SECURITY_DESCRIPTION, whitelist_filename);
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
@@ -1577,7 +1604,7 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
return NPERR_INVALID_FUNCTABLE_ERROR;
}
// Ensure that the major version of the plugin API that the browser
// expects is not more recent than the major version of the API that
// we've implemented.
@@ -1606,43 +1633,25 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
return NPERR_INVALID_FUNCTABLE_ERROR;
}
data_directory = g_strconcat(getenv("HOME"), "/.gcjwebplugin", NULL);
whitelist_filename = g_strconcat (data_directory, "/whitelist.txt", NULL);
// Make sure the plugin data directory exists, creating it if
// necessary.
if (!g_file_test (PLUGIN_DATA_DIRECTORY,
if (!g_file_test (data_directory,
(GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
{
int file_error = 0;
file_error = g_mkdir (PLUGIN_DATA_DIRECTORY, 0700);
file_error = g_mkdir (data_directory, 0700);
if (file_error != 0)
{
PLUGIN_ERROR_TWO ("Failed to create data directory "
PLUGIN_DATA_DIRECTORY " ",
strerror (errno));
PLUGIN_ERROR_THREE ("Failed to create data directory",
data_directory,
strerror (errno));
return NPERR_GENERIC_ERROR;
}
}
// Open the user's documentbase whitelist.
whitelist_file = g_io_channel_new_file (WHITELIST_FILENAME,
"a+", &channel_error);
if (!whitelist_file)
{
if (channel_error)
{
PLUGIN_ERROR_TWO ("Failed to open whitelist file "
WHITELIST_FILENAME " ",
channel_error->message);
g_error_free (channel_error);
channel_error = NULL;
}
else
PLUGIN_ERROR ("Failed to open whitelist file "
WHITELIST_FILENAME);
return NPERR_GENERIC_ERROR;
}
// Store in a local table the browser functions that we may use.
browserFunctions.version = browserTable->version;
browserFunctions.size = browserTable->size;
@@ -1750,6 +1759,18 @@ NP_Shutdown (void)
g_io_channel_close (whitelist_file);
whitelist_file = NULL;
}
if (data_directory)
{
g_free (data_directory);
data_directory = NULL;
}
if (whitelist_filename)
{
g_free (whitelist_filename);
whitelist_filename = NULL;
}
initialized = false;