Commit f06a83c0 by Matthias Klose

Import GNU Classpath (libgcj-import-20070727).

libjava/

2007-08-04  Matthias Klose  <doko@ubuntu.com>

	Import GNU Classpath (libgcj-import-20070727).

	* Regenerate class and header files.
	* Regenerate auto* files.

	* include/jvm.h:
	* jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type.
	* jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise.
	* jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA,
	_Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA,
	_Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA,
	_Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify
	jvalue parameter.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.

	* java/lang/VMFloat.java (toString, parseFloat): New.

	* gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported,
	isModalExclusionTypeSupported): New (stub only).
	* gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise.
	* gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages,
	updateFocusableWindowState, setModalBlocked, getBoundsPrivate,
	setAlwaysOnTop): Likewise.
	* gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature.

	* scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer,
	ignore javax.sound.sampled.spi.MixerProvider, ignore .in files.

	* HACKING: Mention --enable-gstreamer-peer, removal of generated files.


libjava/classpath/

2007-08-04  Matthias Klose  <doko@ubuntu.com>

	* java/util/EnumMap.java (clone): Add cast.

From-SVN: r127204
parent 2c3de459
2007-08-04 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20070727).
* Regenerate class and header files.
* Regenerate auto* files.
* include/jvm.h:
* jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type.
* jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise.
* jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA,
_Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA,
_Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA,
_Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify
jvalue parameter.
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.
* java/lang/VMFloat.java (toString, parseFloat): New.
* gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported,
isModalExclusionTypeSupported): New (stub only).
* gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise.
* gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages,
updateFocusableWindowState, setModalBlocked, getBoundsPrivate,
setAlwaysOnTop): Likewise.
* gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature.
* scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer,
ignore javax.sound.sampled.spi.MixerProvider, ignore .in files.
* HACKING: Mention --enable-gstreamer-peer, removal of generated files.
2007-07-31 David Daney <ddaney@avtrex.com> 2007-07-31 David Daney <ddaney@avtrex.com>
* HACKING: Document regenerating configure and aclocal.m4. * HACKING: Document regenerating configure and aclocal.m4.
......
...@@ -104,17 +104,27 @@ To import a new release: ...@@ -104,17 +104,27 @@ To import a new release:
cd .. cd ..
scripts/makemake.tcl > sources.am scripts/makemake.tcl > sources.am
automake automake
- Remove the generated class and header files:
find classpath -name '*.class' xargs -r rm -f
find gnu java javax org sun -name '*.h' \
| xargs -r grep -Fl 'DO NOT EDIT THIS FILE - it is machine generated' \
| xargs -r rm -f
- Build, fix, till everything works. - Build, fix, till everything works.
Be sure to build all peers (--enable-java-awt=gtk,xlib,qt Be sure to build all peers (--enable-java-awt=gtk,xlib,qt
--enable-gconf-peer) --enable-gconf-peer --enable-gstreamer-peer)
Be sure to update gnu/classpath/Configuration.java to reflect Be sure to update gnu/classpath/Configuration.java to reflect
the new version the new version
Possibly update the gcj/javaprims.h file with scripts/classes.pl Possibly update the gcj/javaprims.h file with scripts/classes.pl
(See below, it can only be done after the first source->bytecode (See below, it can only be done after the first source->bytecode
pass has finished.) pass has finished.)
You will need to configure with --enable-maintainer-mode and you You will need to configure with --enable-java-maintainer-mode and you
will need to update the .class files and generated CNI header files in will need to update the .class files and generated CNI header files in
your working tree your working tree
- Add/Remove newly generated files:
- svn status classpath | grep '^\!.*\.class$' | cut -c8- | xargs svn remove
- svn status classpath | grep '^\?' | cut -c8- | xargs svn add
- svn status gnu java javax org sun | grep '^\!.*\.h$' | cut -c8- | xargs svn remove
- svn status gnu java javax org sun | grep '^\?' | cut -c8- | xargs svn add
Over time we plan to remove as many of the remaining divergences as Over time we plan to remove as many of the remaining divergences as
possible. possible.
......
...@@ -223,10 +223,10 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \ ...@@ -223,10 +223,10 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
gnu/javax/print/ipp/attribute/printer.lo \ gnu/javax/print/ipp/attribute/printer.lo \
gnu/javax/print/ipp/attribute/supported.lo \ gnu/javax/print/ipp/attribute/supported.lo \
gnu/javax/security/auth.lo gnu/javax/security/auth/callback.lo \ gnu/javax/security/auth.lo gnu/javax/security/auth/callback.lo \
gnu/javax/security/auth/login.lo gnu/javax/sound/sampled/AU.lo \ gnu/javax/security/auth/login.lo gnu/javax/sound.lo \
gnu/javax/sound/sampled/WAV.lo gnu/javax/swing/plaf/gnu.lo \ gnu/javax/sound/sampled/AU.lo gnu/javax/sound/sampled/WAV.lo \
gnu/javax/swing/plaf/metal.lo gnu/javax/swing/text/html.lo \ gnu/javax/swing/plaf/gnu.lo gnu/javax/swing/plaf/metal.lo \
gnu/javax/swing/text/html/css.lo \ gnu/javax/swing/text/html.lo gnu/javax/swing/text/html/css.lo \
gnu/javax/swing/text/html/parser/GnuParserDelegator.lo \ gnu/javax/swing/text/html/parser/GnuParserDelegator.lo \
gnu/javax/swing/text/html/parser/HTML_401F.lo \ gnu/javax/swing/text/html/parser/HTML_401F.lo \
gnu/javax/swing/text/html/parser/SmallHtmlAttributeSet.lo \ gnu/javax/swing/text/html/parser/SmallHtmlAttributeSet.lo \
...@@ -278,9 +278,9 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \ ...@@ -278,9 +278,9 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
javax/swing/text/html.lo javax/swing/text/html/parser.lo \ javax/swing/text/html.lo javax/swing/text/html/parser.lo \
javax/swing/text/rtf.lo javax/swing/tree.lo \ javax/swing/text/rtf.lo javax/swing/tree.lo \
javax/swing/undo.lo javax/transaction.lo \ javax/swing/undo.lo javax/transaction.lo \
javax/transaction/xa.lo org/ietf/jgss.lo sun/misc.lo \ javax/transaction/xa.lo org/ietf/jgss.lo sun/awt.lo \
sun/reflect.lo sun/reflect/annotation.lo sun/reflect/misc.lo \ sun/misc.lo sun/reflect.lo sun/reflect/annotation.lo \
$(am__DEPENDENCIES_1) sun/reflect/misc.lo $(am__DEPENDENCIES_1)
am__DEPENDENCIES_3 = gnu-CORBA.lo gnu-java-awt-dnd-peer-gtk.lo \ am__DEPENDENCIES_3 = gnu-CORBA.lo gnu-java-awt-dnd-peer-gtk.lo \
gnu-java-awt-peer-gtk.lo gnu-java-awt-peer-swing.lo \ gnu-java-awt-peer-gtk.lo gnu-java-awt-peer-swing.lo \
gnu-java-beans.lo gnu-java-lang-management.lo \ gnu-java-beans.lo gnu-java-lang-management.lo \
...@@ -1524,12 +1524,14 @@ classpath/gnu/java/awt/java2d/AlphaCompositeContext.java \ ...@@ -1524,12 +1524,14 @@ classpath/gnu/java/awt/java2d/AlphaCompositeContext.java \
classpath/gnu/java/awt/java2d/CubicSegment.java \ classpath/gnu/java/awt/java2d/CubicSegment.java \
classpath/gnu/java/awt/java2d/ImagePaint.java \ classpath/gnu/java/awt/java2d/ImagePaint.java \
classpath/gnu/java/awt/java2d/LineSegment.java \ classpath/gnu/java/awt/java2d/LineSegment.java \
classpath/gnu/java/awt/java2d/Pixelizer.java \
classpath/gnu/java/awt/java2d/PolyEdge.java \ classpath/gnu/java/awt/java2d/PolyEdge.java \
classpath/gnu/java/awt/java2d/PolyEdgeComparator.java \ classpath/gnu/java/awt/java2d/PolyEdgeComparator.java \
classpath/gnu/java/awt/java2d/QuadSegment.java \ classpath/gnu/java/awt/java2d/QuadSegment.java \
classpath/gnu/java/awt/java2d/RasterGraphics.java \ classpath/gnu/java/awt/java2d/RasterGraphics.java \
classpath/gnu/java/awt/java2d/Scanline.java \ classpath/gnu/java/awt/java2d/Scanline.java \
classpath/gnu/java/awt/java2d/ScanlineConverter.java \ classpath/gnu/java/awt/java2d/ScanlineConverter.java \
classpath/gnu/java/awt/java2d/ScanlineCoverage.java \
classpath/gnu/java/awt/java2d/Segment.java \ classpath/gnu/java/awt/java2d/Segment.java \
classpath/gnu/java/awt/java2d/ShapeCache.java \ classpath/gnu/java/awt/java2d/ShapeCache.java \
classpath/gnu/java/awt/java2d/TexturePaintContext.java classpath/gnu/java/awt/java2d/TexturePaintContext.java
...@@ -1650,6 +1652,7 @@ classpath/gnu/java/awt/peer/qt/QtWindowPeer.java ...@@ -1650,6 +1652,7 @@ classpath/gnu/java/awt/peer/qt/QtWindowPeer.java
gnu_java_awt_peer_swing_source_files = \ gnu_java_awt_peer_swing_source_files = \
classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java \ classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java \
classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java \ classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java \
classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java \
classpath/gnu/java/awt/peer/swing/SwingComponent.java \ classpath/gnu/java/awt/peer/swing/SwingComponent.java \
classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java \ classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java \
classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java \ classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java \
...@@ -1669,20 +1672,19 @@ gnu_java_awt_peer_x_source_files = \ ...@@ -1669,20 +1672,19 @@ gnu_java_awt_peer_x_source_files = \
classpath/gnu/java/awt/peer/x/GLGraphics.java \ classpath/gnu/java/awt/peer/x/GLGraphics.java \
classpath/gnu/java/awt/peer/x/ImageConverter.java \ classpath/gnu/java/awt/peer/x/ImageConverter.java \
classpath/gnu/java/awt/peer/x/KeyboardMapping.java \ classpath/gnu/java/awt/peer/x/KeyboardMapping.java \
classpath/gnu/java/awt/peer/x/PixmapVolatileImage.java \
classpath/gnu/java/awt/peer/x/XDialogPeer.java \ classpath/gnu/java/awt/peer/x/XDialogPeer.java \
classpath/gnu/java/awt/peer/x/XEventPump.java \ classpath/gnu/java/awt/peer/x/XEventPump.java \
classpath/gnu/java/awt/peer/x/XFontPeer.java \
classpath/gnu/java/awt/peer/x/XFontPeer2.java \ classpath/gnu/java/awt/peer/x/XFontPeer2.java \
classpath/gnu/java/awt/peer/x/XFramePeer.java \ classpath/gnu/java/awt/peer/x/XFramePeer.java \
classpath/gnu/java/awt/peer/x/XGraphics.java \
classpath/gnu/java/awt/peer/x/XGraphics2D.java \ classpath/gnu/java/awt/peer/x/XGraphics2D.java \
classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java \ classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java \
classpath/gnu/java/awt/peer/x/XGraphicsDevice.java \ classpath/gnu/java/awt/peer/x/XGraphicsDevice.java \
classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java \ classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java \
classpath/gnu/java/awt/peer/x/XImage.java \ classpath/gnu/java/awt/peer/x/XImage.java \
classpath/gnu/java/awt/peer/x/XLightweightPeer.java \
classpath/gnu/java/awt/peer/x/XToolkit.java \ classpath/gnu/java/awt/peer/x/XToolkit.java \
classpath/gnu/java/awt/peer/x/XWindowPeer.java classpath/gnu/java/awt/peer/x/XWindowPeer.java \
classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java
gnu_java_awt_print_source_files = \ gnu_java_awt_print_source_files = \
classpath/gnu/java/awt/print/JavaPrinterGraphics.java \ classpath/gnu/java/awt/print/JavaPrinterGraphics.java \
...@@ -3221,6 +3223,10 @@ classpath/gnu/javax/security/auth/login/ConfigFileTokenizer.java \ ...@@ -3221,6 +3223,10 @@ classpath/gnu/javax/security/auth/login/ConfigFileTokenizer.java \
classpath/gnu/javax/security/auth/login/GnuConfiguration.java classpath/gnu/javax/security/auth/login/GnuConfiguration.java
gnu_javax_security_auth_login_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_security_auth_login_source_files))) gnu_javax_security_auth_login_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_security_auth_login_source_files)))
gnu_javax_sound_source_files = \
classpath/gnu/javax/sound/AudioSecurityManager.java
gnu_javax_sound_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_sound_source_files)))
gnu_javax_sound_midi_source_files = \ gnu_javax_sound_midi_source_files = \
classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \ classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \
classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \ classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \
...@@ -4523,6 +4529,7 @@ classpath/java/nio/ByteBufferImpl.java \ ...@@ -4523,6 +4529,7 @@ classpath/java/nio/ByteBufferImpl.java \
classpath/java/nio/ByteOrder.java \ classpath/java/nio/ByteOrder.java \
classpath/java/nio/CharBuffer.java \ classpath/java/nio/CharBuffer.java \
classpath/java/nio/CharBufferImpl.java \ classpath/java/nio/CharBufferImpl.java \
classpath/java/nio/CharSequenceBuffer.java \
classpath/java/nio/CharViewBufferImpl.java \ classpath/java/nio/CharViewBufferImpl.java \
java/nio/DirectByteBufferImpl.java \ java/nio/DirectByteBufferImpl.java \
classpath/java/nio/DoubleBuffer.java \ classpath/java/nio/DoubleBuffer.java \
...@@ -7295,6 +7302,10 @@ classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java \ ...@@ -7295,6 +7302,10 @@ classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java \
classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java \ classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java \
classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java
sun_awt_source_files = \
classpath/sun/awt/CausedFocusEvent.java
sun_awt_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(sun_awt_source_files)))
sun_misc_source_files = \ sun_misc_source_files = \
classpath/sun/misc/Service.java \ classpath/sun/misc/Service.java \
classpath/sun/misc/ServiceConfigurationError.java \ classpath/sun/misc/ServiceConfigurationError.java \
...@@ -7460,6 +7471,7 @@ all_packages_source_files = \ ...@@ -7460,6 +7471,7 @@ all_packages_source_files = \
gnu/javax/security/auth.list \ gnu/javax/security/auth.list \
gnu/javax/security/auth/callback.list \ gnu/javax/security/auth/callback.list \
gnu/javax/security/auth/login.list \ gnu/javax/security/auth/login.list \
gnu/javax/sound.list \
gnu/javax/sound/sampled/AU.list \ gnu/javax/sound/sampled/AU.list \
gnu/javax/sound/sampled/WAV.list \ gnu/javax/sound/sampled/WAV.list \
gnu/javax/swing/plaf/gnu.list \ gnu/javax/swing/plaf/gnu.list \
...@@ -7581,6 +7593,7 @@ all_packages_source_files = \ ...@@ -7581,6 +7593,7 @@ all_packages_source_files = \
javax/transaction.list \ javax/transaction.list \
javax/transaction/xa.list \ javax/transaction/xa.list \
org/ietf/jgss.list \ org/ietf/jgss.list \
sun/awt.list \
sun/misc.list \ sun/misc.list \
sun/reflect.list \ sun/reflect.list \
sun/reflect/annotation.list \ sun/reflect/annotation.list \
...@@ -7706,6 +7719,7 @@ ordinary_header_files = \ ...@@ -7706,6 +7719,7 @@ ordinary_header_files = \
$(gnu_javax_security_auth_header_files) \ $(gnu_javax_security_auth_header_files) \
$(gnu_javax_security_auth_callback_header_files) \ $(gnu_javax_security_auth_callback_header_files) \
$(gnu_javax_security_auth_login_header_files) \ $(gnu_javax_security_auth_login_header_files) \
$(gnu_javax_sound_header_files) \
$(gnu_javax_sound_sampled_AU_header_files) \ $(gnu_javax_sound_sampled_AU_header_files) \
$(gnu_javax_sound_sampled_WAV_header_files) \ $(gnu_javax_sound_sampled_WAV_header_files) \
$(gnu_javax_swing_plaf_gnu_header_files) \ $(gnu_javax_swing_plaf_gnu_header_files) \
...@@ -7822,6 +7836,7 @@ ordinary_header_files = \ ...@@ -7822,6 +7836,7 @@ ordinary_header_files = \
$(javax_transaction_header_files) \ $(javax_transaction_header_files) \
$(javax_transaction_xa_header_files) \ $(javax_transaction_xa_header_files) \
$(org_ietf_jgss_header_files) \ $(org_ietf_jgss_header_files) \
$(sun_awt_header_files) \
$(sun_misc_header_files) \ $(sun_misc_header_files) \
$(sun_reflect_header_files) \ $(sun_reflect_header_files) \
$(sun_reflect_annotation_header_files) \ $(sun_reflect_annotation_header_files) \
...@@ -10966,6 +10981,12 @@ gnu/javax/security/auth/login.list: $(gnu_javax_security_auth_login_source_files ...@@ -10966,6 +10981,12 @@ gnu/javax/security/auth/login.list: $(gnu_javax_security_auth_login_source_files
-include gnu/javax/security/auth/login.deps -include gnu/javax/security/auth/login.deps
gnu/javax/sound.list: $(gnu_javax_sound_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/gnu/javax/sound/*.class > gnu/javax/sound.list
-include gnu/javax/sound.deps
gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files) gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files)
@find $(srcdir)/classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list @find $(srcdir)/classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list
$(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list
...@@ -11782,6 +11803,12 @@ org-xml.lo: $(org_xml_source_files) ...@@ -11782,6 +11803,12 @@ org-xml.lo: $(org_xml_source_files)
$(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list
@rm -f org-xml.list @rm -f org-xml.list
sun/awt.list: $(sun_awt_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/sun/awt/*.class > sun/awt.list
-include sun/awt.deps
sun/misc.list: $(sun_misc_source_files) sun/misc.list: $(sun_misc_source_files)
@$(mkinstalldirs) $(dir $@) @$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/sun/misc/*.class > sun/misc.list echo $(srcdir)/classpath/lib/sun/misc/*.class > sun/misc.list
......
2007-08-04 Matthias Klose <doko@ubuntu.com>
* java/util/EnumMap.java (clone): Add cast.
2007-07-12 Matthias Klose <doko@ubuntu.com> 2007-07-12 Matthias Klose <doko@ubuntu.com>
* lib/jazzlib, tools/gnu/classpath/tools/rmi: Remove empty directories. * lib/jazzlib, tools/gnu/classpath/tools/rmi: Remove empty directories.
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR) SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples DIST_SUBDIRS = lib doc external include native resource scripts tools examples
# Allow users to pass site-specific flags to autoreconf via an env var.
## GCJ LOCAL: we need an extra -I here. ## GCJ LOCAL: we need an extra -I here.
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config ${LOCAL_AUTORECONF_FLAGS}
native: lib native: lib
......
...@@ -45,6 +45,8 @@ DIST_COMMON = README $(am__configure_deps) \ ...@@ -45,6 +45,8 @@ DIST_COMMON = README $(am__configure_deps) \
$(top_srcdir)/gnu/classpath/Configuration.java.in \ $(top_srcdir)/gnu/classpath/Configuration.java.in \
$(top_srcdir)/gnu/java/security/Configuration.java.in \ $(top_srcdir)/gnu/java/security/Configuration.java.in \
$(top_srcdir)/resource/META-INF/services/java.util.prefs.PreferencesFactory.in \ $(top_srcdir)/resource/META-INF/services/java.util.prefs.PreferencesFactory.in \
$(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader.in \
$(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.MixerProvider.in \
../../ABOUT-NLS ../../COPYING ../../COPYING.LIB \ ../../ABOUT-NLS ../../COPYING ../../COPYING.LIB \
../../ChangeLog ../../README ../../compile ../../config.guess \ ../../ChangeLog ../../README ../../compile ../../config.guess \
../../config.rpath ../../config.sub ../../depcomp \ ../../config.rpath ../../config.sub ../../depcomp \
...@@ -79,7 +81,9 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs ...@@ -79,7 +81,9 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = gnu/classpath/Configuration.java \ CONFIG_CLEAN_FILES = gnu/classpath/Configuration.java \
gnu/java/security/Configuration.java \ gnu/java/security/Configuration.java \
resource/META-INF/services/java.util.prefs.PreferencesFactory resource/META-INF/services/java.util.prefs.PreferencesFactory \
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader \
resource/META-INF/services/javax.sound.sampled.spi.MixerProvider
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
MULTISRCTOP = MULTISRCTOP =
...@@ -142,6 +146,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -142,6 +146,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -180,8 +186,6 @@ EXEEXT = @EXEEXT@ ...@@ -180,8 +186,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -205,6 +209,15 @@ GJDOC = @GJDOC@ ...@@ -205,6 +209,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -277,8 +290,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -277,8 +290,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
...@@ -354,7 +365,9 @@ vm_classes = @vm_classes@ ...@@ -354,7 +365,9 @@ vm_classes = @vm_classes@
# lib first, to compile .class files before native code, last examples # lib first, to compile .class files before native code, last examples
SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR) SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples DIST_SUBDIRS = lib doc external include native resource scripts tools examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
# Allow users to pass site-specific flags to autoreconf via an env var.
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config ${LOCAL_AUTORECONF_FLAGS}
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \ EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \ ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \
ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
...@@ -402,6 +415,10 @@ gnu/java/security/Configuration.java: $(top_builddir)/config.status $(top_srcdir ...@@ -402,6 +415,10 @@ gnu/java/security/Configuration.java: $(top_builddir)/config.status $(top_srcdir
cd $(top_builddir) && $(SHELL) ./config.status $@ cd $(top_builddir) && $(SHELL) ./config.status $@
resource/META-INF/services/java.util.prefs.PreferencesFactory: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/java.util.prefs.PreferencesFactory.in resource/META-INF/services/java.util.prefs.PreferencesFactory: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/java.util.prefs.PreferencesFactory.in
cd $(top_builddir) && $(SHELL) ./config.status $@ cd $(top_builddir) && $(SHELL) ./config.status $@
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader.in
cd $(top_builddir) && $(SHELL) ./config.status $@
resource/META-INF/services/javax.sound.sampled.spi.MixerProvider: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.MixerProvider.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
......
New in release 0.96
Runtime interface changes:
* Add VMFloat.toString(float) and VMFloat.parseFloat(String). Default
implementations are the same as previous behavior.
New in release 0.95 (Apr 23, 2007) New in release 0.95 (Apr 23, 2007)
* Full merge of 1.5 generics work. * Full merge of 1.5 generics work.
......
...@@ -28,50 +28,9 @@ if $have_libtool ; then : ; else ...@@ -28,50 +28,9 @@ if $have_libtool ; then : ; else
echo "You must have libtool 1.5 installed to compile $PROJECT." echo "You must have libtool 1.5 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution," echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/" echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
echo "For Darwin you need the latest stable (1.5.18) to support" echo "For Darwin you need the latest stable (1.5.22) to support"
echo "Frameworks linking. Also, you have to point ACLOCAL_FLAGS" echo "Frameworks linking. Also, you have to point"
echo "to this libtool/share/aclocal." echo "LOCAL_AUTORECONF_FLAGS to this libtool/share/aclocal."
DIE=1
fi
have_autoconf=false
if autoconf --version < /dev/null > /dev/null 2>&1 ; then
autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $autoconf_version in
2.59* | 2.6[0-9]* )
have_autoconf=true
;;
esac
fi
if $have_autoconf ; then : ; else
echo
echo "You must have autoconf 2.59 or later installed for $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
DIE=1
fi
have_automake=false
# We know each 1.9.x version works
if automake-1.9 --version < /dev/null > /dev/null 2>&1 ; then
AUTOMAKE=automake-1.9
ACLOCAL=aclocal-1.9
have_automake=true
elif automake --version < /dev/null > /dev/null 2>&1 ; then
AUTOMAKE=automake
ACLOCAL=aclocal
automake_version=`automake --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $automake_version in
1.9* | 1.10*)
have_automake=true
;;
esac
fi
if $have_automake ; then : ; else
echo
echo "You must have automake 1.9 or 1.10 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
DIE=1 DIE=1
fi fi
...@@ -91,34 +50,8 @@ if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then ...@@ -91,34 +50,8 @@ if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then
fi fi
fi fi
if test -z "$ACLOCAL_FLAGS"; then autoreconf --force --install --warnings=no-portability || exit $?
acdir=`$ACLOCAL --print-ac-dir`
m4list="glib-2.0.m4 glib-gettext.m4"
for file in $m4list
do
if [ ! -f "$acdir/$file" ]; then
echo "WARNING: aclocal's directory is $acdir, but..."
echo " no file $acdir/$file"
echo " You may see fatal macro warnings below."
echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
echo " environment variable to \"-I /some/dir\", or install"
echo " $acdir/$file."
echo ""
fi
done
fi
# Use the "-I m4 flag in order to include pkg.m4 and other .m4 files.
$ACLOCAL -I m4 $ACLOCAL_FLAGS || exit $?
${LIBTOOLIZE} --force || exit $?
autoheader || exit $?
$AUTOMAKE --add-missing || exit $?
autoconf || exit $?
cd $ORIGDIR || exit $? cd $ORIGDIR || exit $?
if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then
......
...@@ -6,7 +6,7 @@ dnl ----------------------------------------------------------- ...@@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl dnl define([AC_CACHE_SAVE], )dnl
AC_INIT([GNU Classpath],[0.95],[classpath@gnu.org],[classpath]) AC_INIT([GNU Classpath],[0.96-pre],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java) AC_CONFIG_SRCDIR(java/lang/System.java)
dnl GCJ LOCAL dnl GCJ LOCAL
...@@ -150,11 +150,29 @@ AC_ARG_ENABLE([gconf-peer], ...@@ -150,11 +150,29 @@ AC_ARG_ENABLE([gconf-peer],
AM_CONDITIONAL(CREATE_GCONF_PEER_LIBRARIES, test "x${COMPILE_GCONF_PEER}" = xyes) AM_CONDITIONAL(CREATE_GCONF_PEER_LIBRARIES, test "x${COMPILE_GCONF_PEER}" = xyes)
dnl ----------------------------------------------------------- dnl -----------------------------------------------------------
dnl GTK native peer error checking dnl GConf native peer error checking
dnl ----------------------------------------------------------- dnl -----------------------------------------------------------
AC_ARG_ENABLE([gconf-peers],,AC_MSG_ERROR([No --enable-gconf-peers (or --disable-gconf-peers) option; you want --enable-gconf-peer])) AC_ARG_ENABLE([gconf-peers],,AC_MSG_ERROR([No --enable-gconf-peers (or --disable-gconf-peers) option; you want --enable-gconf-peer]))
dnl ------------------------------------------------------------ dnl ------------------------------------------------------------
dnl GStreamer based sound provider backend (disabled by default)
dnl ------------------------------------------------------------
AC_ARG_ENABLE([gstreamer-peer],
[AS_HELP_STRING(--enable-gstreamer-peer,compile GStreamer native peers (disabled by --disable-jni) [default=no])],
[case "${enableval}" in
yes) COMPILE_GSTREAMER_PEER=yes ;;
no) COMPILE_GSTREAMER_PEER=no ;;
*) COMPILE_GSTREAMER_PEER=default ;;
esac],
[COMPILE_GSTREAMER_PEER=default])
AM_CONDITIONAL(CREATE_GSTREAMER_PEER_LIBRARIES, test "x${COMPILE_GSTREAMER_PEER}" = xyes)
dnl -----------------------------------------------------------
dnl GStreamer native peer error checking
dnl -----------------------------------------------------------
AC_ARG_ENABLE([gstreamer-peers],,AC_MSG_ERROR([No --enable-gstreamer-peers (or --disable-gstreamer-peers) option; you want --enable-gstreamer-peer]))
dnl ------------------------------------------------------------
dnl Whether to compile with -Werror or not (disabled by default) dnl Whether to compile with -Werror or not (disabled by default)
dnl ------------------------------------------------------------ dnl ------------------------------------------------------------
AC_ARG_ENABLE([Werror], AC_ARG_ENABLE([Werror],
...@@ -315,7 +333,6 @@ AC_ARG_WITH([vm], ...@@ -315,7 +333,6 @@ AC_ARG_WITH([vm],
]) ])
AC_SUBST(VM_BINARY) AC_SUBST(VM_BINARY)
AM_CONDITIONAL(FOUND_CACAO, test "x`basename $VM_BINARY`" = xcacao)
dnl ----------------------------------------------------------- dnl -----------------------------------------------------------
dnl Regenerate headers at build time (disabled by default) dnl Regenerate headers at build time (disabled by default)
...@@ -416,6 +433,7 @@ if test "x${COMPILE_JNI}" = xyes; then ...@@ -416,6 +433,7 @@ if test "x${COMPILE_JNI}" = xyes; then
AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t])) AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t])) AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
AC_SEARCH_LIBS([inet_pton],[nsl])
AC_CHECK_FUNCS([ftruncate fsync select \ AC_CHECK_FUNCS([ftruncate fsync select \
gethostname socket strerror fork pipe execve open close \ gethostname socket strerror fork pipe execve open close \
lseek fstat read readv write writev htonl memset htons connect \ lseek fstat read readv write writev htonl memset htons connect \
...@@ -566,6 +584,39 @@ if test "x${COMPILE_JNI}" = xyes; then ...@@ -566,6 +584,39 @@ if test "x${COMPILE_JNI}" = xyes; then
fi fi
fi fi
dnl gstreamer-peer
if test "x${COMPILE_GSTREAMER_PEER}" = xyes; then
GST_MAJORMINOR=0.10
GST_REQUIRED=0.10.10
dnl gstreamer
PKG_CHECK_MODULES(GSTREAMER, gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED)
AC_SUBST(GSTREAMER_CFLAGS)
AC_SUBST(GSTREAMER_LIBS)
dnl gstreamer-base
PKG_CHECK_MODULES(GSTREAMER_BASE,
gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED)
AC_SUBST(GSTREAMER_BASE_CFLAGS)
AC_SUBST(GSTREAMER_BASE_LIBS)
dnl gstreamer-plugin-base
PKG_CHECK_MODULES(GSTREAMER_PLUGINS_BASE,
gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQUIRED)
AC_SUBST(GSTREAMER_PLUGINS_BASE_CFLAGS)
AC_SUBST(GSTREAMER_PLUGINS_BASE_LIBS)
GST_PLUGIN_LDFLAGS='-module -avoid-version -Wno-unused-parameter -no-undefined'
AC_SUBST(GST_PLUGIN_LDFLAGS)
dnl set the gstreamer based file reader, writer and mixer
GSTREAMER_FILE_READER=gnu.javax.sound.sampled.gstreamer.io.GstAudioFileReader
GSTREAMER_MIXER_PROVIDER=gnu.javax.sound.sampled.gstreamer.GStreamerMixerProvider
fi
dnl add the gstreamer resources
AC_SUBST(GSTREAMER_FILE_READER)
AC_SUBST(GSTREAMER_MIXER_PROVIDER)
dnl Check for AWT related Qt4 dnl Check for AWT related Qt4
if test "x${COMPILE_QT_PEER}" = xyes; then if test "x${COMPILE_QT_PEER}" = xyes; then
PKG_CHECK_MODULES(QT, QtCore QtGui >= 4.1.0, HAVE_QT4="yes", HAVE_QT4="no") PKG_CHECK_MODULES(QT, QtCore QtGui >= 4.1.0, HAVE_QT4="yes", HAVE_QT4="no")
...@@ -637,6 +688,17 @@ if test "x${COMPILE_JNI}" = xyes; then ...@@ -637,6 +688,17 @@ if test "x${COMPILE_JNI}" = xyes; then
[Define this symbol if you have SO_NOSIGPIPE]) ], [Define this symbol if you have SO_NOSIGPIPE]) ],
[ AC_MSG_RESULT(no)] [ AC_MSG_RESULT(no)]
) )
dnl **********************************************************************
dnl Check for MSG_WAITALL
dnl **********************************************************************
AC_MSG_CHECKING(for MSG_WAITALL)
AC_TRY_COMPILE([#include <sys/socket.h>],
[ int f = MSG_WAITALL; ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MSG_WAITALL, 1,
[Define this symbol if you have MSG_WAITALL]) ],
[ AC_MSG_RESULT(no)]
)
dnl Check for plugin support headers and libraries. dnl Check for plugin support headers and libraries.
if test "x${COMPILE_PLUGIN}" = xyes; then if test "x${COMPILE_PLUGIN}" = xyes; then
...@@ -674,7 +736,9 @@ if test "x${COMPILE_JNI}" = xyes; then ...@@ -674,7 +736,9 @@ if test "x${COMPILE_JNI}" = xyes; then
fi fi
fi fi
CLASSPATH_WITH_JAVAH if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
CLASSPATH_WITH_JAVAH
fi
dnl ----------------------------------------------------------- dnl -----------------------------------------------------------
dnl Add the include files for the native abstraction layer. dnl Add the include files for the native abstraction layer.
...@@ -944,6 +1008,7 @@ native/jni/java-nio/Makefile ...@@ -944,6 +1008,7 @@ native/jni/java-nio/Makefile
native/jni/java-util/Makefile native/jni/java-util/Makefile
native/jni/gtk-peer/Makefile native/jni/gtk-peer/Makefile
native/jni/gconf-peer/Makefile native/jni/gconf-peer/Makefile
native/jni/gstreamer-peer/Makefile
native/jni/qt-peer/Makefile native/jni/qt-peer/Makefile
native/jni/xmlj/Makefile native/jni/xmlj/Makefile
native/jni/midi-alsa/Makefile native/jni/midi-alsa/Makefile
...@@ -952,6 +1017,8 @@ native/jni/native-lib/Makefile ...@@ -952,6 +1017,8 @@ native/jni/native-lib/Makefile
native/plugin/Makefile native/plugin/Makefile
resource/Makefile resource/Makefile
resource/META-INF/services/java.util.prefs.PreferencesFactory resource/META-INF/services/java.util.prefs.PreferencesFactory
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader
resource/META-INF/services/javax.sound.sampled.spi.MixerProvider
scripts/Makefile scripts/Makefile
scripts/classpath.spec scripts/classpath.spec
lib/Makefile lib/Makefile
......
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
scriptversion=2006-10-15.18 scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -92,20 +91,7 @@ gcc3) ...@@ -92,20 +91,7 @@ gcc3)
## gcc 3 implements dependency tracking that does exactly what ## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm. ## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
...@@ -290,46 +276,6 @@ icc) ...@@ -290,46 +276,6 @@ icc)
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64) tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side # The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
...@@ -342,13 +288,13 @@ tru64) ...@@ -342,13 +288,13 @@ tru64)
if test "$libtool" = yes; then if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a # With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to # static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation. # handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
# #
# With libtool 1.5 this exception was removed, and libtool now # With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two # generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and # compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because # in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer # one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
......
...@@ -123,6 +123,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -123,6 +123,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -161,8 +163,6 @@ EXEEXT = @EXEEXT@ ...@@ -161,8 +163,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -186,6 +186,15 @@ GJDOC = @GJDOC@ ...@@ -186,6 +186,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -258,8 +267,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -258,8 +267,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -100,6 +100,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -100,6 +100,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -138,8 +140,6 @@ EXEEXT = @EXEEXT@ ...@@ -138,8 +140,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -163,6 +163,15 @@ GJDOC = @GJDOC@ ...@@ -163,6 +163,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -235,8 +244,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -235,8 +244,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -109,6 +109,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -109,6 +109,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -147,8 +149,6 @@ EXEEXT = @EXEEXT@ ...@@ -147,8 +149,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -172,6 +172,15 @@ GJDOC = @GJDOC@ ...@@ -172,6 +172,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -244,8 +253,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -244,8 +253,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -20,17 +20,28 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -20,17 +20,28 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
package gnu.classpath.examples.awt; package gnu.classpath.examples.awt;
import gnu.java.awt.font.*; import gnu.java.awt.font.FontDelegate;
import gnu.java.awt.font.opentype.*; import gnu.java.awt.font.GNUGlyphVector;
import gnu.java.awt.font.opentype.OpenTypeFontFactory;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.font.*; import java.awt.font.FontRenderContext;
import java.io.*; import java.io.File;
import java.nio.*; import java.io.RandomAccessFile;
import java.nio.channels.*; import java.nio.ByteBuffer;
import java.text.*; import java.nio.channels.FileChannel;
import java.text.StringCharacterIterator;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
...@@ -57,6 +68,9 @@ public class HintingDemo extends JFrame { ...@@ -57,6 +68,9 @@ public class HintingDemo extends JFrame {
char character; char character;
Options options; Options options;
boolean antiAlias; boolean antiAlias;
boolean showGrid;
boolean showOriginal;
boolean showHinted;
int flags; int flags;
class StringViewer extends JPanel class StringViewer extends JPanel
...@@ -133,24 +147,35 @@ public class HintingDemo extends JFrame { ...@@ -133,24 +147,35 @@ public class HintingDemo extends JFrame {
Insets i = getInsets(); Insets i = getInsets();
g2d.clearRect(i.left, i.top, getWidth() - i.left - i.right, g2d.clearRect(i.left, i.top, getWidth() - i.left - i.right,
getHeight() - i.top - i.bottom); getHeight() - i.top - i.bottom);
g2d.setColor(Color.GRAY); if (showGrid)
for (int x = 20; x < getWidth(); x += 20)
{
g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
}
for (int y = 20; y < getHeight(); y += 20)
{ {
g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y); g2d.setColor(Color.GRAY);
for (int x = 20; x < getWidth(); x += 20)
{
g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
}
for (int y = 20; y < getHeight(); y += 20)
{
g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
}
} }
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF); // RenderingHints.VALUE_ANTIALIAS_ON);
g2d.translate(40, 300); g2d.translate(40, 300);
g2d.scale(20., 20.); g2d.scale(20., 20.);
g2d.setStroke(new BasicStroke((float) (1/20.))); g2d.setStroke(new BasicStroke((float) (1/10.)));
g2d.setColor(Color.RED); if (showOriginal)
g2d.draw(glyph.getOutline(0, 0, flags & ~FontDelegate.FLAG_FITTED)); {
g2d.setColor(Color.GREEN); g2d.setColor(Color.RED);
g2d.draw(glyph.getOutline(0, 0, flags | FontDelegate.FLAG_FITTED)); g2d.draw(glyph.getOutline(0, 0,
flags & ~FontDelegate.FLAG_FITTED));
}
if (showHinted)
{
g2d.setColor(Color.RED);
g2d.draw(glyph.getOutline(0, 0,
flags | FontDelegate.FLAG_FITTED));
}
} }
} }
...@@ -186,7 +211,7 @@ public class HintingDemo extends JFrame { ...@@ -186,7 +211,7 @@ public class HintingDemo extends JFrame {
HintingDemo() HintingDemo()
{ {
File file = new File("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif.ttf"); File file = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
loadFont(file); loadFont(file);
setLayout(new BorderLayout()); setLayout(new BorderLayout());
chooser = new Chooser(); chooser = new Chooser();
...@@ -244,6 +269,9 @@ public class HintingDemo extends JFrame { ...@@ -244,6 +269,9 @@ public class HintingDemo extends JFrame {
implements ActionListener implements ActionListener
{ {
JCheckBox antiAliasOpt; JCheckBox antiAliasOpt;
JCheckBox showGridOpt;
JCheckBox showOriginalOpt;
JCheckBox showHintedOpt;
JCheckBox hintHorizontalOpt; JCheckBox hintHorizontalOpt;
JCheckBox hintVerticalOpt; JCheckBox hintVerticalOpt;
JCheckBox hintEdgeOpt; JCheckBox hintEdgeOpt;
...@@ -257,6 +285,18 @@ public class HintingDemo extends JFrame { ...@@ -257,6 +285,18 @@ public class HintingDemo extends JFrame {
antiAliasOpt.setSelected(true); antiAliasOpt.setSelected(true);
antiAliasOpt.addActionListener(this); antiAliasOpt.addActionListener(this);
add(antiAliasOpt); add(antiAliasOpt);
showGridOpt = new JCheckBox("Show grid");
showGridOpt.setSelected(true);
showGridOpt.addActionListener(this);
add(showGridOpt);
showOriginalOpt = new JCheckBox("Show original");
showOriginalOpt.setSelected(true);
showOriginalOpt.addActionListener(this);
add(showOriginalOpt);
showHintedOpt = new JCheckBox("Show hinted");
showHintedOpt.setSelected(true);
showHintedOpt.addActionListener(this);
add(showHintedOpt);
hintHorizontalOpt = new JCheckBox("Hint horizontal"); hintHorizontalOpt = new JCheckBox("Hint horizontal");
hintHorizontalOpt.setSelected(true); hintHorizontalOpt.setSelected(true);
hintHorizontalOpt.addActionListener(this); hintHorizontalOpt.addActionListener(this);
...@@ -283,6 +323,9 @@ public class HintingDemo extends JFrame { ...@@ -283,6 +323,9 @@ public class HintingDemo extends JFrame {
void sync() void sync()
{ {
antiAlias = antiAliasOpt.isSelected(); antiAlias = antiAliasOpt.isSelected();
showGrid = showGridOpt.isSelected();
showOriginal = showOriginalOpt.isSelected();
showHinted = showHintedOpt.isSelected();
if (hintHorizontalOpt.isSelected()) if (hintHorizontalOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_HORIZONTAL; flags &= ~FontDelegate.FLAG_NO_HINT_HORIZONTAL;
else else
......
...@@ -107,6 +107,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -107,6 +107,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -145,8 +147,6 @@ EXEEXT = @EXEEXT@ ...@@ -145,8 +147,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -170,6 +170,15 @@ GJDOC = @GJDOC@ ...@@ -170,6 +170,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -242,8 +251,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -242,8 +251,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@ ...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@ ...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@ ...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@ ...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@ ...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@ ...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ ...@@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@ ...@@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@ FASTJAR = @FASTJAR@
FGREP = @FGREP@ FGREP = @FGREP@
FIND = @FIND@ FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@ ...@@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@ GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@ GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@ GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@ GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@ ...@@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@ USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
......
/* ArrayReferenceCommandSet.java -- class to implement the Array /* ArrayReferenceCommandSet.java -- class to implement the Array
Reference Command Set Reference Command Set
Copyright (C) 2005, 2007 Free Software Foundation Copyright (C) 2005 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
......
...@@ -115,8 +115,16 @@ public interface FontDelegate ...@@ -115,8 +115,16 @@ public interface FontDelegate
* Returns the number of glyphs in this font face. * Returns the number of glyphs in this font face.
*/ */
public int getNumGlyphs(); public int getNumGlyphs();
/**
* Returns the glyph code for the specified character.
*
* @param c the character to map
*
* @return the glyph code
*/
public int getGlyphIndex(int c);
/** /**
* Returns the index of the glyph which gets displayed if the font * Returns the index of the glyph which gets displayed if the font
* cannot map a Unicode code point to a glyph. Many fonts show this * cannot map a Unicode code point to a glyph. Many fonts show this
......
...@@ -617,7 +617,17 @@ public final class OpenTypeFont ...@@ -617,7 +617,17 @@ public final class OpenTypeFont
return new GNUGlyphVector(this, font, frc, glyphs); return new GNUGlyphVector(this, font, frc, glyphs);
} }
/**
* Returns the glyph code for the specified character.
*
* @param c the character to map
*
* @return the glyph code
*/
public int getGlyphIndex(int c)
{
return getCharGlyphMap().getGlyph(c);
}
/** /**
* Determines the advance width for a glyph. * Determines the advance width for a glyph.
......
/* Pixelizer.java -- Interface for the target of the rasterizer
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.java2d;
/**
* A pixelizer is responsible for actually manipulating the pixel of a drawing
* surface after the scanline conversion process. It receives coverage
* information for a scanline and adjusts the surface pixels accordingly.
*/
public interface Pixelizer
{
/**
* Renders the pixel for one scanline at the Y location <code>y</code>
* and using the coverage information in <code>sc</code>.
*
* @param y the scanline Y coordinate
* @param sc the coverage information
*/
void renderScanline(int y, ScanlineCoverage sc);
}
/* ScanlineConverter.java -- Rasterizes Shapes /* ScanlineConverter.java -- Rasterizes Shapes
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -40,6 +40,7 @@ package gnu.java.awt.java2d; ...@@ -40,6 +40,7 @@ package gnu.java.awt.java2d;
import gnu.java.math.Fixed; import gnu.java.math.Fixed;
import java.awt.RenderingHints;
import java.awt.Shape; import java.awt.Shape;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.geom.PathIterator; import java.awt.geom.PathIterator;
...@@ -47,7 +48,7 @@ import java.awt.geom.PathIterator; ...@@ -47,7 +48,7 @@ import java.awt.geom.PathIterator;
/** /**
* Rasterizes {@link Shape} objects on an AbstractGraphics2D. * Rasterizes {@link Shape} objects on an AbstractGraphics2D.
*/ */
final class ScanlineConverter public final class ScanlineConverter
{ {
/** /**
...@@ -56,11 +57,16 @@ final class ScanlineConverter ...@@ -56,11 +57,16 @@ final class ScanlineConverter
private static int FIXED_DIGITS = 6; private static int FIXED_DIGITS = 6;
/** /**
* The fixed value for the number 1. * The fixed point constant for the number one.
*/ */
private static int ONE = Fixed.fixedValue(FIXED_DIGITS, 1); private static int ONE = Fixed.fixedValue(FIXED_DIGITS, 1);
/** /**
* The number of significant bits for the Y resolution.
*/
private static int Y_RESOLUTION = 4;
/**
* The actual number of scanlines. * The actual number of scanlines.
*/ */
private int numScanlines; private int numScanlines;
...@@ -109,6 +115,13 @@ final class ScanlineConverter ...@@ -109,6 +115,13 @@ final class ScanlineConverter
private int minY; private int minY;
private int maxY; private int maxY;
private int minX;
private int maxX;
/**
* Holds and manages information about the pixel coverage.
*/
private ScanlineCoverage scanlineCoverage;
/** /**
* Create a new ScanlineConverter. * Create a new ScanlineConverter.
...@@ -120,18 +133,23 @@ final class ScanlineConverter ...@@ -120,18 +133,23 @@ final class ScanlineConverter
activeEdges = new ActiveEdges(); activeEdges = new ActiveEdges();
edgePool = new PolyEdge(); edgePool = new PolyEdge();
edgePoolLast = edgePool; edgePoolLast = edgePool;
scanlineCoverage = new ScanlineCoverage();
} }
/** /**
* Renders the specified shape using the specified clip and transform. * Renders the specified shape using the specified clip and transform.
* *
* @param p the pixelizer that receives the coverage information
* @param shape the shape to render * @param shape the shape to render
* @param clip the clip * @param clip the clip
* @param trans the transform * @param trans the transform
*/ */
void renderShape(AbstractGraphics2D g, Shape shape, Shape clip, public void renderShape(Pixelizer p, Shape shape, Shape clip,
AffineTransform trans, int res) AffineTransform trans, int res, RenderingHints hints)
{ {
// TODO: Do something useful with the rendering hints. Like, adjusting
// the resolution.
// Prepare resolution and upper bounds. // Prepare resolution and upper bounds.
clear(); clear();
setResolution(res); setResolution(res);
...@@ -139,11 +157,12 @@ final class ScanlineConverter ...@@ -139,11 +157,12 @@ final class ScanlineConverter
boolean haveClip = clip != null; boolean haveClip = clip != null;
// Add shapes. // Add shapes.
PathIterator path = shape.getPathIterator(trans, resolution); float flatness = Fixed.floatValue(FIXED_DIGITS, resolution / 2);
PathIterator path = shape.getPathIterator(trans, flatness);
addShape(path, false); addShape(path, false);
if (haveClip) if (haveClip)
{ {
path= clip.getPathIterator(trans, resolution); path= clip.getPathIterator(trans, flatness);
addShape(path, true); addShape(path, true);
} }
...@@ -157,11 +176,11 @@ final class ScanlineConverter ...@@ -157,11 +176,11 @@ final class ScanlineConverter
} }
int y = upperBounds; int y = upperBounds;
int lastIndex = scanlineIndex(y - resolution);
int index; int index;
activeEdges.clear(); activeEdges.clear();
// The render loop... // The render loop...
Scanline scanline = null; Scanline scanline = null;
int lastRealY = Fixed.intValue(FIXED_DIGITS, y);
while (y <= maxY) while (y <= maxY)
{ {
// First we put together our list of active edges. // First we put together our list of active edges.
...@@ -184,15 +203,16 @@ final class ScanlineConverter ...@@ -184,15 +203,16 @@ final class ScanlineConverter
activeEdges.intersectSortAndPack(FIXED_DIGITS, y + halfStep); activeEdges.intersectSortAndPack(FIXED_DIGITS, y + halfStep);
// Ok, now we can perform the actual scanlining. // Ok, now we can perform the actual scanlining.
boolean push = lastIndex != index; int realY = Fixed.intValue(FIXED_DIGITS, y + resolution);
doScanline(g, y, push, haveClip); boolean push = lastRealY != realY;
doScanline(p, y, push, haveClip);
// Remove obsolete active edges. // Remove obsolete active edges.
//activeEdges.remove(y + halfStep); //activeEdges.remove(y + halfStep);
// Go on with the next line... // Go on with the next line...
y += resolution; y += resolution;
lastIndex = index; lastRealY = realY;
} }
} }
...@@ -212,17 +232,31 @@ final class ScanlineConverter ...@@ -212,17 +232,31 @@ final class ScanlineConverter
sl.clear(); sl.clear();
} }
// Reset scanline coverage.
scanlineCoverage.clear();
// Reset bounds. // Reset bounds.
minY = Integer.MAX_VALUE; minY = Integer.MAX_VALUE;
maxY = Integer.MIN_VALUE; maxY = Integer.MIN_VALUE;
minX = Integer.MAX_VALUE;
maxX = Integer.MIN_VALUE;
} }
/** /**
* Performs the scanlining on the current set of active edges. * Performs the scanlining on the current set of active edges.
*
* @param p the pixelizer to receive the pixel coverage data
* @param y the Y coordinate
* @param push true when the scanline is ready to be pushed to the
* pixelizer
* @param haveClip true when there's a clip, false otherwise
*/ */
private void doScanline(AbstractGraphics2D g, int y, boolean push, private void doScanline(Pixelizer p, int y, boolean push,
boolean haveClip) boolean haveClip)
{ {
// First, rewind the scanline coverage.
scanlineCoverage.rewind();
// We begin outside the clip and outside the shape. We only draw when // We begin outside the clip and outside the shape. We only draw when
// we are inside the clip AND inside the shape. // we are inside the clip AND inside the shape.
boolean inClip = ! haveClip; boolean inClip = ! haveClip;
...@@ -238,22 +272,16 @@ final class ScanlineConverter ...@@ -238,22 +272,16 @@ final class ScanlineConverter
int x0 = lastEdge.xIntersection; int x0 = lastEdge.xIntersection;
int x1 = edge.xIntersection; int x1 = edge.xIntersection;
assert x0 <= x1; assert x0 <= x1;
if (push)
{ int pix0 = Fixed.intValue(FIXED_DIGITS, x0);
if (resolution == ONE) int pix1 = Fixed.intValue(FIXED_DIGITS, x1);
{ int frac0 = ONE - Fixed.trunc(FIXED_DIGITS, x0);
// Non-AA rendering. int frac1 = ONE - Fixed.trunc(FIXED_DIGITS, x1);
g.fillScanline(Fixed.intValue(FIXED_DIGITS, x0), // Only keep the first 4 digits after the point.
Fixed.intValue(FIXED_DIGITS, x1 - resolution), frac0 = frac0 >> (FIXED_DIGITS - Y_RESOLUTION);
Fixed.intValue(FIXED_DIGITS, y)); frac1 = frac1 >> (FIXED_DIGITS - Y_RESOLUTION);
} scanlineCoverage.add(pix0, 1 * (1 << Y_RESOLUTION), frac0);
else scanlineCoverage.add(pix1, -1 * (1 << Y_RESOLUTION), -frac1);
{
// AA rendering.
// FIXME: Implement.
System.err.println("Implement AA rendering.");
}
}
} }
if (edge.isClip) if (edge.isClip)
inClip = ! inClip; inClip = ! inClip;
...@@ -262,7 +290,15 @@ final class ScanlineConverter ...@@ -262,7 +290,15 @@ final class ScanlineConverter
lastEdge = edge; lastEdge = edge;
} }
}
// Push out the whole scanline to the pixelizer.
if (push && ! scanlineCoverage.isEmpty())
{
p.renderScanline(Fixed.intValue(FIXED_DIGITS, y), scanlineCoverage);
scanlineCoverage.clear();
}
}
/** /**
* Sets the resolution. A value of 0 rasterizes the shape normally without * Sets the resolution. A value of 0 rasterizes the shape normally without
...@@ -272,9 +308,12 @@ final class ScanlineConverter ...@@ -272,9 +308,12 @@ final class ScanlineConverter
*/ */
private void setResolution(int res) private void setResolution(int res)
{ {
int scanlinesPerPixel = 1 << res;
int one = Fixed.fixedValue(FIXED_DIGITS, 1); int one = Fixed.fixedValue(FIXED_DIGITS, 1);
resolution = one / (1 << res); resolution = one / (scanlinesPerPixel);
halfStep = resolution / 2; halfStep = resolution / 2;
scanlineCoverage.setMaxCoverage(scanlinesPerPixel << Y_RESOLUTION);
} }
/** /**
...@@ -309,6 +348,8 @@ final class ScanlineConverter ...@@ -309,6 +348,8 @@ final class ScanlineConverter
startY = lastY = Fixed.fixedValue(FIXED_DIGITS, coords[1]); startY = lastY = Fixed.fixedValue(FIXED_DIGITS, coords[1]);
minY = Math.min(startY, minY); minY = Math.min(startY, minY);
maxY = Math.max(startY, maxY); maxY = Math.max(startY, maxY);
minX = Math.min(startX, minX);
maxX = Math.max(startX, maxX);
break; break;
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
int x = Fixed.fixedValue(FIXED_DIGITS, coords[0]); int x = Fixed.fixedValue(FIXED_DIGITS, coords[0]);
...@@ -318,6 +359,8 @@ final class ScanlineConverter ...@@ -318,6 +359,8 @@ final class ScanlineConverter
lastY = y; lastY = y;
minY = Math.min(lastY, minY); minY = Math.min(lastY, minY);
maxY = Math.max(lastY, maxY); maxY = Math.max(lastY, maxY);
minX = Math.min(lastX, minX);
maxX = Math.max(lastX, maxX);
break; break;
case PathIterator.SEG_CLOSE: case PathIterator.SEG_CLOSE:
edgePoolAdd(lastX, lastY, startX, startY, clip); edgePoolAdd(lastX, lastY, startX, startY, clip);
...@@ -371,7 +414,7 @@ final class ScanlineConverter ...@@ -371,7 +414,7 @@ final class ScanlineConverter
{ {
int val1 = Fixed.div(FIXED_DIGITS, y, resolution); int val1 = Fixed.div(FIXED_DIGITS, y, resolution);
int rounded = Fixed.round(FIXED_DIGITS, val1); int rounded = Fixed.round(FIXED_DIGITS, val1);
return Fixed.div(FIXED_DIGITS, rounded, resolution); return Fixed.mul(FIXED_DIGITS, rounded, resolution);
} }
/** /**
......
...@@ -42,6 +42,7 @@ import java.awt.Polygon; ...@@ -42,6 +42,7 @@ import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Arc2D; import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D; import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D; import java.awt.geom.Line2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
...@@ -82,4 +83,8 @@ public class ShapeCache ...@@ -82,4 +83,8 @@ public class ShapeCache
*/ */
public Polygon polygon; public Polygon polygon;
/**
* A cached polyline.
*/
public GeneralPath polyline;
} }
...@@ -644,7 +644,7 @@ public abstract class ClasspathFontPeer ...@@ -644,7 +644,7 @@ public abstract class ClasspathFontPeer
* be ignored. * be ignored.
*/ */
public abstract boolean canDisplay (Font font, char c); public abstract boolean canDisplay (Font font, int c);
/** /**
* Implementation of {@link Font#canDisplay(String)}, * Implementation of {@link Font#canDisplay(String)},
......
...@@ -449,4 +449,13 @@ public class GLightweightPeer ...@@ -449,4 +449,13 @@ public class GLightweightPeer
{ {
// Nothing to do here for lightweights. // Nothing to do here for lightweights.
} }
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
// Always grant focus request.
return true;
}
} }
...@@ -1726,7 +1726,8 @@ public abstract class CairoGraphics2D extends Graphics2D ...@@ -1726,7 +1726,8 @@ public abstract class CairoGraphics2D extends Graphics2D
.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)); .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
ignoreAA = true; ignoreAA = true;
if (gv instanceof FreetypeGlyphVector && alpha == 1.0) if (gv instanceof FreetypeGlyphVector && alpha == 1.0
&& !((FreetypeGlyphVector)gv).hasTransforms())
{ {
int n = gv.getNumGlyphs (); int n = gv.getNumGlyphs ();
int[] codes = gv.getGlyphCodes (0, n, null); int[] codes = gv.getGlyphCodes (0, n, null);
...@@ -2164,4 +2165,4 @@ public abstract class CairoGraphics2D extends Graphics2D ...@@ -2164,4 +2165,4 @@ public abstract class CairoGraphics2D extends Graphics2D
return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY)); return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY));
} }
} }
\ No newline at end of file
...@@ -938,4 +938,4 @@ public class ComponentGraphics extends CairoGraphics2D ...@@ -938,4 +938,4 @@ public class ComponentGraphics extends CairoGraphics2D
unlock(); unlock();
} }
} }
} }
\ No newline at end of file
...@@ -43,6 +43,8 @@ import java.awt.font.FontRenderContext; ...@@ -43,6 +43,8 @@ import java.awt.font.FontRenderContext;
import java.awt.font.GlyphJustificationInfo; import java.awt.font.GlyphJustificationInfo;
import java.awt.font.GlyphMetrics; import java.awt.font.GlyphMetrics;
import java.awt.font.GlyphVector; import java.awt.font.GlyphVector;
import java.awt.font.TextAttribute;
import java.awt.font.TransformAttribute;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
...@@ -86,7 +88,10 @@ public class FreetypeGlyphVector extends GlyphVector ...@@ -86,7 +88,10 @@ public class FreetypeGlyphVector extends GlyphVector
private long[] fontSet = null; private long[] fontSet = null;
/** /**
* Glyph transforms. (de facto only the translation is used) * Glyph transforms. Supports all transform operations.
*
* The identity transform should not be stored in this array; use a null
* instead (will result in performance improvements).
*/ */
private AffineTransform[] glyphTransforms; private AffineTransform[] glyphTransforms;
...@@ -185,9 +190,12 @@ public class FreetypeGlyphVector extends GlyphVector ...@@ -185,9 +190,12 @@ public class FreetypeGlyphVector extends GlyphVector
fontSet = new long[nGlyphs]; fontSet = new long[nGlyphs];
glyphPositions = new float[(nGlyphs + 1) * 2]; glyphPositions = new float[(nGlyphs + 1) * 2];
glyphTransforms = new AffineTransform[ nGlyphs ]; glyphTransforms = new AffineTransform[ nGlyphs ];
Arrays.fill(glyphTransforms, null);
for(int i = 0; i < nGlyphs; i++ ) for(int i = 0; i < nGlyphs; i++ )
{ {
glyphTransforms[ i ] = new AffineTransform( gv.glyphTransforms[ i ] ); if (gv.glyphTransforms[i] != null)
glyphTransforms[ i ] = new AffineTransform(gv.glyphTransforms[i]);
glyphCodes[i] = gv.glyphCodes[ i ]; glyphCodes[i] = gv.glyphCodes[ i ];
} }
System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0, System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0,
...@@ -313,6 +321,25 @@ public class FreetypeGlyphVector extends GlyphVector ...@@ -313,6 +321,25 @@ public class FreetypeGlyphVector extends GlyphVector
} }
glyphPositions[nGlyphs * 2] = x; glyphPositions[nGlyphs * 2] = x;
glyphPositions[nGlyphs * 2 + 1] = y; glyphPositions[nGlyphs * 2 + 1] = y;
// Apply any transform that may be in the font's attributes
TransformAttribute ta;
ta = (TransformAttribute)font.getAttributes().get(TextAttribute.TRANSFORM);
if (ta != null)
{
AffineTransform tx = ta.getTransform();
// Transform glyph positions
tx.transform(glyphPositions, 0, glyphPositions, 0,
glyphPositions.length / 2);
// Also store per-glyph scale/shear/rotate (but not translation)
double[] matrix = new double[4];
tx.getMatrix(matrix);
AffineTransform deltaTx = new AffineTransform(matrix);
if (!deltaTx.isIdentity())
Arrays.fill(glyphTransforms, deltaTx);
}
} }
/** /**
...@@ -375,7 +402,7 @@ public class FreetypeGlyphVector extends GlyphVector ...@@ -375,7 +402,7 @@ public class FreetypeGlyphVector extends GlyphVector
p.getY() + r.getY() + r.getHeight()}; p.getY() + r.getY() + r.getHeight()};
if (glyphTransforms[glyphIndex] != null) if (glyphTransforms[glyphIndex] != null)
glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 4); glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 2);
return new Rectangle2D.Double(bounds[0], bounds[1], bounds[2] - bounds[0], return new Rectangle2D.Double(bounds[0], bounds[1], bounds[2] - bounds[0],
bounds[3] - bounds[1]); bounds[3] - bounds[1]);
...@@ -473,7 +500,19 @@ public class FreetypeGlyphVector extends GlyphVector ...@@ -473,7 +500,19 @@ public class FreetypeGlyphVector extends GlyphVector
{ {
return glyphTransforms[glyphIndex]; return glyphTransforms[glyphIndex];
} }
/**
* Checks whether any transform has been set on any glyphs.
*/
protected boolean hasTransforms()
{
for (int i = 0; i < glyphTransforms.length; i++)
if (glyphTransforms[i] != null)
return true;
return false;
}
/** /**
* Returns the visual bounds of a glyph * Returns the visual bounds of a glyph
* May be off by a pixel or two due to hinting/rasterization. * May be off by a pixel or two due to hinting/rasterization.
...@@ -570,6 +609,19 @@ public class FreetypeGlyphVector extends GlyphVector ...@@ -570,6 +609,19 @@ public class FreetypeGlyphVector extends GlyphVector
*/ */
public void setGlyphTransform(int glyphIndex, AffineTransform newTX) public void setGlyphTransform(int glyphIndex, AffineTransform newTX)
{ {
// The identity transform should never be in the glyphTransforms array;
// using and checking for nulls can be much faster.
if (newTX != null && newTX.isIdentity())
newTX = null;
// If the old and new transforms are identical, bail
if (glyphTransforms[glyphIndex] == null && newTX == null)
return;
if (newTX != null && newTX.equals(glyphTransforms[glyphIndex]))
return;
// Invalidate bounds cache and set new transform
logicalBounds = null; logicalBounds = null;
glyphTransforms[glyphIndex] = newTX; glyphTransforms[glyphIndex] = newTX;
} }
......
...@@ -38,6 +38,8 @@ exception statement from your version. */ ...@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk; package gnu.java.awt.peer.gtk;
import gnu.classpath.Pointer;
import gnu.java.awt.ClasspathToolkit; import gnu.java.awt.ClasspathToolkit;
import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.font.opentype.NameDecoder; import gnu.java.awt.font.opentype.NameDecoder;
...@@ -172,6 +174,14 @@ public class GdkFontPeer extends ClasspathFontPeer ...@@ -172,6 +174,14 @@ public class GdkFontPeer extends ClasspathFontPeer
private ByteBuffer nameTable = null; private ByteBuffer nameTable = null;
/**
* The pointer to the native font data.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer nativeFont;
private native void initState (); private native void initState ();
private native void dispose (); private native void dispose ();
private native void setFont (String family, int style, int size); private native void setFont (String family, int style, int size);
...@@ -351,7 +361,7 @@ public class GdkFontPeer extends ClasspathFontPeer ...@@ -351,7 +361,7 @@ public class GdkFontPeer extends ClasspathFontPeer
return NameDecoder.getName(nameTable, name, locale); return NameDecoder.getName(nameTable, name, locale);
} }
public boolean canDisplay (Font font, char c) public boolean canDisplay (Font font, int c)
{ {
// FIXME: inquire with pango // FIXME: inquire with pango
return true; return true;
......
...@@ -52,6 +52,8 @@ import java.awt.image.SampleModel; ...@@ -52,6 +52,8 @@ import java.awt.image.SampleModel;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.util.Locale; import java.util.Locale;
import gnu.classpath.Pointer;
public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
{ {
private final int native_state = GtkGenericPeer.getUniqueInteger (); private final int native_state = GtkGenericPeer.getUniqueInteger ();
...@@ -59,15 +61,24 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment ...@@ -59,15 +61,24 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
private GdkScreenGraphicsDevice defaultDevice; private GdkScreenGraphicsDevice defaultDevice;
private GdkScreenGraphicsDevice[] devices; private GdkScreenGraphicsDevice[] devices;
/**
* The pointer to the native display resource.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer display;
static static
{ {
System.loadLibrary("gtkpeer"); System.loadLibrary("gtkpeer");
initStaticState (); GtkToolkit.initializeGlobalIDs();
initIDs();
} }
static native void initStaticState(); private static native void initIDs();
public GdkGraphicsEnvironment () public GdkGraphicsEnvironment ()
{ {
......
...@@ -68,6 +68,8 @@ import javax.imageio.spi.ImageWriterSpi; ...@@ -68,6 +68,8 @@ import javax.imageio.spi.ImageWriterSpi;
import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream; import javax.imageio.stream.ImageOutputStream;
import gnu.classpath.Pointer;
public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{ {
static static
...@@ -94,6 +96,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder ...@@ -94,6 +96,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
// the current set of ImageConsumers for this decoder // the current set of ImageConsumers for this decoder
Vector curr; Vector curr;
/**
* The pointer to the native pixbuf loader.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer nativeDecoder;
// interface to GdkPixbuf // interface to GdkPixbuf
// These native functions should be called with the pixbufLock held. // These native functions should be called with the pixbufLock held.
native void initState (); native void initState ();
......
...@@ -91,4 +91,9 @@ public class GdkRobotPeer implements RobotPeer ...@@ -91,4 +91,9 @@ public class GdkRobotPeer implements RobotPeer
return pixels; return pixels;
} }
public void dispose()
{
// Nothing to do here yet.
}
} }
...@@ -46,6 +46,8 @@ import java.awt.Rectangle; ...@@ -46,6 +46,8 @@ import java.awt.Rectangle;
import java.awt.Window; import java.awt.Window;
import java.util.ArrayList; import java.util.ArrayList;
import gnu.classpath.Pointer;
class GdkScreenGraphicsDevice extends GraphicsDevice class GdkScreenGraphicsDevice extends GraphicsDevice
{ {
private final int native_state = GtkGenericPeer.getUniqueInteger (); private final int native_state = GtkGenericPeer.getUniqueInteger ();
...@@ -85,15 +87,23 @@ class GdkScreenGraphicsDevice extends GraphicsDevice ...@@ -85,15 +87,23 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
* method must be called. * method must be called.
*/ */
DisplayMode fixedDisplayMode; DisplayMode fixedDisplayMode;
/**
* The pointer to the native screen resource.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer screen;
static static
{ {
System.loadLibrary("gtkpeer"); System.loadLibrary("gtkpeer");
GtkToolkit.initializeGlobalIDs();
initStaticState (); initIDs();
} }
static native void initStaticState(); static native void initIDs();
GdkScreenGraphicsDevice (GdkGraphicsEnvironment e) GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
{ {
......
...@@ -616,11 +616,18 @@ public class GtkComponentPeer extends GtkGenericPeer ...@@ -616,11 +616,18 @@ public class GtkComponentPeer extends GtkGenericPeer
setVisible (true); setVisible (true);
} }
protected void postMouseEvent(int id, long when, int mods, int x, int y, protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger) int clickCount, boolean popupTrigger)
{ {
q().postEvent(new MouseEvent(awtComponent, id, when, mods, x, y, // It is important to do the getLocationOnScreen() here, instead
clickCount, popupTrigger)); // of using the old MouseEvent constructors, because
// Component.getLocationOnScreen() locks on the AWT lock, which can
// trigger a deadlock. You don't want this.
Point locOnScreen = getLocationOnScreen();
q().postEvent(new MouseEvent(awtComponent, id, when, mods, x, y,
locOnScreen.x + x, locOnScreen.y + y,
clickCount, popupTrigger,
MouseEvent.NOBUTTON));
} }
/** /**
...@@ -899,4 +906,14 @@ public class GtkComponentPeer extends GtkGenericPeer ...@@ -899,4 +906,14 @@ public class GtkComponentPeer extends GtkGenericPeer
// FIXME: implement // FIXME: implement
} }
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
// TODO: Implement this properly and remove the other requestFocus()
// methods.
return true;
}
} }
...@@ -244,6 +244,13 @@ public class GtkFramePeer extends GtkWindowPeer ...@@ -244,6 +244,13 @@ public class GtkFramePeer extends GtkWindowPeer
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
public Rectangle getBoundsPrivate()
{
// TODO: Implement this properly.
throw new InternalError("Not yet implemented");
}
} }
...@@ -43,6 +43,8 @@ import java.awt.Font; ...@@ -43,6 +43,8 @@ import java.awt.Font;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import gnu.classpath.Pointer;
public class GtkGenericPeer public class GtkGenericPeer
{ {
// Used by Native State Association (NSA) functions to map // Used by Native State Association (NSA) functions to map
...@@ -56,6 +58,40 @@ public class GtkGenericPeer ...@@ -56,6 +58,40 @@ public class GtkGenericPeer
protected final Object awtWidget; protected final Object awtWidget;
/** /**
* The pointer to the native GTK widget.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer widget;
/**
* The pointer to the global reference to this object. The native
* code creates a JNI global reference of the peer object to be able
* to pass it to the event callbacks. It gets stored here, so that
* we can later delete it in the dispose() method.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer globalRef;
/**
* We initialize the field IDs that are used by native code here because
* these remain valid until a class gets unloaded.
*/
static
{
GtkToolkit.initializeGlobalIDs();
initIDs();
}
/**
* Initializes the field IDs that are used by the native code.
*/
private static native void initIDs();
/**
* Dispose of our native state. Calls gtk_widget_destroy on the * Dispose of our native state. Calls gtk_widget_destroy on the
* native widget and removes the awtWidget from the native state * native widget and removes the awtWidget from the native state
* tables. Should be overridden by subclasses if this is not (all) * tables. Should be overridden by subclasses if this is not (all)
......
...@@ -144,10 +144,39 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -144,10 +144,39 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
static native void gtkQuit(); static native void gtkQuit();
/**
* Initializes field IDs that are used by native code.
*/
private static native void initIDs();
/**
* True when the field IDs are already initialized, false otherwise.
*/
private static boolean initializedGlobalIDs = false;
/**
* Initializes some global fieldIDs for use in the native code. This is
* called by a couple of classes in the GTK peers to ensure that
* some necessary stuff is loaded.
*/
static synchronized void initializeGlobalIDs()
{
if (! initializedGlobalIDs)
{
initIDs();
initializedGlobalIDs = true;
}
}
static static
{ {
System.loadLibrary("gtkpeer"); System.loadLibrary("gtkpeer");
/**
* Gotta do that first.
*/
initializeGlobalIDs();
int portableNativeSync; int portableNativeSync;
String portNatSyncProp = String portNatSyncProp =
System.getProperty("gnu.classpath.awt.gtk.portable.native.sync"); System.getProperty("gnu.classpath.awt.gtk.portable.native.sync");
...@@ -716,4 +745,17 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -716,4 +745,17 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public native int getMouseNumberOfButtons(); public native int getMouseNumberOfButtons();
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
} // class GtkToolkit } // class GtkToolkit
...@@ -398,4 +398,29 @@ public class GtkWindowPeer extends GtkContainerPeer ...@@ -398,4 +398,29 @@ public class GtkWindowPeer extends GtkContainerPeer
{ {
return new Rectangle(x, y, width, height); return new Rectangle(x, y, width, height);
} }
public void updateIconImages()
{
// TODO: Implement properly.
}
public void updateMinimumSize()
{
// TODO: Implement properly.
}
public void setModalBlocked(java.awt.Dialog d, boolean b)
{
// TODO: Implement properly.
}
public void updateFocusableWindowState()
{
// TODO: Implement properly.
}
public void setAlwaysOnTop(boolean b)
{
// TODO: Implement properly.
}
} }
...@@ -86,7 +86,17 @@ public class VolatileImageGraphics extends ComponentGraphics ...@@ -86,7 +86,17 @@ public class VolatileImageGraphics extends ComponentGraphics
public GraphicsConfiguration getDeviceConfiguration() public GraphicsConfiguration getDeviceConfiguration()
{ {
return owner.component.getGraphicsConfiguration(); GraphicsConfiguration conf;
if (owner.component != null)
{
conf = owner.component.getGraphicsConfiguration();
}
else
{
return java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration();
}
return conf;
} }
public Graphics create() public Graphics create()
......
...@@ -368,4 +368,18 @@ public class HeadlessToolkit ...@@ -368,4 +368,18 @@ public class HeadlessToolkit
return graphicsEnv; return graphicsEnv;
} }
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
} }
...@@ -821,4 +821,14 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer ...@@ -821,4 +821,14 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer
{ {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
// TODO: Implement this properly and remove the other requestFocus()
// methods.
return true;
}
} }
...@@ -94,7 +94,7 @@ public class QtFontMetrics extends FontMetrics ...@@ -94,7 +94,7 @@ public class QtFontMetrics extends FontMetrics
// ****************** Package private *************************** // ****************** Package private ***************************
native boolean canDisplay( char c ); native boolean canDisplay( int c );
// ****************** Public methods **************************** // ****************** Public methods ****************************
......
...@@ -98,7 +98,7 @@ public class QtFontPeer extends ClasspathFontPeer ...@@ -98,7 +98,7 @@ public class QtFontPeer extends ClasspathFontPeer
// ****************** ClasspathFontPeer Methods. // ****************** ClasspathFontPeer Methods.
public boolean canDisplay (Font font, char c) public boolean canDisplay (Font font, int c)
{ {
return metrics.canDisplay( c ); return metrics.canDisplay( c );
} }
......
...@@ -155,4 +155,10 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer ...@@ -155,4 +155,10 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer
return false; return false;
} }
public Rectangle getBoundsPrivate()
{
// TODO: Implement this properly.
throw new InternalError("Not yet implemented");
}
} }
...@@ -452,4 +452,19 @@ public class QtToolkit extends ClasspathToolkit ...@@ -452,4 +452,19 @@ public class QtToolkit extends ClasspathToolkit
// return new QtEmbeddedWindowPeer( this, w ); // return new QtEmbeddedWindowPeer( this, w );
return null; return null;
} }
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
} }
...@@ -77,4 +77,29 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer ...@@ -77,4 +77,29 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer
return false; return false;
} }
public void updateIconImages()
{
// TODO: Implement properly.
}
public void updateMinimumSize()
{
// TODO: Implement properly.
}
public void setModalBlocked(java.awt.Dialog d, boolean b)
{
// TODO: Implement properly.
}
public void updateFocusableWindowState()
{
// TODO: Implement properly.
}
public void setAlwaysOnTop(boolean b)
{
// TODO: Implement properly.
}
} }
/* SwingButtonPeer.java -- A Swing based peer for AWT buttons /* SwingButtonPeer.java -- A Swing based peer for AWT buttons
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -44,6 +44,7 @@ import java.awt.Image; ...@@ -44,6 +44,7 @@ import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.peer.ButtonPeer; import java.awt.peer.ButtonPeer;
...@@ -70,12 +71,12 @@ public class SwingButtonPeer ...@@ -70,12 +71,12 @@ public class SwingButtonPeer
extends JButton extends JButton
implements SwingComponent implements SwingComponent
{ {
Button button; Button button;
SwingButton(Button button) SwingButton(Button button)
{ {
this.button = button; this.button = button;
} }
/** /**
* Overridden so that this method returns the correct value even without a * Overridden so that this method returns the correct value even without a
...@@ -184,6 +185,26 @@ public class SwingButtonPeer ...@@ -184,6 +185,26 @@ public class SwingButtonPeer
par = button.getParent(); par = button.getParent();
return par; return par;
} }
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
public void requestFocus() {
SwingButtonPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingButtonPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
} }
/** /**
......
/* SwingCheckboxPeer.java -- A Swing based peer for AWT checkboxes
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.swing;
import java.awt.Button;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Label;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.CheckboxPeer;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
/**
* A CheckboxPeer implementation that is backed by the Swing JCheckBox.
*/
public class SwingCheckboxPeer extends SwingComponentPeer implements
CheckboxPeer {
/**
* A spezialized Swing checkbox used to paint the checkbox for the
* AWT checkbox.
*/
private class SwingCheckbox
extends JCheckBox
implements SwingComponent
{
Checkbox checkbox;
SwingCheckbox(Checkbox checkbox)
{
this.checkbox = checkbox;
}
/**
* Returns this checkbox.
*
* @return <code>this</code>
*/
public JComponent getJComponent()
{
return this;
}
/**
* Handles mouse events by forwarding it to
* <code>processMouseEvent()</code>.
*
* @param ev the mouse event
*/
public void handleMouseEvent(MouseEvent ev)
{
ev.setSource(this);
processMouseEvent(ev);
}
/**
* Handles mouse motion events by forwarding it to
* <code>processMouseMotionEvent()</code>.
*
* @param ev the mouse motion event
*/
public void handleMouseMotionEvent(MouseEvent ev)
{
ev.setSource(this);
processMouseMotionEvent(ev);
}
/**
* Handles key events by forwarding it to <code>processKeyEvent()</code>.
*
* @param ev the mouse event
*/
public void handleKeyEvent(KeyEvent ev)
{
ev.setSource(this);
processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
/**
* Overridden so that this method returns the correct value even without a
* peer.
*
* @return the screen location of the button
*/
public Point getLocationOnScreen()
{
return SwingCheckboxPeer.this.getLocationOnScreen();
}
/**
* Overridden so that the isShowing method returns the correct value
* for the swing button, even if it has no peer on its own.
*
* @return <code>true</code> if the button is currently showing,
* <code>false</code> otherwise
*/
public boolean isShowing()
{
boolean retVal = false;
if (checkbox != null)
retVal = checkbox.isShowing();
return retVal;
}
/**
* Overridden, so that the Swing button can create an Image without its
* own peer.
*
* @param w the width of the image
* @param h the height of the image
*
* @return an image
*/
public Image createImage(int w, int h)
{
return SwingCheckboxPeer.this.createImage(w, h);
}
public Graphics getGraphics()
{
return SwingCheckboxPeer.this.getGraphics();
}
public Container getParent()
{
Container par = null;
if (checkbox != null)
par = checkbox.getParent();
return par;
}
public void requestFocus() {
SwingCheckboxPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingCheckboxPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
/**
* Listens for ActionEvents on the Swing button and triggers corresponding
* ActionEvents on the AWT button.
*/
class SwingCheckboxListener implements ItemListener
{
Checkbox awtCheckbox;
SwingCheckboxListener(Checkbox checkbox)
{
awtCheckbox = checkbox;
}
/**
* Receives notification when an action was performend on the button.
*
* @param event the action event
*/
public void itemStateChanged(ItemEvent event)
{
awtCheckbox.setState(event.getStateChange()==ItemEvent.SELECTED);
ItemListener[] l = awtCheckbox.getItemListeners();
if (l.length == 0)
return;
ItemEvent ev = new ItemEvent(awtCheckbox, ItemEvent.ITEM_STATE_CHANGED,
awtCheckbox, event.getStateChange());
for (int i = 0; i < l.length; ++i)
l[i].itemStateChanged(ev);
}
}
/**
* Creates a new SwingCheckboxPeer instance.
*/
public SwingCheckboxPeer(Checkbox checkbox)
{
SwingCheckbox swingCheckbox = new SwingCheckbox(checkbox);
swingCheckbox.addItemListener(new SwingCheckboxListener(checkbox));
init(checkbox, swingCheckbox);
setLabel(checkbox.getLabel());
setState(checkbox.getState());
}
public void setCheckboxGroup(CheckboxGroup group)
{
// TODO: Implement this.
}
public void setLabel(String label)
{
((JToggleButton) swingComponent).setText(label);
}
public void setState(boolean state)
{
((JToggleButton) swingComponent).setSelected(state);
}
}
...@@ -37,6 +37,7 @@ exception statement from your version. */ ...@@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.awt.peer.swing; package gnu.java.awt.peer.swing;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
...@@ -86,4 +87,13 @@ public interface SwingComponent ...@@ -86,4 +87,13 @@ public interface SwingComponent
* @param ev the key event * @param ev the key event
*/ */
void handleKeyEvent(KeyEvent ev); void handleKeyEvent(KeyEvent ev);
/**
* Handles a focus event. This is usually forwarded to
* {@link Component#processFocusEvent(FocusEvent)} of the swing
* component.
*
* @param ev the focus event
*/
void handleFocusEvent(FocusEvent ev);
} }
/* SwingComponentPeer.java -- An abstract base class for Swing based peers /* SwingComponentPeer.java -- An abstract base class for Swing based peers
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -45,6 +45,7 @@ import java.awt.Component; ...@@ -45,6 +45,7 @@ import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
...@@ -54,6 +55,7 @@ import java.awt.Point; ...@@ -54,6 +55,7 @@ import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.BufferCapabilities.FlipContents; import java.awt.BufferCapabilities.FlipContents;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.PaintEvent; import java.awt.event.PaintEvent;
...@@ -349,12 +351,7 @@ public class SwingComponentPeer ...@@ -349,12 +351,7 @@ public class SwingComponentPeer
*/ */
public Dimension getMinimumSize() public Dimension getMinimumSize()
{ {
Dimension retVal; return minimumSize();
if (swingComponent != null)
retVal = swingComponent.getJComponent().getMinimumSize();
else
retVal = new Dimension(0, 0);
return retVal;
} }
/** /**
...@@ -367,12 +364,7 @@ public class SwingComponentPeer ...@@ -367,12 +364,7 @@ public class SwingComponentPeer
*/ */
public Dimension getPreferredSize() public Dimension getPreferredSize()
{ {
Dimension retVal; return preferredSize();
if (swingComponent != null)
retVal = swingComponent.getJComponent().getPreferredSize();
else
retVal = new Dimension(0, 0);
return retVal;
} }
/** /**
...@@ -395,30 +387,28 @@ public class SwingComponentPeer ...@@ -395,30 +387,28 @@ public class SwingComponentPeer
public void handleEvent(AWTEvent e) public void handleEvent(AWTEvent e)
{ {
switch (e.getID()) switch (e.getID())
{ {
case PaintEvent.UPDATE: case PaintEvent.UPDATE:
case PaintEvent.PAINT: case PaintEvent.PAINT:
// Need to synchronize to avoid threading problems on the if (awtComponent.isShowing())
// paint event list.
// We must synchronize on the tree lock first to avoid deadlock,
// because Container.paint() will grab it anyway.
synchronized (this)
{ {
assert paintArea != null; Rectangle clip ;
if (awtComponent.isShowing()) synchronized (this)
{ {
Graphics g = awtComponent.getGraphics(); coalescePaintEvent((PaintEvent) e);
try assert paintArea != null;
{ clip = paintArea;
Rectangle clip = paintArea; paintArea = null;
g.clipRect(clip.x, clip.y, clip.width, clip.height); }
peerPaint(g, e.getID() == PaintEvent.UPDATE); Graphics g = awtComponent.getGraphics();
} try
finally {
{ g.clipRect(clip.x, clip.y, clip.width, clip.height);
g.dispose(); peerPaint(g, e.getID() == PaintEvent.UPDATE);
paintArea = null; }
} finally
{
g.dispose();
} }
} }
break; break;
...@@ -438,10 +428,14 @@ public class SwingComponentPeer ...@@ -438,10 +428,14 @@ public class SwingComponentPeer
case KeyEvent.KEY_TYPED: case KeyEvent.KEY_TYPED:
handleKeyEvent((KeyEvent) e); handleKeyEvent((KeyEvent) e);
break; break;
case FocusEvent.FOCUS_GAINED:
case FocusEvent.FOCUS_LOST:
handleFocusEvent((FocusEvent)e);
break;
default: default:
// Other event types are not handled here. // Other event types are not handled here.
break; break;
} }
} }
/** /**
...@@ -574,13 +568,16 @@ public class SwingComponentPeer ...@@ -574,13 +568,16 @@ public class SwingComponentPeer
* This is implemented to call repaint() on the Swing component. * This is implemented to call repaint() on the Swing component.
* *
* @param tm number of milliseconds to wait with repainting * @param tm number of milliseconds to wait with repainting
* @param x the X coordinate of the upper left corner of the damaged rectangle * @param x the X coordinate of the upper left corner of the damaged
* @param y the Y coordinate of the upper left corner of the damaged rectangle * rectangle
* @param y the Y coordinate of the upper left corner of the damaged
* rectangle
* @param width the width of the damaged rectangle * @param width the width of the damaged rectangle
* @param height the height of the damaged rectangle * @param height the height of the damaged rectangle
*/ */
public void repaint(long tm, int x, int y, int width, int height) public void repaint(long tm, int x, int y, int width, int height)
{ {
// NOTE: This is never called by AWT but is mandated by the peer interface.
if (swingComponent != null) if (swingComponent != null)
swingComponent.getJComponent().repaint(tm, x, y, width, height); swingComponent.getJComponent().repaint(tm, x, y, width, height);
else else
...@@ -602,8 +599,10 @@ public class SwingComponentPeer ...@@ -602,8 +599,10 @@ public class SwingComponentPeer
*/ */
public void requestFocus() public void requestFocus()
{ {
if (swingComponent != null) // NOTE: This is never called by AWT but is mandated by the peer interface.
swingComponent.getJComponent().requestFocus(); Toolkit tk = Toolkit.getDefaultToolkit();
EventQueue q = tk.getSystemEventQueue();
q.postEvent(new FocusEvent(awtComponent, FocusEvent.FOCUS_GAINED, false));
} }
/** /**
...@@ -612,18 +611,22 @@ public class SwingComponentPeer ...@@ -612,18 +611,22 @@ public class SwingComponentPeer
* *
* This calls requestFocus() on the Swing component. * This calls requestFocus() on the Swing component.
* *
* @param source TODO * @param source the actual component that requests focus (may be a
* @param bool1 TODO * lightweight descendant of the heavyweight container)
* @param bool2 TODO * @param tmp true when the change is temporary
* @param x TODO * @param allowWindowFocus
* @param tm the timestamp of the focus change
* *
* @return TODO * @return true when the focus change is guaranteed to be granted, false
* otherwise
*/ */
public boolean requestFocus(Component source, boolean bool1, boolean bool2, long x) public boolean requestFocus(Component source, boolean tmp,
boolean allowWindowFocus, long tm)
{ {
if (swingComponent != null) Toolkit tk = Toolkit.getDefaultToolkit();
swingComponent.getJComponent().requestFocus(); EventQueue q = tk.getSystemEventQueue();
return swingComponent != null; q.postEvent(new FocusEvent(source, FocusEvent.FOCUS_GAINED, tmp));
return true;
} }
/** /**
...@@ -1101,6 +1104,19 @@ public class SwingComponentPeer ...@@ -1101,6 +1104,19 @@ public class SwingComponentPeer
} }
/** /**
* Handles focus events on the component. This is usually forwarded to the
* SwingComponent's processFocusEvent() method.
*
* @param e the key event
*/
protected void handleFocusEvent(FocusEvent e)
{
if (swingComponent != null)
swingComponent.handleFocusEvent(e);
}
/**
* Returns the AWT component for this peer. * Returns the AWT component for this peer.
* *
* @return the AWT component for this peer * @return the AWT component for this peer
...@@ -1109,4 +1125,12 @@ public class SwingComponentPeer ...@@ -1109,4 +1125,12 @@ public class SwingComponentPeer
{ {
return awtComponent; return awtComponent;
} }
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
return true;
}
} }
/* SwingContainerPeer.java -- A Swing based peer for AWT containers /* SwingContainerPeer.java -- A Swing based peer for AWT containers
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -92,7 +92,7 @@ public class SwingContainerPeer ...@@ -92,7 +92,7 @@ public class SwingContainerPeer
* @see #peerPaintChildren(Graphics) * @see #peerPaintChildren(Graphics)
* @see #removeHeavyweightDescendent(Component) * @see #removeHeavyweightDescendent(Component)
*/ */
synchronized void addHeavyweightDescendent(Component comp) protected synchronized void addHeavyweightDescendent(Component comp)
{ {
heavyweightDescendents.add(comp); heavyweightDescendents.add(comp);
focusOwner = null; focusOwner = null;
...@@ -106,13 +106,25 @@ public class SwingContainerPeer ...@@ -106,13 +106,25 @@ public class SwingContainerPeer
* @see #peerPaintChildren(Graphics) * @see #peerPaintChildren(Graphics)
* @see #addHeavyweightDescendent(Component) * @see #addHeavyweightDescendent(Component)
*/ */
synchronized void removeHeavyweightDescendent(Component comp) protected synchronized void removeHeavyweightDescendent(Component comp)
{ {
heavyweightDescendents.remove(comp); heavyweightDescendents.remove(comp);
focusOwner = null; focusOwner = null;
} }
/** /**
* Returns an array of all registered heavyweight descendents.
*
* @return all registered heavyweight descendents
*/
protected Component[] getHeavyweightDescendents()
{
Component[] heavyweights = new Component[heavyweightDescendents.size()];
heavyweights = (Component[]) heavyweightDescendents.toArray(heavyweights);
return heavyweights;
}
/**
* Returns the insets of the container. * Returns the insets of the container.
* *
* This is implemented to return the insets of the Swing container. * This is implemented to return the insets of the Swing container.
...@@ -339,7 +351,7 @@ public class SwingContainerPeer ...@@ -339,7 +351,7 @@ public class SwingContainerPeer
{ {
Component owner = getFocusOwner(); Component owner = getFocusOwner();
if(owner != null) if(owner != null)
owner.dispatchEvent(e); owner.getPeer().handleEvent(e);
else else
super.handleKeyEvent(e); super.handleKeyEvent(e);
} }
......
/* SwingLabelPeer.java -- A Swing based peer for AWT labels /* SwingLabelPeer.java -- A Swing based peer for AWT labels
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -42,6 +42,7 @@ import java.awt.Graphics; ...@@ -42,6 +42,7 @@ import java.awt.Graphics;
import java.awt.Image; import java.awt.Image;
import java.awt.Label; import java.awt.Label;
import java.awt.Point; import java.awt.Point;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.peer.LabelPeer; import java.awt.peer.LabelPeer;
...@@ -120,6 +121,17 @@ public class SwingLabelPeer ...@@ -120,6 +121,17 @@ public class SwingLabelPeer
} }
/** /**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
/**
* Overridden so that this method returns the correct value even without a * Overridden so that this method returns the correct value even without a
* peer. * peer.
* *
......
/* SwingListPeer.java -- A Swing based peer for AWT lists /* SwingListPeer.java -- A Swing based peer for AWT lists
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -46,6 +46,7 @@ import java.awt.Image; ...@@ -46,6 +46,7 @@ import java.awt.Image;
import java.awt.List; import java.awt.List;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.peer.ListPeer; import java.awt.peer.ListPeer;
...@@ -129,6 +130,17 @@ public class SwingListPeer ...@@ -129,6 +130,17 @@ public class SwingListPeer
} }
/** /**
* Handles focus events by forwarding it to <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
/**
* Overridden so that this method returns the correct value even without a * Overridden so that this method returns the correct value even without a
* peer. * peer.
* *
......
/* SwingPanelPeer.java -- A PanelPeer based on Swing /* SwingPanelPeer.java -- A PanelPeer based on Swing
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -47,7 +47,7 @@ import java.awt.peer.PanelPeer; ...@@ -47,7 +47,7 @@ import java.awt.peer.PanelPeer;
* @author Roman Kennke (kennke@aicas.com) * @author Roman Kennke (kennke@aicas.com)
*/ */
// TODO: Maybe base implementation on JPanel. However, this doesn't seem // TODO: Maybe base implementation on JPanel. However, this doesn't seem
// necessary, but might be good for more consistend Look. // necessary, but might be good for more consistent Look.
public class SwingPanelPeer public class SwingPanelPeer
extends SwingContainerPeer extends SwingContainerPeer
implements PanelPeer implements PanelPeer
......
/* SwingTextAreaPeer.java -- A Swing based peer for AWT textareas /* SwingTextAreaPeer.java -- A Swing based peer for AWT textareas
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -45,14 +45,20 @@ import java.awt.Image; ...@@ -45,14 +45,20 @@ import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.TextArea; import java.awt.TextArea;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.HierarchyEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.im.InputMethodRequests; import java.awt.im.InputMethodRequests;
import java.awt.peer.TextAreaPeer; import java.awt.peer.TextAreaPeer;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.JViewport;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
public class SwingTextAreaPeer public class SwingTextAreaPeer
...@@ -65,15 +71,19 @@ public class SwingTextAreaPeer ...@@ -65,15 +71,19 @@ public class SwingTextAreaPeer
* *
* @author Roman Kennke (kennke@aicas.com) * @author Roman Kennke (kennke@aicas.com)
*/ */
private class SwingTextArea private class SwingScrollPane
extends JScrollPane extends JScrollPane
implements SwingComponent implements SwingComponent
{ {
SwingTextArea(Component comp) SwingTextArea textArea;
SwingScrollPane(SwingTextArea textArea)
{ {
super(comp, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, super(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.textArea = textArea;
} }
/** /**
...@@ -94,8 +104,17 @@ public class SwingTextAreaPeer ...@@ -94,8 +104,17 @@ public class SwingTextAreaPeer
*/ */
public void handleMouseEvent(MouseEvent ev) public void handleMouseEvent(MouseEvent ev)
{ {
ev.setSource(this); JViewport viewPort = getViewport();
dispatchEvent(ev); if(viewPort.contains(ev.getPoint()))
{
ev.setSource(textArea);
textArea.dispatchEvent(ev);
}
else
{
ev.setSource(this);
this.dispatchEvent(ev);
}
} }
/** /**
...@@ -114,7 +133,7 @@ public class SwingTextAreaPeer ...@@ -114,7 +133,7 @@ public class SwingTextAreaPeer
*/ */
public void handleMouseMotionEvent(MouseEvent ev) public void handleMouseMotionEvent(MouseEvent ev)
{ {
processMouseMotionEvent(ev); textArea.processMouseMotionEvent(ev);
} }
/** /**
...@@ -124,7 +143,18 @@ public class SwingTextAreaPeer ...@@ -124,7 +143,18 @@ public class SwingTextAreaPeer
*/ */
public void handleKeyEvent(KeyEvent ev) public void handleKeyEvent(KeyEvent ev)
{ {
processKeyEvent(ev); textArea.processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
textArea.processFocusEvent(ev);
} }
/** /**
...@@ -179,35 +209,160 @@ public class SwingTextAreaPeer ...@@ -179,35 +209,160 @@ public class SwingTextAreaPeer
par = SwingTextAreaPeer.this.awtComponent.getParent(); par = SwingTextAreaPeer.this.awtComponent.getParent();
return par; return par;
} }
public void requestFocus() {
SwingTextAreaPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingTextAreaPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
} }
private class SwingTextArea extends JTextArea
{
/**
* Make this method accessible in this Package.
*/
protected final void processComponentKeyEvent(KeyEvent e)
{
super.processComponentKeyEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processMouseMotionEvent(MouseEvent ev)
{
super.processMouseMotionEvent(ev);
}
/**
* Make this method accessible in this Package.
*/
protected final void processComponentEvent(ComponentEvent e)
{
super.processComponentEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processFocusEvent(FocusEvent e)
{
super.processFocusEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processHierarchyBoundsEvent(HierarchyEvent e)
{
super.processHierarchyBoundsEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processHierarchyEvent(HierarchyEvent e)
{
super.processHierarchyEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processInputMethodEvent(InputMethodEvent e)
{
super.processInputMethodEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processMouseEvent(MouseEvent e)
{
super.processMouseEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processMouseWheelEvent(MouseWheelEvent e)
{
super.processMouseWheelEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processKeyEvent(KeyEvent e)
{
super.processKeyEvent(e);
}
public void requestFocus() {
SwingTextAreaPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingTextAreaPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
/** /**
* The actual JTextArea. * The actual JTextArea.
*/ */
private JTextArea jTextArea; private SwingTextArea jTextArea;
public SwingTextAreaPeer(TextArea textArea) public SwingTextAreaPeer(TextArea textArea)
{ {
super(); super();
System.err.println("new SwingTextAreaPeer"); jTextArea = new SwingTextArea();
jTextArea = new JTextArea(); SwingScrollPane swingArea = new SwingScrollPane(jTextArea);
SwingTextArea swingArea = new SwingTextArea(jTextArea);
init(textArea, swingArea); init(textArea, swingArea);
JViewport viewport = new JViewport()
{
public Image createImage(int width, int height)
{
return awtComponent.createImage(width, height);
}
};
viewport.setView(jTextArea);
swingArea.setViewport(viewport);
// Pull over the text from the text area. // Pull over the text from the text area.
setText(textArea.getText()); setText(textArea.getText());
// Pull over the number of rows and columns
// if non were set use default values
int columns = textArea.getColumns();
int rows = textArea.getRows();
if(columns == 0 && rows == 0)
{
columns = 25;
textArea.setColumns(columns);
rows = 5;
textArea.setRows(rows);
}
jTextArea.setColumns(columns);
jTextArea.setRows(rows);
} }
public Dimension getMinimumSize(int rows, int cols) public Dimension getMinimumSize(int rows, int cols)
{ {
// TODO Auto-generated method stub return jTextArea.getMinimumSize();
return null;
} }
public Dimension getPreferredSize(int rows, int cols) public Dimension getPreferredSize(int rows, int cols)
{ {
// TODO Auto-generated method stub return jTextArea.getPreferredSize();
return null;
} }
public void insert(String text, int pos) public void insert(String text, int pos)
...@@ -220,16 +375,24 @@ public class SwingTextAreaPeer ...@@ -220,16 +375,24 @@ public class SwingTextAreaPeer
jTextArea.insert(text, pos); jTextArea.insert(text, pos);
} }
public Dimension minimumSize()
{
return jTextArea.getMinimumSize();
}
public Dimension preferredSize()
{
return jTextArea.getPreferredSize();
}
public Dimension minimumSize(int rows, int cols) public Dimension minimumSize(int rows, int cols)
{ {
// TODO Auto-generated method stub return jTextArea.getMinimumSize();
return null;
} }
public Dimension preferredSize(int rows, int cols) public Dimension preferredSize(int rows, int cols)
{ {
// TODO Auto-generated method stub return jTextArea.getPreferredSize();
return null;
} }
public void replaceRange(String text, int start, int end) public void replaceRange(String text, int start, int end)
...@@ -310,8 +473,16 @@ public class SwingTextAreaPeer ...@@ -310,8 +473,16 @@ public class SwingTextAreaPeer
public void setText(String text) public void setText(String text)
{ {
System.err.println("setText: " + text);
jTextArea.setText(text); jTextArea.setText(text);
} }
public void reshape(int x, int y, int width, int height)
{
if (swingComponent != null)
{
swingComponent.getJComponent().setBounds(x, y, width, height);
swingComponent.getJComponent().validate();
}
}
} }
/* SwingTextFieldPeer.java -- A Swing based peer for AWT textfields /* SwingTextFieldPeer.java -- A Swing based peer for AWT textfields
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -44,6 +44,7 @@ import java.awt.Image; ...@@ -44,6 +44,7 @@ import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.TextField; import java.awt.TextField;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.im.InputMethodRequests; import java.awt.im.InputMethodRequests;
...@@ -72,13 +73,13 @@ public class SwingTextFieldPeer ...@@ -72,13 +73,13 @@ public class SwingTextFieldPeer
implements SwingComponent implements SwingComponent
{ {
TextField textField; TextField textField;
SwingTextField(TextField textField) SwingTextField(TextField textField)
{ {
this.textField = textField; this.textField = textField;
} }
/** /**
* Overridden to provide normal behaviour even without a real peer * Overridden to provide normal behaviour even without a real peer
* attached. * attached.
...@@ -91,8 +92,8 @@ public class SwingTextFieldPeer ...@@ -91,8 +92,8 @@ public class SwingTextFieldPeer
} }
/** /**
* Overridden so that the isShowing method returns the correct value for the * Overridden so that the isShowing method returns the correct value
* swing button, even if it has no peer on its own. * for the swing button, even if it has no peer on its own.
* *
* @return <code>true</code> if the button is currently showing, * @return <code>true</code> if the button is currently showing,
* <code>false</code> otherwise * <code>false</code> otherwise
...@@ -162,6 +163,18 @@ public class SwingTextFieldPeer ...@@ -162,6 +163,18 @@ public class SwingTextFieldPeer
processKeyEvent(ev); processKeyEvent(ev);
} }
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
public Container getParent() public Container getParent()
{ {
Container par = null; Container par = null;
...@@ -174,6 +187,16 @@ public class SwingTextFieldPeer ...@@ -174,6 +187,16 @@ public class SwingTextFieldPeer
{ {
return SwingTextFieldPeer.this.getGraphics(); return SwingTextFieldPeer.this.getGraphics();
} }
public void requestFocus() {
SwingTextFieldPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingTextFieldPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
} }
/** /**
......
...@@ -40,6 +40,7 @@ package gnu.java.awt.peer.swing; ...@@ -40,6 +40,7 @@ package gnu.java.awt.peer.swing;
import java.awt.Button; import java.awt.Button;
import java.awt.Canvas; import java.awt.Canvas;
import java.awt.Dialog;
import java.awt.Label; import java.awt.Label;
import java.awt.Menu; import java.awt.Menu;
import java.awt.MenuBar; import java.awt.MenuBar;
...@@ -162,4 +163,19 @@ public abstract class SwingToolkit extends ClasspathToolkit ...@@ -162,4 +163,19 @@ public abstract class SwingToolkit extends ClasspathToolkit
{ {
return new SwingTextFieldPeer(textField); return new SwingTextFieldPeer(textField);
} }
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
} }
...@@ -71,4 +71,29 @@ public abstract class SwingWindowPeer ...@@ -71,4 +71,29 @@ public abstract class SwingWindowPeer
super(window); super(window);
init(window, null); init(window, null);
} }
public void updateIconImages()
{
// TODO: Implement properly.
}
public void updateMinimumSize()
{
// TODO: Implement properly.
}
public void setModalBlocked(java.awt.Dialog d, boolean b)
{
// TODO: Implement properly.
}
public void updateFocusableWindowState()
{
// TODO: Implement properly.
}
public void setAlwaysOnTop(boolean b)
{
// TODO: Implement properly.
}
} }
...@@ -405,8 +405,12 @@ final class KeyboardMapping ...@@ -405,8 +405,12 @@ final class KeyboardMapping
if ((xMods & Input.SHIFT_MASK) != 0) if ((xMods & Input.SHIFT_MASK) != 0)
mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK; mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
if ((xMods & Input.META_MASK) != 0)
mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
if ((xMods & Input.ALT_MASK) != 0) if ((xMods & Input.ALT_MASK) != 0)
mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK; mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
if ((xMods & Input.MOD5_MASK) != 0)
mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
if ((xMods & Input.CONTROL_MASK) != 0) if ((xMods & Input.CONTROL_MASK) != 0)
mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK; mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
......
/* PixmapVolatileImage.java -- VolatileImage implementation around a Pixmap
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.x;
import gnu.x11.GC;
import gnu.x11.Pixmap;
import gnu.x11.image.Image;
import gnu.x11.image.ZPixmap;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.ImageCapabilities;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.ComponentSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.ImageObserver;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
/**
* A {@link VolatileImage} implementation that wraps an X Pixmap.
*/
class PixmapVolatileImage
extends VolatileImage
{
/**
* The shared capabilities instance.
*/
private static final ImageCapabilities caps = new ImageCapabilities(true);
/**
* The underlying pixmap.
*/
private Pixmap pixmap;
/**
* Creates a new PixmapVolatileImage.
*
* @param w the width of the image
* @param h the height of the image
*/
public PixmapVolatileImage(int w, int h)
{
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
XGraphicsDevice dev = (XGraphicsDevice) env.getDefaultScreenDevice();
pixmap = new Pixmap(dev.getDisplay(), w, h);
// Clear pixmap.
GC gc = new GC(pixmap);
gc.set_foreground(0xffffffff);
pixmap.fill_rectangle(gc, 0, 0, w, h);
}
@Override
public boolean contentsLost()
{
return false;
}
@Override
public Graphics2D createGraphics()
{
return new XGraphics2D(pixmap);
}
@Override
public ImageCapabilities getCapabilities()
{
return caps;
}
@Override
public int getHeight()
{
return pixmap.height;
}
@Override
public BufferedImage getSnapshot()
{
// TODO: Support non-24-bit resolutions.
int w = pixmap.width;
int h = pixmap.height;
ZPixmap zpixmap = (ZPixmap) pixmap.image(0, 0, w, h, 0xffffffff,
Image.Format.ZPIXMAP);
DataBuffer buffer = new ZPixmapDataBuffer(zpixmap);
SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h, 4,
w * 4,
new int[]{0, 1, 2, 3 });
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
ColorModel cm = new ComponentColorModel(cs, true, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
WritableRaster raster = Raster.createWritableRaster(sm, buffer,
new Point(0, 0));
return new BufferedImage(cm, raster, false, null);
}
@Override
public int getWidth()
{
return pixmap.width;
}
@Override
public int validate(GraphicsConfiguration gc)
{
// TODO: Check compatibility with gc.
return IMAGE_OK;
}
@Override
public int getHeight(ImageObserver observer)
{
return getHeight();
}
@Override
public Object getProperty(String name, ImageObserver observer)
{
return null;
}
@Override
public int getWidth(ImageObserver observer)
{
return getWidth();
}
/**
* Returns the underlying X pixmap. This is used for the graphics code.
*
* @return the underlying X pixmap
*/
Pixmap getPixmap()
{
return pixmap;
}
}
...@@ -97,8 +97,9 @@ public class XEventPump ...@@ -97,8 +97,9 @@ public class XEventPump
display = d; display = d;
windows = new HashMap(); windows = new HashMap();
drag = -1; drag = -1;
Thread t = new Thread(this); Thread thread = new Thread(this, "X Event Pump");
t.start(); thread.setDaemon(true);
thread.start();
} }
/** /**
...@@ -148,8 +149,9 @@ public class XEventPump ...@@ -148,8 +149,9 @@ public class XEventPump
private void handleEvent(Event xEvent) private void handleEvent(Event xEvent)
{ {
Integer key = new Integer(xEvent.window_id());;
Window awtWindow = (Window) windows.get(key); Integer key = null;
Window awtWindow = null;
if (XToolkit.DEBUG) if (XToolkit.DEBUG)
System.err.println("fetched event: " + xEvent); System.err.println("fetched event: " + xEvent);
...@@ -157,26 +159,45 @@ public class XEventPump ...@@ -157,26 +159,45 @@ public class XEventPump
{ {
case ButtonPress.CODE: case ButtonPress.CODE:
ButtonPress bp = (ButtonPress) xEvent; ButtonPress bp = (ButtonPress) xEvent;
key= new Integer(bp.event_window_id);
awtWindow = (Window) windows.get(key);
// Create and post the mouse event. // Create and post the mouse event.
int button = bp.detail(); int button = bp.detail();
// AWT cannot handle more than 3 buttons and expects 0 instead.
if (button >= gnu.x11.Input.BUTTON3)
button = 0;
drag = button; drag = button;
MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED, MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
System.currentTimeMillis(), 0, System.currentTimeMillis(),
KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
bp.event_x(), bp.event_y(), bp.event_x(), bp.event_y(),
1, false, button); 1, false, button);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
break; break;
case ButtonRelease.CODE: case ButtonRelease.CODE:
ButtonRelease br = (ButtonRelease) xEvent; ButtonRelease br = (ButtonRelease) xEvent;
key= new Integer(br.event_window_id);
awtWindow = (Window) windows.get(key);
button = br.detail();
// AWT cannot handle more than 3 buttons and expects 0 instead.
if (button >= gnu.x11.Input.BUTTON3)
button = 0;
drag = -1; drag = -1;
MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED, MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
System.currentTimeMillis(), 0, System.currentTimeMillis(),
KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
br.event_x(), br.event_y(), br.event_x(), br.event_y(),
1, false, br.detail()); 1, false, button);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
break; break;
case MotionNotify.CODE: case MotionNotify.CODE:
MotionNotify mn = (MotionNotify) xEvent; MotionNotify mn = (MotionNotify) xEvent;
key= new Integer(mn.event_window_id);
awtWindow = (Window) windows.get(key);
MouseEvent mm; MouseEvent mm;
if (drag == -1) if (drag == -1)
{ {
...@@ -195,6 +216,8 @@ public class XEventPump ...@@ -195,6 +216,8 @@ public class XEventPump
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm);
break; break;
case ConfigureNotify.CODE: case ConfigureNotify.CODE:
key= new Integer(((ConfigureNotify) xEvent).event_window_id);
awtWindow = (Window) windows.get(key);
ConfigureNotify c = (ConfigureNotify) xEvent; ConfigureNotify c = (ConfigureNotify) xEvent;
if (XToolkit.DEBUG) if (XToolkit.DEBUG)
System.err.println("resize request for window id: " + key); System.err.println("resize request for window id: " + key);
...@@ -213,6 +236,8 @@ public class XEventPump ...@@ -213,6 +236,8 @@ public class XEventPump
} }
break; break;
case Expose.CODE: case Expose.CODE:
key= new Integer(((Expose) xEvent).window_id);
awtWindow = (Window) windows.get(key);
Expose exp = (Expose) xEvent; Expose exp = (Expose) xEvent;
if (XToolkit.DEBUG) if (XToolkit.DEBUG)
System.err.println("expose request for window id: " + key); System.err.println("expose request for window id: " + key);
...@@ -228,6 +253,8 @@ public class XEventPump ...@@ -228,6 +253,8 @@ public class XEventPump
break; break;
case KeyPress.CODE: case KeyPress.CODE:
case KeyRelease.CODE: case KeyRelease.CODE:
key = new Integer(((Input) xEvent).event_window_id);
awtWindow = (Window) windows.get(key);
handleKeyEvent(xEvent, awtWindow); handleKeyEvent(xEvent, awtWindow);
break; break;
default: default:
...@@ -282,6 +309,23 @@ public class XEventPump ...@@ -282,6 +309,23 @@ public class XEventPump
} }
/** Translates an X button identifier to the AWT's MouseEvent modifier
* mask. As the AWT cannot handle more than 3 buttons those return
* <code>0</code>.
*/
static int buttonToModifier(int button)
{
switch (button)
{
case gnu.x11.Input.BUTTON1:
return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
case gnu.x11.Input.BUTTON2:
return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
case gnu.x11.Input.BUTTON3:
return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
}
} return 0;
}
}
...@@ -42,17 +42,21 @@ import java.awt.FontMetrics; ...@@ -42,17 +42,21 @@ import java.awt.FontMetrics;
import java.awt.font.FontRenderContext; import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector; import java.awt.font.GlyphVector;
import java.awt.font.LineMetrics; import java.awt.font.LineMetrics;
import java.awt.font.TextAttribute;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.text.CharacterIterator; import java.text.CharacterIterator;
import java.text.StringCharacterIterator; import java.text.StringCharacterIterator;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import gnu.java.awt.font.FontDelegate; import gnu.java.awt.font.FontDelegate;
import gnu.java.awt.font.FontFactory; import gnu.java.awt.font.FontFactory;
...@@ -62,11 +66,30 @@ public class XFontPeer2 ...@@ -62,11 +66,30 @@ public class XFontPeer2
extends ClasspathFontPeer extends ClasspathFontPeer
{ {
/**
* The font mapping as specified in the file fonts.properties.
*/
private static Properties fontProperties;
static
{
fontProperties = new Properties();
InputStream in = XFontPeer2.class.getResourceAsStream("fonts.properties");
try
{
fontProperties.load(in);
}
catch (IOException e)
{
e.printStackTrace();
}
}
private class XLineMetrics private class XLineMetrics
extends LineMetrics extends LineMetrics
{ {
private Font font; private Font font;
private GlyphVector glyphVector;
// private CharacterIterator characterIterator; // private CharacterIterator characterIterator;
// private int begin; // private int begin;
// private int limit; // private int limit;
...@@ -79,6 +102,8 @@ public class XFontPeer2 ...@@ -79,6 +102,8 @@ public class XFontPeer2
// begin = b; // begin = b;
// limit = l; // limit = l;
fontRenderContext = rc; fontRenderContext = rc;
glyphVector = fontDelegate.createGlyphVector(font, fontRenderContext,
ci);
} }
public float getAscent() public float getAscent()
...@@ -86,7 +111,7 @@ public class XFontPeer2 ...@@ -86,7 +111,7 @@ public class XFontPeer2
return fontDelegate.getAscent(font.getSize(), fontRenderContext.getTransform(), return fontDelegate.getAscent(font.getSize(), fontRenderContext.getTransform(),
fontRenderContext.isAntiAliased(), fontRenderContext.isAntiAliased(),
fontRenderContext.usesFractionalMetrics(), true); fontRenderContext.usesFractionalMetrics(), true);
} }
public int getBaselineIndex() public int getBaselineIndex()
{ {
...@@ -102,21 +127,18 @@ public class XFontPeer2 ...@@ -102,21 +127,18 @@ public class XFontPeer2
public float getDescent() public float getDescent()
{ {
return (int) fontDelegate.getDescent(font.getSize(), return (int) fontDelegate.getDescent(font.getSize(), IDENDITY, false,
new AffineTransform(), false, false, false, false);
false);
} }
public float getHeight() public float getHeight()
{ {
// FIXME: Implement this. return (float) glyphVector.getLogicalBounds().getHeight();
throw new UnsupportedOperationException("Not yet implemented");
} }
public float getLeading() public float getLeading()
{ {
// FIXME: Implement this. return getHeight() - getAscent() - getDescent();
throw new UnsupportedOperationException("Not yet implemented");
} }
public int getNumChars() public int getNumChars()
...@@ -150,6 +172,11 @@ public class XFontPeer2 ...@@ -150,6 +172,11 @@ public class XFontPeer2
private class XFontMetrics private class XFontMetrics
extends FontMetrics extends FontMetrics
{ {
/**
* A cached point instance, to be used in #charWidth().
*/
private Point2D cachedPoint = new Point2D.Double();
XFontMetrics(Font f) XFontMetrics(Font f)
{ {
super(f); super(f);
...@@ -157,22 +184,20 @@ public class XFontPeer2 ...@@ -157,22 +184,20 @@ public class XFontPeer2
public int getAscent() public int getAscent()
{ {
return (int) fontDelegate.getAscent(getFont().getSize(), return (int) fontDelegate.getAscent(getFont().getSize(), IDENDITY,
new AffineTransform(), false, false, false, false, false);
false);
} }
public int getDescent() public int getDescent()
{ {
return (int) fontDelegate.getDescent(getFont().getSize(), return (int) fontDelegate.getDescent(getFont().getSize(), IDENDITY,
new AffineTransform(), false, false, false, false, false);
false);
} }
public int getHeight() public int getHeight()
{ {
GlyphVector gv = fontDelegate.createGlyphVector(getFont(), GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
new FontRenderContext(new AffineTransform(), false, false), new FontRenderContext(IDENDITY, false, false),
new StringCharacterIterator("m")); new StringCharacterIterator("m"));
Rectangle2D b = gv.getVisualBounds(); Rectangle2D b = gv.getVisualBounds();
return (int) b.getHeight(); return (int) b.getHeight();
...@@ -180,8 +205,9 @@ public class XFontPeer2 ...@@ -180,8 +205,9 @@ public class XFontPeer2
public int charWidth(char c) public int charWidth(char c)
{ {
Point2D advance = new Point2D.Double(); int code = fontDelegate.getGlyphIndex(c);
fontDelegate.getAdvance(c, getFont().getSize(), new AffineTransform(), Point2D advance = cachedPoint;
fontDelegate.getAdvance(code, font.getSize2D(), IDENDITY,
false, false, true, advance); false, false, true, advance);
return (int) advance.getX(); return (int) advance.getX();
} }
...@@ -194,13 +220,18 @@ public class XFontPeer2 ...@@ -194,13 +220,18 @@ public class XFontPeer2
public int stringWidth(String s) public int stringWidth(String s)
{ {
GlyphVector gv = fontDelegate.createGlyphVector(getFont(), GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
new FontRenderContext(new AffineTransform(), false, false), new FontRenderContext(IDENDITY, false, false),
new StringCharacterIterator(s)); new StringCharacterIterator(s));
Rectangle2D b = gv.getVisualBounds(); Rectangle2D b = gv.getVisualBounds();
return (int) b.getWidth(); return (int) b.getWidth();
} }
} }
/**
* The indendity transform, to be used in several methods.
*/
private static final AffineTransform IDENDITY = new AffineTransform();
private FontDelegate fontDelegate; private FontDelegate fontDelegate;
XFontPeer2(String name, int style, int size) XFontPeer2(String name, int style, int size)
...@@ -208,7 +239,7 @@ public class XFontPeer2 ...@@ -208,7 +239,7 @@ public class XFontPeer2
super(name, style, size); super(name, style, size);
try try
{ {
File fontfile = new File("/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"); File fontfile = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
FileInputStream in = new FileInputStream(fontfile); FileInputStream in = new FileInputStream(fontfile);
FileChannel ch = in.getChannel(); FileChannel ch = in.getChannel();
ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0, ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
...@@ -239,7 +270,7 @@ public class XFontPeer2 ...@@ -239,7 +270,7 @@ public class XFontPeer2
} }
} }
public boolean canDisplay(Font font, char c) public boolean canDisplay(Font font, int c)
{ {
// FIXME: Implement this. // FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented"); throw new UnsupportedOperationException("Not yet implemented");
...@@ -326,4 +357,112 @@ public class XFontPeer2 ...@@ -326,4 +357,112 @@ public class XFontPeer2
throw new UnsupportedOperationException("Not yet implemented"); throw new UnsupportedOperationException("Not yet implemented");
} }
/**
* Encodes a font name + style + size specification into a X logical font
* description (XLFD) as described here:
*
* http://www.meretrx.com/e93/docs/xlfd.html
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param atts the text attributes
*
* @return the encoded font description
*/
static String encodeFont(String name, Map atts)
{
String family = name;
if (family == null || family.equals(""))
family = (String) atts.get(TextAttribute.FAMILY);
if (family == null)
family = "SansSerif";
int size = 12;
Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
if (sizeFl != null)
size = sizeFl.intValue();
int style = 0;
// Detect italic attribute.
Float posture = (Float) atts.get(TextAttribute.POSTURE);
if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
style |= Font.ITALIC;
// Detect bold attribute.
Float weight = (Float) atts.get(TextAttribute.WEIGHT);
if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
style |= Font.BOLD;
return encodeFont(name, style, size);
}
/**
* Encodes a font name + style + size specification into a X logical font
* description (XLFD) as described here:
*
* http://www.meretrx.com/e93/docs/xlfd.html
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param style the font style
* @param size the font size
*
* @return the encoded font description
*/
static String encodeFont(String name, int style, int size)
{
StringBuilder key = new StringBuilder();
key.append(validName(name));
key.append('.');
switch (style)
{
case Font.BOLD:
key.append("bold");
break;
case Font.ITALIC:
key.append("italic");
break;
case (Font.BOLD | Font.ITALIC):
key.append("bolditalic");
break;
case Font.PLAIN:
default:
key.append("plain");
}
String protoType = fontProperties.getProperty(key.toString());
int s = size;
return protoType.replaceFirst("%d", String.valueOf(s * 10));
}
/**
* Checks the specified font name for a valid font name. If the font name
* is not known, then this returns 'sansserif' as fallback.
*
* @param name the font name to check
*
* @return a valid font name
*/
static String validName(String name)
{
String retVal;
if (name.equalsIgnoreCase("sansserif")
|| name.equalsIgnoreCase("serif")
|| name.equalsIgnoreCase("monospaced")
|| name.equalsIgnoreCase("dialog")
|| name.equalsIgnoreCase("dialoginput"))
{
retVal = name.toLowerCase();
}
else
{
retVal = "sansserif";
}
return retVal;
}
} }
...@@ -137,4 +137,10 @@ public class XFramePeer ...@@ -137,4 +137,10 @@ public class XFramePeer
throw new UnsupportedOperationException("Not yet implemented."); throw new UnsupportedOperationException("Not yet implemented.");
} }
public Rectangle getBoundsPrivate()
{
// TODO: Implement this properly.
throw new InternalError("Not yet implemented");
}
} }
...@@ -37,16 +37,23 @@ exception statement from your version. */ ...@@ -37,16 +37,23 @@ exception statement from your version. */
package gnu.java.awt.peer.x; package gnu.java.awt.peer.x;
import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Shape; import java.awt.Shape;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.util.HashMap;
import gnu.java.awt.java2d.AbstractGraphics2D; import gnu.java.awt.java2d.AbstractGraphics2D;
import gnu.java.awt.java2d.ScanlineCoverage;
import gnu.x11.Colormap;
import gnu.x11.Drawable; import gnu.x11.Drawable;
import gnu.x11.GC; import gnu.x11.GC;
import gnu.x11.image.ZPixmap; import gnu.x11.image.ZPixmap;
...@@ -70,6 +77,11 @@ public class XGraphics2D ...@@ -70,6 +77,11 @@ public class XGraphics2D
*/ */
private boolean disposed; private boolean disposed;
/**
* The current foreground color, possibly null.
*/
private Color foreground;
XGraphics2D(Drawable d) XGraphics2D(Drawable d)
{ {
super(); super();
...@@ -80,31 +92,9 @@ public class XGraphics2D ...@@ -80,31 +92,9 @@ public class XGraphics2D
//setClip(new Rectangle(0, 0, xdrawable.width, xdrawable.height)); //setClip(new Rectangle(0, 0, xdrawable.width, xdrawable.height));
} }
/**
* Draws a pixel in the target coordinate space using the specified color.
*
* @param x the x coordinate
* @param y the y coordinate
*/
protected void rawSetPixel(int x, int y)
{
xdrawable.point(xgc, x, y);
}
// protected void rawFillPolygon(double[] xpoints, double[] ypoints, int npoints)
// {
// Point[] points = new Point[npoints];
// for (int n = 0; n < npoints; n++)
// {
// points[n] = new Point((int) xpoints[n], (int) ypoints[n]);
// }
// xdrawable.fill_poly(xgc, points, Drawable.COMPLEX, Drawable.ORIGIN);
// xdrawable.display.flush();
// }
protected void rawDrawLine(int x0, int y0, int x1, int y1) protected void rawDrawLine(int x0, int y0, int x1, int y1)
{ {
xdrawable.line(xgc, x0, y0, x1, y1); xdrawable.segment(xgc, x0, y0, x1, y1);
} }
protected void rawFillRect(int x, int y, int w, int h) protected void rawFillRect(int x, int y, int w, int h)
...@@ -112,17 +102,6 @@ public class XGraphics2D ...@@ -112,17 +102,6 @@ public class XGraphics2D
xdrawable.rectangle(xgc, x, y, w, h, true); xdrawable.rectangle(xgc, x, y, w, h, true);
} }
protected void rawSetForeground(java.awt.Color c)
{
if (c != null)
xgc.set_foreground(c.getRGB());
}
protected void rawSetForeground(int r, int g, int b)
{
xgc.set_foreground( r << 16 | g << 8 | b );
}
/** /**
* Returns the color model of this Graphics object. * Returns the color model of this Graphics object.
* *
...@@ -178,55 +157,6 @@ public class XGraphics2D ...@@ -178,55 +157,6 @@ public class XGraphics2D
return copy; return copy;
} }
// /**
// * Draws the specified image on the drawable at position (x,y).
// */
//
// public boolean drawImage(Image image, int x, int y, ImageObserver observer)
// {
// AffineTransform transform = getTransform();
// int translateX = (int) transform.getTranslateX();
// int translateY = (int) transform.getTranslateY();
// if (image instanceof XImage)
// {
// XImage xim = (XImage) image;
// Pixmap pm = xim.pixmap;
// xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
// x + translateX, y + translateY);
// }
// else if (image instanceof BufferedImage)
// {
// BufferedImage bufferedImage = (BufferedImage) image;
// Raster raster = bufferedImage.getData();
// int w = bufferedImage.getWidth();
// int h = bufferedImage.getHeight();
// // Push data to X server.
// ZPixmap zPixmap = new ZPixmap(xdrawable.display, w, h,
// xdrawable.display.default_pixmap_format);
// System.err.println("data buffer length: " + zPixmap.data.length);
// int[] pixel = new int[4];
// for (int tx = 0; tx < w; tx++)
// {
// for (int ty = 0; ty < h; ty++)
// {
// pixel = raster.getPixel(tx, ty, pixel);
//// System.err.print("r: " + pixel[0]);
//// System.err.print(", g: " + pixel[1]);
//// System.err.println(", b: " + pixel[2]);
// zPixmap.set_red(tx, ty, pixel[0]);
// zPixmap.set_green(tx, ty, pixel[1]);
// zPixmap.set_blue(tx, ty, pixel[2]);
// }
// }
// xdrawable.put_image(xgc, zPixmap, x, y);
// }
// else
// {
// throw new UnsupportedOperationException("Not yet implemented.");
// }
// return true;
// }
//
public void setClip(Shape c) public void setClip(Shape c)
{ {
super.setClip(c); super.setClip(c);
...@@ -287,9 +217,115 @@ public class XGraphics2D ...@@ -287,9 +217,115 @@ public class XGraphics2D
} }
} }
public void renderScanline(int y, ScanlineCoverage c)
{
ScanlineCoverage.Iterator iter = c.iterate();
float coverageAlpha = 0;
int maxCoverage = c.getMaxCoverage();
Color old = getColor();
Color col = getColor();
if (col == null)
col = Color.BLACK;
while (iter.hasNext())
{
ScanlineCoverage.Range range = iter.next();
// TODO: Dumb implementation for testing.
coverageAlpha = range.getCoverage();
if (coverageAlpha > 0)
{
int red = col.getRed();
int green = col.getGreen();
int blue = col.getBlue();
if (coverageAlpha < c.getMaxCoverage())
{
float alpha = coverageAlpha / maxCoverage;
red = 255 - (int) ((255 - red) * alpha);
green = 255 - (int) ((255 - green) * alpha);
blue = 255 - (int) ((255 - blue) * alpha);
}
xgc.set_foreground(red << 16 | green << 8 | blue);
int x0 = range.getXPos();
int l = range.getLength();
xdrawable.fill_rectangle(xgc, x0, y, l, 1);
}
}
if (old != null)
xgc.set_foreground(old.getRGB());
}
protected void fillScanline(int x0, int x1, int y)
{
xdrawable.segment(xgc, x0, y, x1, y);
}
protected void fillScanlineAA(int x0, int x1, int y, int alpha)
{
//System.err.println("fillScanlineAA: " + x0 + ", " + x1 + ", " + y + ", " + alpha);
// FIXME: This is for testing only.
Color c = getColor();
setColor(new Color(255-alpha, 255-alpha, 255-alpha));
xdrawable.segment(xgc, x0, y, x1, y);
setColor(c);
}
protected void init() protected void init()
{ {
super.init(); super.init();
} }
public void setPaint(Paint p)
{
super.setPaint(p);
if (p instanceof Color)
{
Color c = (Color) p;
XToolkit tk = (XToolkit) Toolkit.getDefaultToolkit();
HashMap colorMap = tk.colorMap;
gnu.x11.Color col = (gnu.x11.Color) colorMap.get(c);
if (col == null)
{
Colormap map = xdrawable.display.default_colormap;
col = map.alloc_color (c.getRed() * 256,
c.getGreen() * 256,
c.getBlue() * 256);
colorMap.put(c, col);
}
xgc.set_foreground(col);
foreground = c;
}
}
protected void fillShape(Shape s, boolean isFont)
{
synchronized (xdrawable.display) {
super.fillShape(s, isFont);
}
}
protected boolean rawDrawImage(Image image, int x, int y, ImageObserver obs)
{
boolean ret;
if (image instanceof XImage)
{
XImage xImage = (XImage) image;
xdrawable.copy_area(xImage.pixmap, xgc, 0, 0, xImage.getWidth(obs),
xImage.getHeight(obs), x, y);
ret = true;
}
else if (image instanceof PixmapVolatileImage)
{
PixmapVolatileImage pvi = (PixmapVolatileImage) image;
xdrawable.copy_area(pvi.getPixmap(), xgc, 0, 0, pvi.getWidth(obs),
pvi.getHeight(obs), x, y);
ret = true;
}
else
{
ret = super.rawDrawImage(image, x, y, obs);
}
return ret;
}
} }
...@@ -39,11 +39,20 @@ package gnu.java.awt.peer.x; ...@@ -39,11 +39,20 @@ package gnu.java.awt.peer.x;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.ComponentSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.VolatileImage; import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
public class XGraphicsConfiguration public class XGraphicsConfiguration
extends GraphicsConfiguration extends GraphicsConfiguration
...@@ -63,26 +72,60 @@ public class XGraphicsConfiguration ...@@ -63,26 +72,60 @@ public class XGraphicsConfiguration
public BufferedImage createCompatibleImage(int w, int h) public BufferedImage createCompatibleImage(int w, int h)
{ {
return new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); return createCompatibleImage(w, h, Transparency.OPAQUE);
} }
public VolatileImage createCompatibleVolatileImage(int w, int h) public BufferedImage createCompatibleImage(int w, int h, int transparency)
{ {
// TODO: Implement this. BufferedImage bi;
throw new UnsupportedOperationException("Not yet implemented."); switch (transparency)
{
case Transparency.OPAQUE:
DataBuffer buffer = new ZPixmapDataBuffer(w, h);
SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h,
4, w * 4,
new int[]{0, 1, 2, 3 });
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
ColorModel cm = new ComponentColorModel(cs, true, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
WritableRaster raster = Raster.createWritableRaster(sm, buffer,
new Point(0, 0));
bi = new BufferedImage(cm, raster, false, null);
break;
case Transparency.BITMASK:
case Transparency.TRANSLUCENT:
bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
break;
default:
throw new IllegalArgumentException("Illegal transparency: "
+ transparency);
}
return bi;
} }
public VolatileImage createCompatibleVolatileImage(int width, int height, public VolatileImage createCompatibleVolatileImage(int w, int h)
int transparency)
{ {
// TODO: Implement this. return createCompatibleVolatileImage(w, h, Transparency.OPAQUE);
throw new UnsupportedOperationException("Not yet implemented.");
} }
public BufferedImage createCompatibleImage(int w, int h, int transparency) public VolatileImage createCompatibleVolatileImage(int width, int height,
int transparency)
{ {
// TODO: Implement this. VolatileImage im;
throw new UnsupportedOperationException("Not yet implemented."); switch (transparency)
{
case Transparency.OPAQUE:
im = new PixmapVolatileImage(width, height);
break;
case Transparency.BITMASK:
case Transparency.TRANSLUCENT:
throw new UnsupportedOperationException("Not yet implemented");
default:
throw new IllegalArgumentException("Unknown transparency type: "
+ transparency);
}
return im;
} }
public ColorModel getColorModel() public ColorModel getColorModel()
......
...@@ -38,15 +38,12 @@ exception statement from your version. */ ...@@ -38,15 +38,12 @@ exception statement from your version. */
package gnu.java.awt.peer.x; package gnu.java.awt.peer.x;
import gnu.classpath.SystemProperties; import gnu.classpath.SystemProperties;
import gnu.java.net.local.LocalSocket;
import gnu.java.net.local.LocalSocketAddress;
import gnu.x11.Connection;
import gnu.x11.Display; import gnu.x11.Display;
import java.awt.AWTError;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.net.SocketException; import java.lang.reflect.Constructor;
import java.net.Socket;
/** /**
* This class represents an X Display. The actual connection is established * This class represents an X Display. The actual connection is established
...@@ -127,33 +124,21 @@ public class XGraphicsDevice ...@@ -127,33 +124,21 @@ public class XGraphicsDevice
|| displayName.hostname.equals("")) || displayName.hostname.equals(""))
&& SystemProperties.getProperty("gnu.xawt.no_local_sockets") == null) && SystemProperties.getProperty("gnu.xawt.no_local_sockets") == null)
{ {
// TODO: Is this 100% ok? Socket socket = createLocalSocket();
String sockPath = "/tmp/.X11-unix/X" + displayName.display_no; if (socket != null)
LocalSocketAddress addr = new LocalSocketAddress(sockPath);
try
{ {
if (XToolkit.DEBUG)
System.err.println("connecting to local socket: "
+ sockPath);
LocalSocket socket = new LocalSocket(addr);
display = new Display(socket, "localhost", display = new Display(socket, "localhost",
displayName.display_no, displayName.display_no,
displayName.screen_no); displayName.screen_no);
display.connection.send_mode = Connection.ASYNCHRONOUS;
if (XToolkit.DEBUG)
System.err.println("connected to local socket");
} }
catch (SocketException ex)
{
AWTError err = new AWTError("could not connect to X server");
err.initCause(ex);
throw err;
}
}
else
{
display = new Display(displayName);
} }
// The following happens when we are configured to use plain sockets,
// when the connection is probably remote or when we couldn't load
// the LocalSocket class stuff.
if (display == null)
display = new Display(displayName);
eventPump = new XEventPump(display); eventPump = new XEventPump(display);
} }
return display; return display;
...@@ -163,4 +148,36 @@ public class XGraphicsDevice ...@@ -163,4 +148,36 @@ public class XGraphicsDevice
{ {
return eventPump; return eventPump;
} }
/**
* Tries to load the LocalSocket class and initiate a connection to the
* local X server.
*/
private Socket createLocalSocket()
{
Socket socket = null;
try
{
// TODO: Is this 100% ok?
String sockPath = "/tmp/.X11-unix/X" + displayName.display_no;
Class localSocketAddressClass =
Class.forName("gnu.java.net.local.LocalSocketAddress");
Constructor localSocketAddressConstr =
localSocketAddressClass.getConstructor(new Class[]{ String.class });
Object addr =
localSocketAddressConstr.newInstance(new Object[]{ sockPath });
Class localSocketClass =
Class.forName("gnu.java.net.local.LocalSocket");
Constructor localSocketConstructor =
localSocketClass.getConstructor(new Class[]{localSocketAddressClass});
Object localSocket =
localSocketConstructor.newInstance(new Object[]{ addr });
socket = (Socket) localSocket;
}
catch (Exception ex)
{
// Whatever goes wrong here, we return null.
}
return socket;
}
} }
...@@ -86,7 +86,7 @@ public class XImage ...@@ -86,7 +86,7 @@ public class XImage
*/ */
public Graphics getGraphics() public Graphics getGraphics()
{ {
XGraphics g = new XGraphics(pixmap); XGraphics2D g = new XGraphics2D(pixmap);
return g; return g;
} }
......
...@@ -44,7 +44,6 @@ import java.awt.Canvas; ...@@ -44,7 +44,6 @@ import java.awt.Canvas;
import java.awt.Checkbox; import java.awt.Checkbox;
import java.awt.CheckboxMenuItem; import java.awt.CheckboxMenuItem;
import java.awt.Choice; import java.awt.Choice;
import java.awt.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
...@@ -69,6 +68,8 @@ import java.awt.TextArea; ...@@ -69,6 +68,8 @@ import java.awt.TextArea;
import java.awt.TextField; import java.awt.TextField;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.Window; import java.awt.Window;
import java.awt.Dialog.ModalExclusionType;
import java.awt.Dialog.ModalityType;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.dnd.peer.DragSourceContextPeer;
...@@ -88,7 +89,6 @@ import java.awt.peer.FileDialogPeer; ...@@ -88,7 +89,6 @@ import java.awt.peer.FileDialogPeer;
import java.awt.peer.FontPeer; import java.awt.peer.FontPeer;
import java.awt.peer.FramePeer; import java.awt.peer.FramePeer;
import java.awt.peer.LabelPeer; import java.awt.peer.LabelPeer;
import java.awt.peer.LightweightPeer;
import java.awt.peer.ListPeer; import java.awt.peer.ListPeer;
import java.awt.peer.MenuBarPeer; import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuItemPeer; import java.awt.peer.MenuItemPeer;
...@@ -179,16 +179,16 @@ public class XToolkit ...@@ -179,16 +179,16 @@ public class XToolkit
*/ */
public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs) public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs)
{ {
String canonical = XFontPeer.encodeFont(name, attrs); String canonical = XFontPeer2.encodeFont(name, attrs);
ClasspathFontPeer font; ClasspathFontPeer font;
if (!fontCache.containsKey(canonical)) if (!fontCache.containsKey(canonical))
{ {
String graphics2d = String graphics2d =
SystemProperties.getProperty("gnu.xawt.graphics2d"); SystemProperties.getProperty("gnu.xawt.graphics2d");
if (graphics2d != null && graphics2d.equals("gl")) //if (graphics2d != null && graphics2d.equals("gl"))
font = new XFontPeer2(name, attrs); font = new XFontPeer2(name, attrs);
else // else
font = new XFontPeer(name, attrs); // font = new XFontPeer(name, attrs);
fontCache.put(canonical, font); fontCache.put(canonical, font);
} }
else else
...@@ -601,8 +601,20 @@ public class XToolkit ...@@ -601,8 +601,20 @@ public class XToolkit
return (XGraphicsDevice) env.getDefaultScreenDevice(); return (XGraphicsDevice) env.getDefaultScreenDevice();
} }
protected LightweightPeer createComponent(Component c) @Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{ {
return new XLightweightPeer(c); // TODO: Implement properly.
return false;
} }
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
// TODO: Implement properly.
return false;
}
} }
...@@ -43,12 +43,16 @@ import java.awt.EventQueue; ...@@ -43,12 +43,16 @@ import java.awt.EventQueue;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image; import java.awt.Image;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.PaintEvent; import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.VolatileImage;
import gnu.x11.Window; import gnu.x11.Window;
import gnu.x11.event.Event; import gnu.x11.event.Event;
...@@ -135,12 +139,22 @@ public class XWindowPeer ...@@ -135,12 +139,22 @@ public class XWindowPeer
*/ */
public Graphics getGraphics() public Graphics getGraphics()
{ {
return new XGraphics(xwindow); return new XGraphics2D(xwindow);
} }
public Image createImage(int w, int h) public Image createImage(int w, int h)
{ {
return new XImage(w, h); // FIXME: Should return a buffered image.
return createVolatileImage(w, h);
}
@Override
public VolatileImage createVolatileImage(int width, int height)
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
return gc.createCompatibleVolatileImage(width, height);
} }
/** /**
...@@ -168,6 +182,9 @@ public class XWindowPeer ...@@ -168,6 +182,9 @@ public class XWindowPeer
new Rectangle(0, 0, w.getWidth(), new Rectangle(0, 0, w.getWidth(),
w.getHeight()))); w.getHeight())));
Graphics g = getGraphics();
g.clearRect(0, 0, awtComponent.getWidth(), awtComponent.getHeight());
g.dispose();
// // Reset input selection. // // Reset input selection.
// atts.set_override_redirect(false); // atts.set_override_redirect(false);
// xwindow.change_attributes(atts); // xwindow.change_attributes(atts);
...@@ -240,7 +257,7 @@ public class XWindowPeer ...@@ -240,7 +257,7 @@ public class XWindowPeer
*/ */
public FontMetrics getFontMetrics(Font font) public FontMetrics getFontMetrics(Font font)
{ {
XFontPeer fontPeer = (XFontPeer) font.getPeer(); XFontPeer2 fontPeer = (XFontPeer2) font.getPeer();
return fontPeer.getFontMetrics(font); return fontPeer.getFontMetrics(font);
} }
......
package gnu.java.awt.peer.x;
import gnu.x11.Display;
import gnu.x11.image.ZPixmap;
import java.awt.GraphicsEnvironment;
import java.awt.image.DataBuffer;
/**
* A DataBuffer implementation that is based on a ZPixmap. This is used
* as backing store for BufferedImages.
*/
class ZPixmapDataBuffer
extends DataBuffer
{
/**
* The backing ZPixmap.
*/
private ZPixmap zpixmap;
/**
* Creates a new ZPixmapDataBuffer with a specified width and height.
*
* @param d the X display
* @param w the width
* @param h the height
*/
ZPixmapDataBuffer(int w, int h)
{
super(TYPE_BYTE, w * h * 3); // TODO: Support non-24-bit-resolutions.
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
XGraphicsDevice dev = (XGraphicsDevice) env.getDefaultScreenDevice();
Display d = dev.getDisplay();
zpixmap = new ZPixmap(d, w, h, d.default_pixmap_format);
}
/**
* Creates a ZPixmapDataBuffer from an existing ZPixmap.
*
* @param zpixmap the ZPixmap to wrap
*/
ZPixmapDataBuffer(ZPixmap zpixmap)
{
super(TYPE_BYTE, zpixmap.get_data_length());
this.zpixmap = zpixmap;
}
@Override
public int getElem(int bank, int i)
{
return 0xff & zpixmap.get_data_element(i);
}
@Override
public void setElem(int bank, int i, int val)
{
zpixmap.set_data_element(i, (byte) val);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment