aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath
diff options
context:
space:
mode:
authorfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-14 03:38:34 +0000
committerfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-14 03:38:34 +0000
commit9a8abce4ba5d94b8fd01bc953895172af37da756 (patch)
tree4ead311615cefc89deebca761f0deb7edf23dcb8 /libjava/classpath
parent718a81bbcc48249c65240e8e0eb650e465565d39 (diff)
2006-06-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* configure: Regenerate. * Makefile.in: Regenerate. * configure.ac (--enable-plugin): New option. (ac_configure_args): Add --enable-tool-wrappers. (ac_configure_args): Add --disable-plugin unless --enable-plugin was specified. * gcj/Makefile.in: Regenerate. * sources.am (gnu_java_net_source_files): Add classpath/gnu/java/net/IndexListParser.java. (property_files): Remove classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties, classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties. Add classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties, classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties, classpath/resource/gnu/classpath/tools/getopt/Messages.properties, classpath/resource/gnu/classpath/tools/jar/messages.properties, classpath/resource/gnu/classpath/tools/jarsigner/messages.properties, classpath/resource/gnu/classpath/tools/keytool/messages.properties, classpath/resource/gnu/classpath/tools/native2ascii/messages.properties, classpath/resource/gnu/classpath/tools/serialver/messages.properties. * classpath/Makefile.in: Regenerate. * classpath/native/jni/gtk-peer/cairographics2d.h, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c: Merge from GNU Classpath. * classpath/native/Makefile.in: Regenerate. * classpath/native/jawt/Makefile.in: Regenerate. * classpath/native/jawt/Makefile.am: Install libjawt.so in GCJ's versioned library directory. * classpath/native/Makefile.am: Add plugin directory if --enable-plugin was specified. * classpath/native/plugin/Makefile.in: Regenerate. * classpath/native/plugin/Makefile.am: Install libgcjwebplugin.so in GCJ's versioned library directory. * classpath/resource/gnu/classpath/tools/native2ascii/messages.properties: New file. * classpath/resource/gnu/classpath/tools/getopt/Messages.properties: Likewise. * classpath/resource/gnu/classpath/tools/jarsigner/messages.properties: Likewise. * classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties: Remove file. * classpath/resource/gnu/classpath/tools/keytool/messages.properties: New file. * classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties: Remove file. * classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties: New file. * classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties: Likewise. * classpath/resource/gnu/classpath/tools/jar/messages.properties: Likewise. * classpath/resource/gnu/classpath/tools/serialver/messages.properties: Likewise. * classpath/gnu/java/net/IndexListParser.java: Likewise. * classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java, classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java, classpath/gnu/java/awt/peer/gtk/CairoSurface.java, classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java, classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java, classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java, classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java, classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java, classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java, classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java, classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java, classpath/gnu/java/awt/java2d/PolyEdge.java, classpath/gnu/java/awt/java2d/AbstractGraphics2D.java: Merge from GNU Classpath. * classpath/tools/toolwrapper.c: Replace tools.zip reference with libgcj-tools-4.2.0.jar. * classpath/tools/Makefile.in: Regenerate. * classpath/tools/Makefile.am: Rename tools.zip to libgcj-tools-4.2.0.jar. Install libgcj-tools-4.2.0.jar in $(datadir)/java. * classpath/javax/swing/JTabbedPane.java, classpath/javax/swing/text/DefaultStyledDocument.java, classpath/javax/swing/text/html/HTMLDocument.java, classpath/javax/swing/text/GapContent.java, classpath/javax/swing/JComponent.java, classpath/javax/swing/RepaintManager.java, classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java, classpath/javax/swing/plaf/basic/BasicScrollBarUI.java, classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java, classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java, classpath/javax/swing/plaf/basic/BasicLookAndFeel.java, classpath/javax/swing/plaf/metal/MetalButtonUI.java, classpath/java/text/Bidi.java, classpath/java/awt/image/BufferedImage.java, classpath/java/awt/datatransfer/DataFlavor.java, classpath/java/awt/geom/AffineTransform.java, classpath/java/awt/dnd/DropTargetDropEvent.java, classpath/java/awt/dnd/DropTargetContext.java, classpath/java/awt/font/TextLayout.java, classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h, classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h, classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h, classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h, classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h, classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h: Merge from GNU Classpath. * classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h, classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c, classpath/native/jni/gtk-peer/gtkcairopeer.h, classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Remove files. * classpath/Makefile.am (SUBDIRS, DIST_SUBDIRS): Include tools directory. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath')
-rw-r--r--libjava/classpath/Makefile.am6
-rw-r--r--libjava/classpath/Makefile.in4
-rw-r--r--libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java6
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java28
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/PolyEdge.java3
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java432
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java63
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java180
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java104
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java60
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java107
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java26
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java9
-rw-r--r--libjava/classpath/gnu/java/net/IndexListParser.java177
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h52
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h18
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h2
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h2
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h47
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h67
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h2
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h8
-rw-r--r--libjava/classpath/java/awt/Component.java5
-rw-r--r--libjava/classpath/java/awt/datatransfer/DataFlavor.java7
-rw-r--r--libjava/classpath/java/awt/dnd/DropTargetContext.java61
-rw-r--r--libjava/classpath/java/awt/dnd/DropTargetDropEvent.java53
-rw-r--r--libjava/classpath/java/awt/font/LineBreakMeasurer.java165
-rw-r--r--libjava/classpath/java/awt/font/TextLayout.java517
-rw-r--r--libjava/classpath/java/awt/geom/AffineTransform.java4
-rw-r--r--libjava/classpath/java/awt/image/BufferedImage.java41
-rw-r--r--libjava/classpath/java/awt/image/PixelGrabber.java7
-rw-r--r--libjava/classpath/java/text/Bidi.java3
-rw-r--r--libjava/classpath/javax/swing/JComponent.java51
-rw-r--r--libjava/classpath/javax/swing/JTabbedPane.java4
-rw-r--r--libjava/classpath/javax/swing/RepaintManager.java20
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java16
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java8
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java58
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java24
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java12
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java5
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java7
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java193
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java73
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java36
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java22
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java145
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java23
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java7
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java52
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java101
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java4
-rw-r--r--libjava/classpath/javax/swing/text/DefaultStyledDocument.java8
-rw-r--r--libjava/classpath/javax/swing/text/GapContent.java2
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLDocument.java61
-rw-r--r--libjava/classpath/native/Makefile.am8
-rw-r--r--libjava/classpath/native/Makefile.in5
-rw-r--r--libjava/classpath/native/jawt/Makefile.am10
-rw-r--r--libjava/classpath/native/jawt/Makefile.in68
-rw-r--r--libjava/classpath/native/jni/gtk-peer/cairographics2d.h3
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c189
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c92
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c10
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c27
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c758
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c2018
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c25
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c9
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c53
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtkcairopeer.h93
-rw-r--r--libjava/classpath/native/plugin/Makefile.am15
-rw-r--r--libjava/classpath/native/plugin/Makefile.in72
-rw-r--r--libjava/classpath/native/plugin/gcjwebplugin.cc97
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties70
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties75
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/getopt/Messages.properties49
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/jar/messages.properties71
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties33
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/jarsigner/messages.properties122
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties95
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/keytool/messages.properties542
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/native2ascii/messages.properties43
-rw-r--r--libjava/classpath/resource/gnu/classpath/tools/serialver/messages.properties44
-rwxr-xr-xlibjava/classpath/tools/Makefile.am71
-rw-r--r--libjava/classpath/tools/Makefile.in192
-rw-r--r--libjava/classpath/tools/toolwrapper.c4
94 files changed, 3760 insertions, 4431 deletions
diff --git a/libjava/classpath/Makefile.am b/libjava/classpath/Makefile.am
index dc3373a190f..82e97dbde7f 100644
--- a/libjava/classpath/Makefile.am
+++ b/libjava/classpath/Makefile.am
@@ -1,10 +1,8 @@
## Input file for automake to generate the Makefile.in used by configure
# lib first, to compile .class files before native code, last examples
-## GCJ LOCAL: we remove 'tools' for the time being.
-## We don't build any of them into actual tools yet.
-SUBDIRS = lib doc external include native resource scripts $(EXAMPLESDIR)
-DIST_SUBDIRS = lib doc external include native resource scripts examples
+SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
+DIST_SUBDIRS = lib doc external include native resource scripts tools examples
## GCJ LOCAL: we need an extra -I here.
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
diff --git a/libjava/classpath/Makefile.in b/libjava/classpath/Makefile.in
index 2f99e810e1a..21f6a3fead4 100644
--- a/libjava/classpath/Makefile.in
+++ b/libjava/classpath/Makefile.in
@@ -295,8 +295,8 @@ target_vendor = @target_vendor@
vm_classes = @vm_classes@
# lib first, to compile .class files before native code, last examples
-SUBDIRS = lib doc external include native resource scripts $(EXAMPLESDIR)
-DIST_SUBDIRS = lib doc external include native resource scripts examples
+SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
+DIST_SUBDIRS = lib doc external include native resource scripts tools examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 \
diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java
index 6f53af6729d..7e50b6678bf 100644
--- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java
+++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java
@@ -1066,6 +1066,10 @@ class VirtualMachine
stack[sp] = ((e1 != 0) || (stack[sp] != 0)) ? 1 : 0;
break;
+ case 0x5C: // NOT
+ stack[sp] = (stack[sp] != 0) ? 0 : 1;
+ break;
+
case 0x5e: // SDB, Set Delta Base in the graphics state
deltaBase = stack[sp--];
break;
@@ -1764,7 +1768,7 @@ class VirtualMachine
/* 50 */ "LT", "LTEQ", "GT", "GTEQ",
/* 54 */ "EQ", "NEQ", "INST_56", "INST_57",
/* 58 */ "IF", "EIF", "AND", "OR",
- /* 5c */ "INST_5C", "INST_5D", "SDB", "SDS",
+ /* 5c */ "NOT", "INST_5D", "SDB", "SDS",
/* 60 */ "ADD", "SUB", "DIV", "MUL",
/* 64 */ "ABS", "NEG", "FLOOR", "CEILING",
/* 68 */ "ROUND[0]", "ROUND[1]", "ROUND[2]", "ROUND[3]",
diff --git a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
index 7df9949e68e..f057d8b237d 100644
--- a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
@@ -1331,8 +1331,8 @@ public abstract class AbstractGraphics2D
{
AffineTransform t = new AffineTransform();
t.translate(x, y);
- double scaleX = (double) image.getWidth(observer) / (double) width;
- double scaleY = (double) image.getHeight(observer) / (double) height;
+ double scaleX = (double) width / (double) image.getWidth(observer);
+ double scaleY = (double) height / (double) image.getHeight(observer);
t.scale(scaleX, scaleY);
return drawImage(image, t, observer);
}
@@ -1473,15 +1473,11 @@ public abstract class AbstractGraphics2D
antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON);
}
- double offs = 0.5;
- if (antialias)
- offs = offs / AA_SAMPLING;
-
Rectangle2D userBounds = s.getBounds2D();
Rectangle2D deviceBounds = new Rectangle2D.Double();
- ArrayList segs = getSegments(s, transform, deviceBounds, false, offs);
+ ArrayList segs = getSegments(s, transform, deviceBounds, false);
Rectangle2D clipBounds = new Rectangle2D.Double();
- ArrayList clipSegs = getSegments(clip, transform, clipBounds, true, offs);
+ ArrayList clipSegs = getSegments(clip, transform, clipBounds, true);
segs.addAll(clipSegs);
Rectangle2D inclClipBounds = new Rectangle2D.Double();
Rectangle2D.union(clipBounds, deviceBounds, inclClipBounds);
@@ -1676,7 +1672,10 @@ public abstract class AbstractGraphics2D
// Scan all relevant lines.
int minYInt = (int) Math.ceil(icMinY);
- for (int y = minYInt; y <= maxY; y++)
+
+ Rectangle devClip = getDeviceBounds();
+ int scanlineMax = (int) Math.min(maxY, devClip.getMaxY());
+ for (int y = minYInt; y < scanlineMax; y++)
{
ArrayList bucket = edgeTable[y - minYInt];
// Update all the x intersections in the current activeEdges table
@@ -2169,8 +2168,7 @@ public abstract class AbstractGraphics2D
* @return a list of PolyEdge that form the shape in device space
*/
private ArrayList getSegments(Shape s, AffineTransform t,
- Rectangle2D deviceBounds, boolean isClip,
- double offs)
+ Rectangle2D deviceBounds, boolean isClip)
{
// Flatten the path. TODO: Determine the best flattening factor
// wrt to speed and quality.
@@ -2213,14 +2211,14 @@ public abstract class AbstractGraphics2D
else if (segType == PathIterator.SEG_CLOSE)
{
// Close the polyline.
- PolyEdge edge = new PolyEdge(segX, segY - offs,
- polyX, polyY - offs, isClip);
+ PolyEdge edge = new PolyEdge(segX, segY,
+ polyX, polyY, isClip);
segs.add(edge);
}
else if (segType == PathIterator.SEG_LINETO)
{
- PolyEdge edge = new PolyEdge(segX, segY - offs,
- seg[0], seg[1] - offs, isClip);
+ PolyEdge edge = new PolyEdge(segX, segY,
+ seg[0], seg[1], isClip);
segs.add(edge);
segX = seg[0];
segY = seg[1];
diff --git a/libjava/classpath/gnu/java/awt/java2d/PolyEdge.java b/libjava/classpath/gnu/java/awt/java2d/PolyEdge.java
index 8dbdbabcb94..6c3b546881a 100644
--- a/libjava/classpath/gnu/java/awt/java2d/PolyEdge.java
+++ b/libjava/classpath/gnu/java/awt/java2d/PolyEdge.java
@@ -118,6 +118,7 @@ public class PolyEdge
public String toString()
{
return "Edge: " + x0 + ", " + y0 + ", " + x1 + ", " + y1 + ", slope: "
- + slope + ", xIntersection: " + xIntersection;
+ + slope + ", xIntersection: " + xIntersection
+ + ", isClip: " + isClip;
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
index 3179d3379b9..9f8f494eb41 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
@@ -38,14 +38,12 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
-import gnu.classpath.Configuration;
import gnu.java.awt.ClasspathToolkit;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
-import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
@@ -63,11 +61,12 @@ import java.awt.TexturePaint;
import java.awt.Toolkit;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
+import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
-import java.awt.geom.Line2D;
import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
@@ -77,12 +76,11 @@ import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ColorModel;
-import java.awt.image.CropImageFilter;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferInt;
import java.awt.image.DirectColorModel;
-import java.awt.image.FilteredImageSource;
import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
import java.awt.image.ImagingOpException;
import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.Raster;
@@ -94,7 +92,6 @@ import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.HashMap;
import java.util.Map;
-import java.util.Stack;
/**
* This is an abstract implementation of Graphics2D on Cairo.
@@ -241,13 +238,10 @@ public abstract class CairoGraphics2D extends Graphics2D
bg = new Color(g.bg.getRGB());
}
- if (g.clip == null)
- clip = null;
- else
- clip = new Rectangle(g.getClipBounds());
+ clip = g.getClip();
if (g.transform == null)
- transform = new AffineTransform();
+ transform = null;
else
transform = new AffineTransform(g.transform);
@@ -257,7 +251,8 @@ public abstract class CairoGraphics2D extends Graphics2D
setBackground(bg);
setPaint(paint);
setStroke(stroke);
- setTransform(transform);
+ setTransformImpl(transform);
+ setClip(clip);
}
/**
@@ -275,8 +270,8 @@ public abstract class CairoGraphics2D extends Graphics2D
* they have additional native structures.
*/
public void dispose()
- {
- disposeNative();
+ {
+ disposeNative(nativePointer);
nativePointer = 0;
}
@@ -304,7 +299,7 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Dispose of allocate native resouces.
*/
- public native void disposeNative();
+ public native void disposeNative(long pointer);
/**
* Draw pixels as an RGBA int matrix
@@ -312,119 +307,125 @@ public abstract class CairoGraphics2D extends Graphics2D
* @param stride - stride of the array width
* @param i2u - affine transform array
*/
- private native void drawPixels(int[] pixels, int w, int h, int stride,
- double[] i2u);
+ private native void drawPixels(long pointer, int[] pixels, int w, int h,
+ int stride, double[] i2u, double alpha);
- private native void setGradient(double x1, double y1, double x2, double y2,
+ private native void setGradient(long pointer, double x1, double y1,
+ double x2, double y2,
int r1, int g1, int b1, int a1, int r2,
int g2, int b2, int a2, boolean cyclic);
- private native void setTexturePixels(int[] pixels, int w, int h, int stride);
+ private native void setTexturePixels(long pointer, int[] pixels, int w,
+ int h, int stride);
/**
* Set the current transform matrix
*/
- private native void cairoSetMatrix(double[] m);
+ private native void cairoSetMatrix(long pointer, double[] m);
/**
* Set the compositing operator
*/
- private native void cairoSetOperator(int cairoOperator);
+ private native void cairoSetOperator(long pointer, int cairoOperator);
/**
* Sets the current color in RGBA as a 0.0-1.0 double
*/
- private native void cairoSetRGBAColor(double red, double green,
+ private native void cairoSetRGBAColor(long pointer, double red, double green,
double blue, double alpha);
/**
* Sets the current winding rule in Cairo
*/
- private native void cairoSetFillRule(int cairoFillRule);
+ private native void cairoSetFillRule(long pointer, int cairoFillRule);
/**
* Set the line style, cap, join and miter limit.
* Cap and join parameters are in the BasicStroke enumerations.
*/
- private native void cairoSetLine(double width, int cap, int join, double miterLimit);
+ private native void cairoSetLine(long pointer, double width, int cap,
+ int join, double miterLimit);
/**
* Set the dash style
*/
- private native void cairoSetDash(double[] dashes, int ndash, double offset);
+ private native void cairoSetDash(long pointer, double[] dashes, int ndash,
+ double offset);
/*
* Draws a Glyph Vector
*/
- native void cairoDrawGlyphVector(GdkFontPeer font,
+ native void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
float x, float y, int n,
int[] codes, float[] positions);
- private native void cairoRelCurveTo(double dx1, double dy1, double dx2,
- double dy2, double dx3, double dy3);
+ private native void cairoRelCurveTo(long pointer, double dx1, double dy1,
+ double dx2, double dy2, double dx3,
+ double dy3);
/**
* Appends a rectangle to the current path
*/
- private native void cairoRectangle(double x, double y, double width,
- double height);
+ private native void cairoRectangle(long pointer, double x, double y,
+ double width, double height);
/**
* New current path
*/
- private native void cairoNewPath();
+ private native void cairoNewPath(long pointer);
/**
* Close current path
*/
- private native void cairoClosePath();
+ private native void cairoClosePath(long pointer);
/** moveTo */
- private native void cairoMoveTo(double x, double y);
+ private native void cairoMoveTo(long pointer, double x, double y);
/** relative moveTo */
- private native void cairoRelMoveTo(double dx, double dy);
+ private native void cairoRelMoveTo(long pointer, double dx, double dy);
/** lineTo */
- private native void cairoLineTo(double x, double y);
+ private native void cairoLineTo(long pointer, double x, double y);
/** relative lineTo */
- private native void cairoRelLineTo(double dx, double dy);
+ private native void cairoRelLineTo(long pointer, double dx, double dy);
/** Cubic curve-to */
- private native void cairoCurveTo(double x1, double y1, double x2, double y2,
+ private native void cairoCurveTo(long pointer, double x1, double y1,
+ double x2, double y2,
double x3, double y3);
/**
* Stroke current path
*/
- private native void cairoStroke();
+ private native void cairoStroke(long pointer);
/**
* Fill current path
*/
- private native void cairoFill();
+ private native void cairoFill(long pointer, double alpha);
/**
* Clip current path
*/
- private native void cairoClip();
+ private native void cairoClip(long pointer);
/**
* Save clip
*/
- private native void cairoPreserveClip();
+ private native void cairoPreserveClip(long pointer);
/**
* Save clip
*/
- private native void cairoResetClip();
+ private native void cairoResetClip(long pointer);
/**
* Set interpolation types
*/
- private native void cairoSurfaceSetFilter(int filter);
+ private native void cairoSurfaceSetFilter(long pointer, int filter);
///////////////////////// TRANSFORMS ///////////////////////////////////
/**
@@ -432,43 +433,60 @@ public abstract class CairoGraphics2D extends Graphics2D
*/
public void setTransform(AffineTransform tx)
{
+ // Transform clip into target space using the old transform.
+ updateClip(transform);
+
+ // Update the native transform.
+ setTransformImpl(tx);
+
+ // Transform the clip back into user space using the inverse new transform.
+ try
+ {
+ updateClip(transform.createInverse());
+ }
+ catch (NoninvertibleTransformException ex)
+ {
+ // TODO: How can we deal properly with this?
+ ex.printStackTrace();
+ }
+
+ if (clip != null)
+ setClip(clip);
+ }
+
+ private void setTransformImpl(AffineTransform tx)
+ {
transform = tx;
if (transform != null)
{
- double[] m = new double[6];
- transform.getMatrix(m);
- cairoSetMatrix(m);
+ double[] m = new double[6];
+ transform.getMatrix(m);
+ cairoSetMatrix(nativePointer, m);
}
}
-
+
public void transform(AffineTransform tx)
{
if (transform == null)
transform = new AffineTransform(tx);
else
transform.concatenate(tx);
- setTransform(transform);
+
if (clip != null)
{
- // FIXME: this should actuall try to transform the shape
- // rather than degrade to bounds.
- Rectangle2D r = clip.getBounds2D();
- double[] coords = new double[]
- {
- r.getX(), r.getY(), r.getX() + r.getWidth(),
- r.getY() + r.getHeight()
- };
- try
- {
- tx.createInverse().transform(coords, 0, coords, 0, 2);
- r.setRect(coords[0], coords[1], coords[2] - coords[0],
- coords[3] - coords[1]);
- clip = r;
- }
- catch (java.awt.geom.NoninvertibleTransformException e)
- {
- }
+ try
+ {
+ AffineTransform clipTransform = tx.createInverse();
+ updateClip(clipTransform);
+ }
+ catch (NoninvertibleTransformException ex)
+ {
+ // TODO: How can we deal properly with this?
+ ex.printStackTrace();
+ }
}
+
+ setTransformImpl(transform);
}
public void rotate(double theta)
@@ -501,18 +519,21 @@ public abstract class CairoGraphics2D extends Graphics2D
{
// FIXME: this should actuall try to transform the shape
// rather than degrade to bounds.
- Rectangle2D r;
-
if (clip instanceof Rectangle2D)
- r = (Rectangle2D) clip;
+ {
+ Rectangle2D r = (Rectangle2D) clip;
+ r.setRect(r.getX() - tx, r.getY() - ty, r.getWidth(),
+ r.getHeight());
+ }
else
- r = clip.getBounds2D();
-
- r.setRect(r.getX() - tx, r.getY() - ty, r.getWidth(), r.getHeight());
- clip = r;
+ {
+ AffineTransform clipTransform =
+ AffineTransform.getTranslateInstance(-tx, -ty);
+ updateClip(clipTransform);
+ }
}
- setTransform(transform);
+ setTransformImpl(transform);
}
public void translate(int x, int y)
@@ -531,19 +552,27 @@ public abstract class CairoGraphics2D extends Graphics2D
{
// Do not touch clip when s == null.
if (s == null)
- return;
+ {
+ // The spec says this should clear the clip. The reference
+ // implementation throws a NullPointerException instead. I think,
+ // in this case we should conform to the specs, as it shouldn't
+ // affect compatibility.
+ setClip(null);
+ return;
+ }
// If the current clip is still null, initialize it.
if (clip == null)
- clip = originalClip;
-
- // This is so common, let's optimize this.
- else if (clip instanceof Rectangle2D && s instanceof Rectangle2D)
+ {
+ clip = getRealBounds();
+ }
+
+ // This is so common, let's optimize this.
+ if (clip instanceof Rectangle2D && s instanceof Rectangle2D)
{
Rectangle2D clipRect = (Rectangle2D) clip;
Rectangle2D r = (Rectangle2D) s;
Rectangle2D.intersect(clipRect, r, clipRect);
- // Call setClip so that subclasses get notified.
setClip(clipRect);
}
else
@@ -603,7 +632,7 @@ public abstract class CairoGraphics2D extends Graphics2D
AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
BufferedImage texture = op.filter(img, null);
int[] pixels = texture.getRGB(0, 0, width, height, null, 0, width);
- setTexturePixels(pixels, width, height, width);
+ setTexturePixels(nativePointer, pixels, width, height, width);
}
else if (paint instanceof GradientPaint)
{
@@ -612,9 +641,10 @@ public abstract class CairoGraphics2D extends Graphics2D
Point2D p2 = gp.getPoint2();
Color c1 = gp.getColor1();
Color c2 = gp.getColor2();
- setGradient(p1.getX(), p1.getY(), p2.getX(), p2.getY(), c1.getRed(),
- c1.getGreen(), c1.getBlue(), c1.getAlpha(), c2.getRed(),
- c2.getGreen(), c2.getBlue(), c2.getAlpha(), gp.isCyclic());
+ setGradient(nativePointer, p1.getX(), p1.getY(), p2.getX(), p2.getY(),
+ c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha(),
+ c2.getRed(), c2.getGreen(), c2.getBlue(), c2.getAlpha(),
+ gp.isCyclic());
}
else
throw new java.lang.UnsupportedOperationException();
@@ -631,7 +661,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (stroke instanceof BasicStroke)
{
BasicStroke bs = (BasicStroke) stroke;
- cairoSetLine(bs.getLineWidth(), bs.getEndCap(),
+ cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(),
bs.getLineJoin(), bs.getMiterLimit());
float[] dashes = bs.getDashArray();
@@ -640,11 +670,11 @@ public abstract class CairoGraphics2D extends Graphics2D
double[] double_dashes = new double[dashes.length];
for (int i = 0; i < dashes.length; i++)
double_dashes[i] = dashes[i];
- cairoSetDash(double_dashes, double_dashes.length,
+ cairoSetDash(nativePointer, double_dashes, double_dashes.length,
(double) bs.getDashPhase());
}
else
- cairoSetDash(new double[0], 0, 0.0);
+ cairoSetDash(nativePointer, new double[0], 0, 0.0);
}
}
@@ -675,8 +705,9 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if (fg == null)
fg = Color.BLACK;
- cairoSetRGBAColor(fg.getRed() / 255.0, fg.getGreen() / 255.0,
- fg.getBlue() / 255.0, fg.getAlpha() / 255.0);
+ cairoSetRGBAColor(nativePointer, fg.getRed() / 255.0,
+ fg.getGreen() / 255.0,fg.getBlue() / 255.0,
+ fg.getAlpha() / 255.0);
}
public Color getColor()
@@ -686,15 +717,30 @@ public abstract class CairoGraphics2D extends Graphics2D
public void clipRect(int x, int y, int width, int height)
{
- clip(new Rectangle(x, y, width, height));
+ if (clip == null)
+ setClip(new Rectangle(x, y, width, height));
+ else if (clip instanceof Rectangle)
+ {
+ computeIntersection(x, y, width, height, (Rectangle) clip);
+ setClip(clip);
+ }
+ else
+ clip(new Rectangle(x, y, width, height));
}
public Shape getClip()
{
if (clip == null)
return null;
- else
+ else if (clip instanceof Rectangle2D)
return clip.getBounds2D(); //getClipInDevSpace();
+ else
+ {
+ GeneralPath p = new GeneralPath();
+ PathIterator pi = clip.getPathIterator(new AffineTransform());
+ p.append(pi, false);
+ return p;
+ }
}
public Rectangle getClipBounds()
@@ -734,7 +780,7 @@ public abstract class CairoGraphics2D extends Graphics2D
}
public void setClip(Shape s)
- {
+ {
// The first time the clip is set, save it as the original clip
// to reset to on s == null. We can rely on this being non-null
// because the constructor in subclasses is expected to set the
@@ -745,23 +791,23 @@ public abstract class CairoGraphics2D extends Graphics2D
firstClip = false;
}
- if (s == null)
- clip = originalClip;
- else
- clip = s;
-
- cairoResetClip();
+ clip = s;
+ cairoResetClip(nativePointer);
- cairoNewPath();
- if (clip instanceof Rectangle2D)
+ if (clip != null)
{
- Rectangle2D r = (Rectangle2D) clip;
- cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
+ cairoNewPath(nativePointer);
+ if (clip instanceof Rectangle2D)
+ {
+ Rectangle2D r = (Rectangle2D) clip;
+ cairoRectangle(nativePointer, r.getX(), r.getY(), r.getWidth(),
+ r.getHeight());
+ }
+ else
+ walkPath(clip.getPathIterator(null), false);
+
+ cairoClip(nativePointer);
}
- else
- walkPath(clip.getPathIterator(null), false);
-
- cairoClip();
}
public void setBackground(Color c)
@@ -797,10 +843,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if (comp instanceof AlphaComposite)
{
AlphaComposite a = (AlphaComposite) comp;
- cairoSetOperator(a.getRule());
- Color c = getColor();
- setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(),
- (int) (a.getAlpha() * ((float) c.getAlpha()))));
+ cairoSetOperator(nativePointer, a.getRule());
}
else
{
@@ -813,38 +856,55 @@ public abstract class CairoGraphics2D extends Graphics2D
public void draw(Shape s)
{
- if (stroke != null && ! (stroke instanceof BasicStroke))
+ if ((stroke != null && ! (stroke instanceof BasicStroke))
+ || (comp instanceof AlphaComposite
+ && ((AlphaComposite) comp).getAlpha() != 1.0))
{
+ // FIXME: This is a hack to work around BasicStrokes's current
+ // limitations wrt cubic curves.
+ // See CubicSegment.getDisplacedSegments().
+ if (stroke instanceof BasicStroke)
+ {
+ PathIterator flatten = s.getPathIterator(new AffineTransform(),
+ 1.0);
+ GeneralPath p = new GeneralPath();
+ p.append(flatten, false);
+ s = p;
+ }
fill(stroke.createStrokedShape(s));
return;
}
- cairoNewPath();
+ cairoNewPath(nativePointer);
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D) s;
- cairoRectangle(shifted(r.getX(), shiftDrawCalls),
+ cairoRectangle(nativePointer, shifted(r.getX(), shiftDrawCalls),
shifted(r.getY(), shiftDrawCalls), r.getWidth(),
r.getHeight());
}
else
walkPath(s.getPathIterator(null), shiftDrawCalls);
- cairoStroke();
+ cairoStroke(nativePointer);
}
public void fill(Shape s)
{
- cairoNewPath();
+ cairoNewPath(nativePointer);
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D) s;
- cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
+ cairoRectangle(nativePointer, r.getX(), r.getY(), r.getWidth(),
+ r.getHeight());
}
else
walkPath(s.getPathIterator(null), false);
- cairoFill();
+ double alpha = 1.0;
+ if (comp instanceof AlphaComposite)
+ alpha = ((AlphaComposite) comp).getAlpha();
+ cairoFill(nativePointer, alpha);
}
/**
@@ -856,8 +916,8 @@ public abstract class CairoGraphics2D extends Graphics2D
public void clearRect(int x, int y, int width, int height)
{
if (bg != null)
- cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
- bg.getBlue() / 255.0, 1.0);
+ cairoSetRGBAColor(nativePointer, bg.getRed() / 255.0,
+ bg.getGreen() / 255.0, bg.getBlue() / 255.0, 1.0);
fillRect(x, y, width, height);
updateColor();
}
@@ -1005,19 +1065,19 @@ public abstract class CairoGraphics2D extends Graphics2D
|| hintKey.equals(RenderingHints.KEY_ALPHA_INTERPOLATION))
{
if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
- cairoSurfaceSetFilter(0);
+ cairoSurfaceSetFilter(nativePointer, 0);
else if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
- cairoSurfaceSetFilter(1);
+ cairoSurfaceSetFilter(nativePointer, 1);
else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
- cairoSurfaceSetFilter(2);
+ cairoSurfaceSetFilter(nativePointer, 2);
else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
- cairoSurfaceSetFilter(3);
+ cairoSurfaceSetFilter(nativePointer, 3);
else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
- cairoSurfaceSetFilter(4);
+ cairoSurfaceSetFilter(nativePointer, 4);
}
shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
@@ -1037,22 +1097,22 @@ public abstract class CairoGraphics2D extends Graphics2D
if (hints.containsKey(RenderingHints.KEY_INTERPOLATION))
{
if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
- cairoSurfaceSetFilter(0);
+ cairoSurfaceSetFilter(nativePointer, 0);
else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
- cairoSurfaceSetFilter(1);
+ cairoSurfaceSetFilter(nativePointer, 1);
}
if (hints.containsKey(RenderingHints.KEY_ALPHA_INTERPOLATION))
{
if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
- cairoSurfaceSetFilter(2);
+ cairoSurfaceSetFilter(nativePointer, 2);
else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
- cairoSurfaceSetFilter(3);
+ cairoSurfaceSetFilter(nativePointer, 3);
else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
- cairoSurfaceSetFilter(4);
+ cairoSurfaceSetFilter(nativePointer, 4);
}
shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
@@ -1084,7 +1144,7 @@ public abstract class CairoGraphics2D extends Graphics2D
// other way around. Therefore to get the "user -> pixel" transform
// that cairo wants from "image -> user" transform that we currently
// have, we will need to invert the transformation matrix.
- AffineTransform invertedXform = new AffineTransform();
+ AffineTransform invertedXform;
try
{
@@ -1096,11 +1156,17 @@ public abstract class CairoGraphics2D extends Graphics2D
+ xform.toString());
}
- // Unrecognized image - convert to a BufferedImage and come back.
+ // Unrecognized image - convert to a BufferedImage
+ // Note - this can get us in trouble when the gdk lock is re-acquired.
+ // for example by VolatileImage. See ComponentGraphics for how we work
+ // around this.
if( !(img instanceof BufferedImage) )
- return this.drawImage(Toolkit.getDefaultToolkit().
- createImage(img.getSource()),
- xform, bgcolor, obs);
+ {
+ ImageProducer source = img.getSource();
+ if (source == null)
+ return false;
+ img = Toolkit.getDefaultToolkit().createImage(source);
+ }
BufferedImage b = (BufferedImage) img;
DataBuffer db;
@@ -1117,9 +1183,13 @@ public abstract class CairoGraphics2D extends Graphics2D
invertedXform.getMatrix(i2u);
+ double alpha = 1.0;
+ if (comp instanceof AlphaComposite)
+ alpha = ((AlphaComposite) comp).getAlpha();
+
if(db instanceof CairoSurface)
{
- ((CairoSurface)db).drawSurface(this, i2u);
+ ((CairoSurface)db).drawSurface(nativePointer, i2u, alpha);
return true;
}
@@ -1155,7 +1225,7 @@ public abstract class CairoGraphics2D extends Graphics2D
null, 0, width);
}
- drawPixels(pixels, width, height, width, i2u);
+ drawPixels(nativePointer, pixels, width, height, width, i2u, alpha);
// Cairo seems to lose the current color which must be restored.
updateColor();
@@ -1271,8 +1341,8 @@ public abstract class CairoGraphics2D extends Graphics2D
{
if (str == null || str.length() == 0)
return;
-
- drawGlyphVector(getFont().createGlyphVector(null, str), x, y);
+ (new TextLayout( str, getFont(), getFontRenderContext() )).
+ draw(this, x, y);
}
public void drawString(String str, int x, int y)
@@ -1287,12 +1357,25 @@ public abstract class CairoGraphics2D extends Graphics2D
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
- int n = gv.getNumGlyphs ();
- int[] codes = gv.getGlyphCodes (0, n, null);
- float[] positions = gv.getGlyphPositions (0, n, null);
-
- setFont (gv.getFont ());
- cairoDrawGlyphVector( (GdkFontPeer)getFont().getPeer(), x, y, n, codes, positions);
+ double alpha = 1.0;
+ if (comp instanceof AlphaComposite)
+ alpha = ((AlphaComposite) comp).getAlpha();
+ if (gv instanceof FreetypeGlyphVector && alpha == 1.0)
+ {
+ int n = gv.getNumGlyphs ();
+ int[] codes = gv.getGlyphCodes (0, n, null);
+ float[] positions = gv.getGlyphPositions (0, n, null);
+
+ setFont (gv.getFont ());
+ cairoDrawGlyphVector(nativePointer, (GdkFontPeer)getFont().getPeer(),
+ x, y, n, codes, positions);
+ }
+ else
+ {
+ translate(x, y);
+ fill(gv.getOutline());
+ translate(-x, -y);
+ }
}
public void drawString(AttributedCharacterIterator ci, float x, float y)
@@ -1445,7 +1528,11 @@ public abstract class CairoGraphics2D extends Graphics2D
for (int i = 0; i < pixels.length; i++)
pixels[i] |= 0xFF000000;
- drawPixels(pixels, r.getWidth(), r.getHeight(), r.getWidth(), i2u);
+ double alpha = 1.0;
+ if (comp instanceof AlphaComposite)
+ alpha = ((AlphaComposite) comp).getAlpha();
+ drawPixels(nativePointer, pixels, r.getWidth(), r.getHeight(),
+ r.getWidth(), i2u, alpha);
// Cairo seems to lose the current color which must be restored.
updateColor();
@@ -1473,7 +1560,7 @@ public abstract class CairoGraphics2D extends Graphics2D
double y = 0;
double[] coords = new double[6];
- cairoSetFillRule(p.getWindingRule());
+ cairoSetFillRule(nativePointer, p.getWindingRule());
for (; ! p.isDone(); p.next())
{
int seg = p.currentSegment(coords);
@@ -1482,12 +1569,12 @@ public abstract class CairoGraphics2D extends Graphics2D
case PathIterator.SEG_MOVETO:
x = shifted(coords[0], doShift);
y = shifted(coords[1], doShift);
- cairoMoveTo(x, y);
+ cairoMoveTo(nativePointer, x, y);
break;
case PathIterator.SEG_LINETO:
x = shifted(coords[0], doShift);
y = shifted(coords[1], doShift);
- cairoLineTo(x, y);
+ cairoLineTo(nativePointer, x, y);
break;
case PathIterator.SEG_QUADTO:
// splitting a quadratic bezier into a cubic:
@@ -1500,18 +1587,18 @@ public abstract class CairoGraphics2D extends Graphics2D
x = shifted(coords[2], doShift);
y = shifted(coords[3], doShift);
- cairoCurveTo(x1, y1, x2, y2, x, y);
+ cairoCurveTo(nativePointer, x1, y1, x2, y2, x, y);
break;
case PathIterator.SEG_CUBICTO:
x = shifted(coords[4], doShift);
y = shifted(coords[5], doShift);
- cairoCurveTo(shifted(coords[0], doShift),
+ cairoCurveTo(nativePointer, shifted(coords[0], doShift),
shifted(coords[1], doShift),
shifted(coords[2], doShift),
shifted(coords[3], doShift), x, y);
break;
case PathIterator.SEG_CLOSE:
- cairoClosePath();
+ cairoClosePath(nativePointer);
break;
}
}
@@ -1583,4 +1670,47 @@ public abstract class CairoGraphics2D extends Graphics2D
return db.getData();
}
+
+ /**
+ * Helper method to transform the clip. This is called by the various
+ * transformation-manipulation methods to update the clip (which is in
+ * userspace) accordingly.
+ *
+ * The transform usually is the inverse transform that was applied to the
+ * graphics object.
+ *
+ * @param t the transform to apply to the clip
+ */
+ private void updateClip(AffineTransform t)
+ {
+ if (clip == null)
+ return;
+
+ if (! (clip instanceof GeneralPath))
+ clip = new GeneralPath(clip);
+
+ GeneralPath p = (GeneralPath) clip;
+ p.transform(t);
+ }
+
+ private static Rectangle computeIntersection(int x, int y, int w, int h,
+ Rectangle rect)
+ {
+ int x2 = (int) rect.x;
+ int y2 = (int) rect.y;
+ int w2 = (int) rect.width;
+ int h2 = (int) rect.height;
+
+ int dx = (x > x2) ? x : x2;
+ int dy = (y > y2) ? y : y2;
+ int dw = (x + w < x2 + w2) ? (x + w - dx) : (x2 + w2 - dx);
+ int dh = (y + h < y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
+
+ if (dw >= 0 && dh >= 0)
+ rect.setBounds(dx, dy, dw, dh);
+ else
+ rect.setBounds(0, 0, 0, 0);
+
+ return rect;
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
index e19c9b99253..5ccd2e14eb9 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
@@ -88,49 +88,65 @@ public class CairoSurface extends DataBuffer
/**
* Allocates and clears the buffer and creates the cairo surface.
* @param width, height - the image size
- * @param stride - the buffer row stride.
+ * @param stride - the buffer row stride. (in ints)
*/
private native void create(int width, int height, int stride);
/**
* Destroys the cairo surface and frees the buffer.
*/
- private native void destroy();
+ private native void destroy(long surfacePointer, long bufferPointer);
/**
* Gets buffer elements
*/
- private native int nativeGetElem(int i);
+ private native int nativeGetElem(long bufferPointer, int i);
/**
* Sets buffer elements.
*/
- private native void nativeSetElem(int i, int val);
+ private native void nativeSetElem(long bufferPointer, int i, int val);
/**
* Draws this image to a given CairoGraphics context,
* with an affine transform given by i2u.
*/
- public native void drawSurface(CairoGraphics2D context, double[] i2u);
+ public native void nativeDrawSurface(long surfacePointer, long contextPointer,
+ double[] i2u, double alpha);
+
+ public void drawSurface(long contextPointer, double[] i2u, double alpha)
+ {
+ nativeDrawSurface(surfacePointer, contextPointer, i2u, alpha);
+ }
/**
* getPixels -return the pixels as a java array.
*/
- native int[] getPixels(int size);
+ native int[] nativeGetPixels(long bufferPointer, int size);
+
+ public int[] getPixels(int size)
+ {
+ return nativeGetPixels(bufferPointer, size);
+ }
/**
* getPixels -return the pixels as a java array.
*/
- native void setPixels(int[] pixels);
+ native void nativeSetPixels(long bufferPointer, int[] pixels);
+
+ public void setPixels(int[] pixels)
+ {
+ nativeSetPixels(bufferPointer, pixels);
+ }
- native long getFlippedBuffer(int size);
+ native long getFlippedBuffer(long bufferPointer, int size);
/**
* Create a cairo_surface_t with specified width and height.
* The format will be ARGB32 with premultiplied alpha and native bit
* and word ordering.
*/
- CairoSurface(int width, int height)
+ public CairoSurface(int width, int height)
{
super(DataBuffer.TYPE_INT, width * height);
@@ -140,7 +156,7 @@ public class CairoSurface extends DataBuffer
this.width = width;
this.height = height;
- create(width, height, width * 4);
+ create(width, height, width);
if(surfacePointer == 0 || bufferPointer == 0)
throw new Error("Could not allocate bitmap.");
@@ -160,7 +176,7 @@ public class CairoSurface extends DataBuffer
width = image.width;
height = image.height;
- create(width, height, width * 4);
+ create(width, height, width);
if(surfacePointer == 0 || bufferPointer == 0)
throw new Error("Could not allocate bitmap.");
@@ -195,7 +211,7 @@ public class CairoSurface extends DataBuffer
public void dispose()
{
if(surfacePointer != 0)
- destroy();
+ destroy(surfacePointer, bufferPointer);
}
/**
@@ -211,7 +227,8 @@ public class CairoSurface extends DataBuffer
*/
public GtkImage getGtkImage()
{
- return new GtkImage( width, height, getFlippedBuffer( width * height ));
+ return new GtkImage( width, height,
+ getFlippedBuffer(bufferPointer, width * height ));
}
/**
@@ -251,7 +268,7 @@ public class CairoSurface extends DataBuffer
{
if(bank != 0 || i < 0 || i >= width*height)
throw new IndexOutOfBoundsException(i+" size: "+width*height);
- return nativeGetElem(i);
+ return nativeGetElem(bufferPointer, i);
}
/**
@@ -261,7 +278,7 @@ public class CairoSurface extends DataBuffer
{
if(bank != 0 || i < 0 || i >= width*height)
throw new IndexOutOfBoundsException(i+" size: "+width*height);
- nativeSetElem(i, val);
+ nativeSetElem(bufferPointer, i, val);
}
/**
@@ -277,12 +294,22 @@ public class CairoSurface extends DataBuffer
* Creates a cairo_t drawing context, returns the pointer as a long.
* Used by CairoSurfaceGraphics.
*/
- native long newCairoContext();
+ native long nativeNewCairoContext(long surfacePointer);
+
+ public long newCairoContext()
+ {
+ return nativeNewCairoContext(surfacePointer);
+ }
/**
* Copy an area of the surface. Expects parameters must be within bounds.
* Count on a segfault otherwise.
*/
- native void copyAreaNative(int x, int y, int width, int height,
- int dx, int dy, int stride);
+ native void copyAreaNative2(long bufferPointer, int x, int y, int width,
+ int height, int dx, int dy, int stride);
+ public void copyAreaNative(int x, int y, int width,
+ int height, int dx, int dy, int stride)
+ {
+ copyAreaNative2(bufferPointer, x, y, width, height, dx, dy, stride);
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java
index 38c549d1de5..91f0b4981df 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java
@@ -40,6 +40,7 @@ package gnu.java.awt.peer.gtk;
import java.awt.Graphics;
import java.awt.Color;
+import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Point;
import java.awt.Graphics2D;
@@ -63,7 +64,6 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
this.surface = surface;
cairo_t = surface.newCairoContext();
setup( cairo_t );
- setClip(0, 0, surface.width, surface.height);
}
/**
@@ -75,7 +75,6 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
surface = copyFrom.surface;
cairo_t = surface.newCairoContext();
copy( copyFrom, cairo_t );
- setClip(0, 0, surface.width, surface.height);
}
public Graphics create()
@@ -85,7 +84,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D
public GraphicsConfiguration getDeviceConfiguration()
{
- throw new UnsupportedOperationException();
+ return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}
protected Rectangle2D getRealBounds()
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
index c6cf4948c00..d1d3c280454 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
@@ -46,6 +46,7 @@ import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.awt.Toolkit;
import java.awt.Point;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
@@ -53,6 +54,7 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
import java.awt.image.ImagingOpException;
import java.awt.image.RenderedImage;
@@ -67,6 +69,35 @@ public class ComponentGraphics extends CairoGraphics2D
private GtkComponentPeer component;
protected long cairo_t;
+ private static ThreadLocal hasLock = new ThreadLocal();
+ private static Integer ONE = Integer.valueOf(1);
+
+ private void lock()
+ {
+ Integer i = (Integer) hasLock.get();
+ if (i == null)
+ {
+ start_gdk_drawing();
+ hasLock.set(ONE);
+ }
+ else
+ hasLock.set(Integer.valueOf(i.intValue() + 1));
+ }
+
+ private void unlock()
+ {
+ Integer i = (Integer) hasLock.get();
+ if (i == null)
+ throw new IllegalStateException();
+ if (i == ONE)
+ {
+ hasLock.set(null);
+ end_gdk_drawing();
+ }
+ else
+ hasLock.set(Integer.valueOf(i.intValue() - 1));
+ }
+
ComponentGraphics()
{
}
@@ -104,8 +135,8 @@ public class ComponentGraphics extends CairoGraphics2D
*/
public void dispose()
{
- disposeSurface(nativePointer);
super.dispose();
+ disposeSurface(nativePointer);
}
/**
@@ -138,7 +169,7 @@ public class ComponentGraphics extends CairoGraphics2D
int width, int height, int dx, int dy);
private native void drawVolatile(GtkComponentPeer component,
- Image vimg, int x, int y,
+ long vimg, int x, int y,
int width, int height);
/**
@@ -180,63 +211,152 @@ public class ComponentGraphics extends CairoGraphics2D
*/
public void draw(Shape s)
{
- start_gdk_drawing();
- super.draw(s);
- end_gdk_drawing();
+ lock();
+ try
+ {
+ super.draw(s);
+ }
+ finally
+ {
+ unlock();
+ }
}
public void fill(Shape s)
{
- start_gdk_drawing();
- super.fill(s);
- end_gdk_drawing();
+ lock();
+ try
+ {
+ super.fill(s);
+ }
+ finally
+ {
+ unlock();
+ }
}
public void drawRenderedImage(RenderedImage image, AffineTransform xform)
{
- start_gdk_drawing();
- super.drawRenderedImage(image, xform);
- end_gdk_drawing();
+ lock();
+ try
+ {
+ super.drawRenderedImage(image, xform);
+ }
+ finally
+ {
+ unlock();
+ }
}
protected boolean drawImage(Image img, AffineTransform xform,
Color bgcolor, ImageObserver obs)
{
- start_gdk_drawing();
- boolean rv = super.drawImage(img, xform, bgcolor, obs);
- end_gdk_drawing();
+ boolean rv;
+ lock();
+ try
+ {
+ rv = super.drawImage(img, xform, bgcolor, obs);
+ }
+ finally
+ {
+ unlock();
+ }
return rv;
}
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
- start_gdk_drawing();
- super.drawGlyphVector(gv, x, y);
- end_gdk_drawing();
+ lock();
+ try
+ {
+ super.drawGlyphVector(gv, x, y);
+ }
+ finally
+ {
+ unlock();
+ }
}
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
{
- if( img instanceof GtkVolatileImage )
+ // If it is a GtkVolatileImage with an "easy" transform then
+ // draw directly. Always pass a BufferedImage to super to avoid
+ // deadlock (see Note in CairoGraphics.drawImage()).
+ if (img instanceof GtkVolatileImage)
{
- drawVolatile( component, img, x, y - 20,
- ((GtkVolatileImage)img).width,
- ((GtkVolatileImage)img).height );
- return true;
- }
- return super.drawImage( img, x, y, observer );
+ GtkVolatileImage vimg = (GtkVolatileImage) img;
+ int type = transform.getType();
+ if (type == AffineTransform.TYPE_IDENTITY)
+ {
+ drawVolatile(component, vimg.nativePointer,
+ x, y, vimg.width, vimg.height);
+ return true;
+ }
+ else if (type == AffineTransform.TYPE_TRANSLATION)
+ {
+ x += transform.getTranslateX();
+ y += transform.getTranslateY();
+ drawVolatile(component, vimg.nativePointer,
+ x, y, vimg.width, vimg.height);
+ return true;
+ }
+ else
+ return super.drawImage(vimg.getSnapshot(), x, y, observer);
+ }
+
+ BufferedImage bimg;
+ if (img instanceof BufferedImage)
+ bimg = (BufferedImage) img;
+ else
+ {
+ ImageProducer source = img.getSource();
+ if (source == null)
+ return false;
+ bimg = (BufferedImage) Toolkit.getDefaultToolkit().createImage(source);
+ }
+ return super.drawImage(bimg, x, y, observer);
}
public boolean drawImage(Image img, int x, int y, int width, int height,
ImageObserver observer)
{
- if( img instanceof GtkVolatileImage )
+ // If it is a GtkVolatileImage with an "easy" transform then
+ // draw directly. Always pass a BufferedImage to super to avoid
+ // deadlock (see Note in CairoGraphics.drawImage()).
+ if (img instanceof GtkVolatileImage)
+ {
+ GtkVolatileImage vimg = (GtkVolatileImage) img;
+ int type = transform.getType();
+ if (type == AffineTransform.TYPE_IDENTITY)
+ {
+ drawVolatile(component, vimg.nativePointer,
+ x, y, width, height);
+ return true;
+ }
+ else if (type == AffineTransform.TYPE_TRANSLATION)
+ {
+ x += transform.getTranslateX();
+ y += transform.getTranslateY();
+ drawVolatile(component, vimg.nativePointer,
+ x, y, width, height);
+ return true;
+ }
+ else
+ return super.drawImage(vimg.getSnapshot(), x, y,
+ width, height, observer);
+ }
+
+ BufferedImage bimg;
+ if (img instanceof BufferedImage)
+ bimg = (BufferedImage) img;
+ else
{
- drawVolatile( component, img, x, y - 20,
- width, height );
- return true;
- }
- return super.drawImage( img, x, y, width, height, observer );
+ ImageProducer source = img.getSource();
+ if (source == null)
+ return false;
+ bimg = (BufferedImage) Toolkit.getDefaultToolkit().createImage(source);
+ }
+ return super.drawImage(bimg, x, y, width, height, observer);
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java b/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
index 0f8ce6dadef..4978c6a4557 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
@@ -56,6 +56,9 @@ public class FreetypeGlyphVector extends GlyphVector
private Font font;
private GdkFontPeer peer; // ATTN: Accessed from native code.
+ private Rectangle2D logicalBounds;
+
+ private float[] glyphPositions;
/**
* The string represented by this GlyphVector.
*/
@@ -81,11 +84,22 @@ public class FreetypeGlyphVector extends GlyphVector
*/
private AffineTransform[] glyphTransforms;
+ private GlyphMetrics[] metricsCache;
+
/**
* Create a glyphvector from a given (Freetype) font and a String.
*/
public FreetypeGlyphVector(Font f, String s, FontRenderContext frc)
{
+ this(f, s, frc, Font.LAYOUT_LEFT_TO_RIGHT);
+ }
+
+ /**
+ * Create a glyphvector from a given (Freetype) font and a String.
+ */
+ public FreetypeGlyphVector(Font f, String s, FontRenderContext frc,
+ int flags)
+ {
this.s = s;
this.font = f;
this.frc = frc;
@@ -94,6 +108,14 @@ public class FreetypeGlyphVector extends GlyphVector
peer = (GdkFontPeer)font.getPeer();
getGlyphs();
+ if( flags == Font.LAYOUT_RIGHT_TO_LEFT )
+ {
+ // reverse the glyph ordering.
+ int[] temp = new int[ nGlyphs ];
+ for(int i = 0; i < nGlyphs; i++)
+ temp[ i ] = glyphCodes[ nGlyphs - i - 1];
+ glyphCodes = temp;
+ }
performDefaultLayout();
}
@@ -121,21 +143,25 @@ public class FreetypeGlyphVector extends GlyphVector
{
nGlyphs = s.codePointCount( 0, s.length() );
glyphCodes = new int[ nGlyphs ];
+ int[] codePoints = new int[ nGlyphs ];
int stringIndex = 0;
+
for(int i = 0; i < nGlyphs; i++)
{
- glyphCodes[i] = getGlyph( s.codePointAt(stringIndex) );
+ codePoints[i] = s.codePointAt( stringIndex );
// UTF32 surrogate handling
- if( s.codePointAt( stringIndex ) != (int)s.charAt( stringIndex ) )
+ if( codePoints[i] != (int)s.charAt( stringIndex ) )
stringIndex ++;
stringIndex ++;
}
+
+ glyphCodes = getGlyphs( codePoints );
}
/**
* Returns the glyph code within the font for a given character
*/
- public native int getGlyph(int codepoint);
+ public native int[] getGlyphs(int[] codepoints);
/**
* Returns the kerning of a glyph pair
@@ -180,12 +206,15 @@ public class FreetypeGlyphVector extends GlyphVector
*/
public void performDefaultLayout()
{
+ logicalBounds = null; // invalidate caches.
+ glyphPositions = null;
+
glyphTransforms = new AffineTransform[ nGlyphs ];
double x = 0;
+
for(int i = 0; i < nGlyphs; i++)
{
GlyphMetrics gm = getGlyphMetrics( i );
- Rectangle2D r = gm.getBounds2D();
glyphTransforms[ i ] = AffineTransform.getTranslateInstance(x, 0);
x += gm.getAdvanceX();
if( i > 0 )
@@ -235,19 +264,48 @@ public class FreetypeGlyphVector extends GlyphVector
gm.getAdvanceX(), r.getHeight() );
}
+ /*
+ * FIXME: Not all glyph types are supported.
+ * (The JDK doesn't really seem to do so either)
+ */
+ public void setupGlyphMetrics()
+ {
+ metricsCache = new GlyphMetrics[ nGlyphs ];
+
+ for(int i = 0; i < nGlyphs; i++)
+ {
+ GlyphMetrics gm = (GlyphMetrics)
+ peer.getGlyphMetrics( glyphCodes[ i ] );
+ if( gm == null )
+ {
+ double[] val = getMetricsNative( glyphCodes[ i ] );
+ if( val == null )
+ gm = null;
+ else
+ {
+ gm = new GlyphMetrics( true,
+ (float)val[1],
+ (float)val[2],
+ new Rectangle2D.Double
+ ( val[3], val[4],
+ val[5], val[6] ),
+ GlyphMetrics.STANDARD );
+ peer.putGlyphMetrics( glyphCodes[ i ], gm );
+ }
+ }
+ metricsCache[ i ] = gm;
+ }
+ }
+
/**
* Returns the metrics of a single glyph.
*/
public GlyphMetrics getGlyphMetrics(int glyphIndex)
{
- double[] val = getMetricsNative( glyphCodes[ glyphIndex ] );
- if( val == null )
- return null;
-
- return new GlyphMetrics( true, (float)val[1], (float)val[2],
- new Rectangle2D.Double( val[3], val[4],
- val[5], val[6] ),
- GlyphMetrics.STANDARD );
+ if( metricsCache == null )
+ setupGlyphMetrics();
+
+ return metricsCache[ glyphIndex ];
}
/**
@@ -275,6 +333,9 @@ public class FreetypeGlyphVector extends GlyphVector
public float[] getGlyphPositions(int beginGlyphIndex, int numEntries,
float[] positionReturn)
{
+ if( glyphPositions != null )
+ return glyphPositions;
+
float[] rval;
if( positionReturn == null )
@@ -289,6 +350,7 @@ public class FreetypeGlyphVector extends GlyphVector
rval[i * 2 + 1] = (float)p.getY();
}
+ glyphPositions = rval;
return rval;
}
@@ -316,11 +378,19 @@ public class FreetypeGlyphVector extends GlyphVector
{
if( nGlyphs == 0 )
return new Rectangle2D.Double(0, 0, 0, 0);
+ if( logicalBounds != null )
+ return logicalBounds;
Rectangle2D rect = (Rectangle2D)getGlyphLogicalBounds( 0 );
for( int i = 1; i < nGlyphs; i++ )
- rect = rect.createUnion( (Rectangle2D)getGlyphLogicalBounds( i ) );
+ {
+ Rectangle2D r2 = (Rectangle2D)getGlyphLogicalBounds( i );
+ Point2D p = getGlyphPosition( i );
+ r2.setRect( p.getX(), p.getY(), r2.getWidth(), r2.getHeight() );
+ rect = rect.createUnion( r2 );
+ }
+ logicalBounds = rect;
return rect;
}
@@ -360,7 +430,9 @@ public class FreetypeGlyphVector extends GlyphVector
public Shape getOutline(float x, float y)
{
AffineTransform tx = AffineTransform.getTranslateInstance( x, y );
- return tx.createTransformedShape( getOutline() );
+ GeneralPath gp = (GeneralPath)getOutline();
+ gp.transform( tx );
+ return gp;
}
/**
@@ -380,6 +452,8 @@ public class FreetypeGlyphVector extends GlyphVector
// FIXME: Scaling, etc.?
glyphTransforms[ glyphIndex ].setToTranslation( newPos.getX(),
newPos.getY() );
+ logicalBounds = null;
+ glyphPositions = null;
}
/**
@@ -388,5 +462,7 @@ public class FreetypeGlyphVector extends GlyphVector
public void setGlyphTransform(int glyphIndex, AffineTransform newTX)
{
glyphTransforms[ glyphIndex ].setTransform( newTX );
+ logicalBounds = null;
+ glyphPositions = null;
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
index 7aa5e7a1271..f5ed8a71010 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
@@ -57,12 +57,18 @@ import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.nio.ByteBuffer;
+import java.util.HashMap;
public class GdkFontPeer extends ClasspathFontPeer
{
static native void initStaticState();
private final int native_state = GtkGenericPeer.getUniqueInteger ();
private static ResourceBundle bundle;
+
+ /**
+ * Cache GlyphMetrics objects.
+ */
+ private HashMap metricsCache;
static
{
@@ -145,6 +151,7 @@ public class GdkFontPeer extends ClasspathFontPeer
super(name, style, size);
initState ();
setFont (this.familyName, this.style, (int)this.size);
+ metricsCache = new HashMap();
}
public GdkFontPeer (String name, Map attributes)
@@ -152,6 +159,7 @@ public class GdkFontPeer extends ClasspathFontPeer
super(name, attributes);
initState ();
setFont (this.familyName, this.style, (int)this.size);
+ metricsCache = new HashMap();
}
/**
@@ -252,18 +260,25 @@ public class GdkFontPeer extends ClasspathFontPeer
public byte getBaselineFor (Font font, char c)
{
- throw new UnsupportedOperationException ();
+ // FIXME: Actually check.
+ return Font.ROMAN_BASELINE;
}
- protected class GdkFontLineMetrics extends LineMetrics
+ private static class GdkFontLineMetrics extends LineMetrics
{
- FontMetrics fm;
- int nchars;
+ private FontMetrics fm;
+ private int nchars;
+ private float strikethroughOffset, strikethroughThickness,
+ underlineOffset, underlineThickness;
- public GdkFontLineMetrics (FontMetrics m, int n)
+ public GdkFontLineMetrics (GdkFontPeer fp, FontMetrics m, int n)
{
fm = m;
nchars = n;
+ strikethroughOffset = 0f;
+ underlineOffset = 0f;
+ strikethroughThickness = ((float)fp.getSize(null)) / 12f;
+ underlineThickness = strikethroughThickness;
}
public float getAscent()
@@ -272,7 +287,8 @@ public class GdkFontPeer extends ClasspathFontPeer
}
public int getBaselineIndex()
- {
+ {
+ // FIXME
return Font.ROMAN_BASELINE;
}
@@ -303,7 +319,7 @@ public class GdkFontPeer extends ClasspathFontPeer
public LineMetrics getLineMetrics (Font font, CharacterIterator ci,
int begin, int limit, FontRenderContext rc)
{
- return new GdkFontLineMetrics (getFontMetrics (font), limit - begin);
+ return new GdkFontLineMetrics (this, getFontMetrics (font), limit - begin);
}
public Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc)
@@ -350,20 +366,15 @@ public class GdkFontPeer extends ClasspathFontPeer
char[] chars, int start, int limit,
int flags)
{
- int nchars = (limit - start) + 1;
- char[] nc = new char[nchars];
-
- for (int i = 0; i < nchars; ++i)
- nc[i] = chars[start + i];
-
- return createGlyphVector (font, frc,
- new StringCharacterIterator (new String (nc)));
+ return new FreetypeGlyphVector( font, new String( chars, start,
+ limit - start),
+ frc, flags);
}
public LineMetrics getLineMetrics (Font font, String str,
FontRenderContext frc)
{
- return new GdkFontLineMetrics (getFontMetrics (font), str.length ());
+ return new GdkFontLineMetrics (this, getFontMetrics (font), str.length ());
}
public FontMetrics getFontMetrics (Font font)
@@ -372,4 +383,21 @@ public class GdkFontPeer extends ClasspathFontPeer
// the metrics cache.
return Toolkit.getDefaultToolkit().getFontMetrics (font);
}
+
+ /**
+ * Returns a cached GlyphMetrics object for a given glyphcode,
+ * or null if it doesn't exist in the cache.
+ */
+ GlyphMetrics getGlyphMetrics( int glyphCode )
+ {
+ return (GlyphMetrics)metricsCache.get( new Integer( glyphCode ) );
+ }
+
+ /**
+ * Put a GlyphMetrics object in the cache.
+ */
+ void putGlyphMetrics( int glyphCode, Object metrics )
+ {
+ metricsCache.put( new Integer( glyphCode ), metrics );
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
index 4e6181f0e58..cd047f26715 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
@@ -103,8 +103,15 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
native void pumpBytes (byte[] bytes, int len) throws IOException;
native void pumpDone () throws IOException;
native void finish (boolean needsClose);
- static native void streamImage(int[] bytes, String format, int width, int height, boolean hasAlpha, DataOutput sink);
-
+
+ /**
+ * Converts given image to bytes.
+ * Will call the GdkPixbufWriter for each chunk.
+ */
+ static native void streamImage(int[] bytes, String format,
+ int width, int height,
+ boolean hasAlpha, GdkPixbufWriter writer);
+
// gdk-pixbuf provids data in RGBA format
static final ColorModel cm = new DirectColorModel (32, 0xff000000,
0x00ff0000,
@@ -461,7 +468,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
}
private static class GdkPixbufWriter
- extends ImageWriter
+ extends ImageWriter implements Runnable
{
String ext;
public GdkPixbufWriter(GdkPixbufWriterSpi ownerSpi, Object ext)
@@ -519,14 +526,106 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
model = img.getColorModel();
}
+ Thread workerThread = new Thread(this, "GdkPixbufWriter");
+ workerThread.start();
processImageStarted(1);
synchronized(pixbufLock)
{
streamImage(pixels, this.ext, width, height, model.hasAlpha(),
- (DataOutput) this.getOutput());
+ this);
}
+ synchronized(data)
+ {
+ data.add(DATADONE);
+ data.notifyAll();
+ }
+
+ while (workerThread.isAlive())
+ {
+ try
+ {
+ workerThread.join();
+ }
+ catch (InterruptedException ioe)
+ {
+ // Ignored.
+ }
+ }
+
+ if (exception != null)
+ throw exception;
+
processImageComplete();
}
+
+ /**
+ * Object marking end of data from native streamImage code.
+ */
+ private static final Object DATADONE = new Object();
+
+ /**
+ * Holds the data gotten from the native streamImage code.
+ * A worker thread will pull data out.
+ * Needs to be synchronized for access.
+ * The special object DATADONE is added when all data has been delivered.
+ */
+ private ArrayList data = new ArrayList();
+
+ /**
+ * Holds any IOException thrown by the run method that needs
+ * to be rethrown by the write method.
+ */
+ private IOException exception;
+
+ /** Callback for streamImage native code. **/
+ private void write(byte[] bs)
+ {
+ synchronized(data)
+ {
+ data.add(bs);
+ data.notifyAll();
+ }
+ }
+
+ public void run()
+ {
+ boolean done = false;
+ while (!done)
+ {
+ synchronized(data)
+ {
+ while (data.isEmpty())
+ {
+ try
+ {
+ data.wait();
+ }
+ catch (InterruptedException ie)
+ {
+ /* ignore */
+ }
+ }
+
+ Object o = data.remove(0);
+ if (o == DATADONE)
+ done = true;
+ else
+ {
+ DataOutput out = (DataOutput) getOutput();
+ try
+ {
+ out.write((byte[]) o);
+ }
+ catch (IOException ioe)
+ {
+ // We are only interested in the first exception.
+ if (exception == null)
+ exception = ioe;
+ }
+ }
+ }
+ }
+ }
}
private static class GdkPixbufReader
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
index d6b3de8c07f..a8765222e0e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
@@ -1,5 +1,5 @@
/* GdkTextLayout.java
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -84,7 +84,7 @@ public class GdkTextLayout
private native void dispose ();
- private native void cairoDrawGdkTextLayout(CairoGraphics2D g, float x, float y);
+ private native void cairoDrawGdkTextLayout(long cg2d, float x, float y);
static native void initStaticState();
@@ -216,7 +216,7 @@ public class GdkTextLayout
public void draw (Graphics2D g2, float x, float y)
{
- cairoDrawGdkTextLayout((CairoGraphics2D)g2, x, y);
+ cairoDrawGdkTextLayout(((CairoGraphics2D) g2).nativePointer, x, y);
}
public TextHitInfo getStrongCaret (TextHitInfo hit1,
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java
index 53bcd739d9e..f38007f19d1 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java
@@ -57,14 +57,28 @@ public class GtkVolatileImage extends VolatileImage
native long init(GtkComponentPeer component, int width, int height);
- native void destroy();
+ native void destroy(long pointer);
- native int[] getPixels();
+ native int[] nativeGetPixels(long pointer);
+ public int[] getPixels()
+ {
+ return nativeGetPixels(nativePointer);
+ }
+
+ native void nativeCopyArea(long pointer, int x, int y, int w, int h, int dx,
+ int dy );
+ public void copyArea(int x, int y, int w, int h, int dx, int dy)
+ {
+ nativeCopyArea(nativePointer, x, y, w, h, dx, dy);
+ }
- native void copyArea( int x, int y, int w, int h, int dx, int dy );
+ native void nativeDrawVolatile(long pointer, long srcPtr, int x, int y,
+ int w, int h );
+ public void drawVolatile(long srcPtr, int x, int y, int w, int h )
+ {
+ nativeDrawVolatile(nativePointer, srcPtr, x, y, w, h);
+ }
- native void drawVolatile( long ptr, int x, int y, int w, int h );
-
public GtkVolatileImage(GtkComponentPeer component,
int width, int height, ImageCapabilities caps)
{
@@ -91,7 +105,7 @@ public class GtkVolatileImage extends VolatileImage
public void dispose()
{
- destroy();
+ destroy(nativePointer);
}
public BufferedImage getSnapshot()
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java
index d5adfcf7757..fa84ea0c797 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java
@@ -67,14 +67,12 @@ public class VolatileImageGraphics extends ComponentGraphics
this.owner = img;
cairo_t = initFromVolatile( owner.nativePointer, img.width, img.height );
setup( cairo_t );
- setClip( new Rectangle( 0, 0, img.width, img.height) );
}
private VolatileImageGraphics(VolatileImageGraphics copy)
{
this.owner = copy.owner;
- initFromVolatile( owner.nativePointer, owner.width, owner.height );
- setClip( new Rectangle( 0, 0, owner.width, owner.height) );
+ cairo_t = initFromVolatile(owner.nativePointer, owner.width, owner.height);
copy( copy, cairo_t );
}
@@ -118,5 +116,10 @@ public class VolatileImageGraphics extends ComponentGraphics
}
return super.drawImage( img, x, y, width, height, observer );
}
+
+ protected Rectangle2D getRealBounds()
+ {
+ return new Rectangle2D.Double(0, 0, owner.width, owner.height);
+ }
}
diff --git a/libjava/classpath/gnu/java/net/IndexListParser.java b/libjava/classpath/gnu/java/net/IndexListParser.java
new file mode 100644
index 00000000000..23d2aa660cb
--- /dev/null
+++ b/libjava/classpath/gnu/java/net/IndexListParser.java
@@ -0,0 +1,177 @@
+/* IndexListParser.java --
+ Copyright (C) 2006 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.net;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.jar.JarFile;
+
+/**
+ * The INDEX.LIST file contains sections each separated by a blank line.
+ * Each section defines the content of a jar, with a
+ * header defining the jar file path name, followed by a list of paths.
+ * The jar file paths are relative to the codebase of the root jar.
+ *
+ Specification
+ index file : version-info blankline section*
+ version-info : JarIndex-Version: version-number
+ version-number : digit+{.digit+}*
+ section : body blankline
+ body : header name*
+ header : char+.jar newline
+ name : char+ newline
+
+ * @author langel at redhat dot com
+ */
+public class IndexListParser
+{
+ public static final String JAR_INDEX_FILE = "META-INF/INDEX.LIST";
+ public static final String JAR_INDEX_VERSION_KEY = "JarIndex-Version: ";
+
+ double versionNumber;
+ // Map each jar to the prefixes defined for the jar.
+ // This is intentionally kept in insertion order.
+ LinkedHashMap prefixes = new LinkedHashMap();
+
+ /**
+ * Parses the given jarfile's INDEX.LIST file if it exists.
+ *
+ * @param jarfile - the given jar file
+ * @param baseJarURL - the codebase of the jar file
+ * @param baseURL - the base url for the headers
+ */
+ public IndexListParser(JarFile jarfile, URL baseJarURL, URL baseURL)
+ {
+ try
+ {
+ // Parse INDEX.LIST if it exists
+ if (jarfile.getEntry(JAR_INDEX_FILE) != null)
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL,
+ JAR_INDEX_FILE).openStream()));
+
+ // Must start with version info
+ String line = br.readLine();
+ if (!line.startsWith(JAR_INDEX_VERSION_KEY))
+ return;
+ versionNumber = Double.parseDouble(line.substring(JAR_INDEX_VERSION_KEY.length()).trim());
+
+ // Blank line must be next
+ line = br.readLine();
+ if (! "".equals(line))
+ {
+ clearAll();
+ return;
+ }
+
+ // May contain sections.
+ while ((line = br.readLine()) != null)
+ {
+ URL jarURL = new URL(baseURL, line);
+ HashSet values = new HashSet();
+
+ // Read the names in the section.
+ while ((line = br.readLine()) != null)
+ {
+ // Stop at section boundary.
+ if ("".equals(line))
+ break;
+ values.add(line.trim());
+ }
+ prefixes.put(jarURL, values);
+ // Might have seen an early EOF.
+ if (line == null)
+ break;
+ }
+
+ br.close();
+ }
+ // else INDEX.LIST does not exist
+ }
+ catch (Exception ex)
+ {
+ clearAll();
+ }
+ }
+
+ /**
+ * Clears all the variables. This is called when parsing fails.
+ */
+ void clearAll()
+ {
+ versionNumber = 0;
+ prefixes = null;
+ }
+
+ /**
+ * Gets the version info for the file.
+ *
+ * @return the version info.
+ */
+ public String getVersionInfo()
+ {
+ return JAR_INDEX_VERSION_KEY + getVersionNumber();
+ }
+
+ /**
+ * Gets the version number of the file.
+ *
+ * @return the version number.
+ */
+ public double getVersionNumber()
+ {
+ return versionNumber;
+ }
+
+ /**
+ * Gets the map of all the headers found in the file.
+ * The keys in the map are URLs of jars. The values in the map
+ * are Sets of package prefixes (and top-level file names), as
+ * specifed in INDEX.LIST.
+ *
+ * @return an map of all the headers, or null if no INDEX.LIST was found
+ */
+ public LinkedHashMap getHeaders()
+ {
+ return prefixes;
+ }
+}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h
index 0ac6e4ad051..363d6c0ba07 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h
@@ -11,32 +11,32 @@ extern "C"
#endif
JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_init (JNIEnv *env, jobject, jlong);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels (JNIEnv *env, jobject, jintArray, jint, jint, jint, jdoubleArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels (JNIEnv *env, jobject, jintArray, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix (JNIEnv *env, jobject, jdoubleArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine (JNIEnv *env, jobject, jdouble, jint, jint, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash (JNIEnv *env, jobject, jdoubleArray, jint, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jobject, jfloat, jfloat, jint, jintArray, jfloatArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoCurveTo (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFill (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels (JNIEnv *env, jobject, jlong, jintArray, jint, jint, jint, jdoubleArray, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels (JNIEnv *env, jobject, jlong, jintArray, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix (JNIEnv *env, jobject, jlong, jdoubleArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator (JNIEnv *env, jobject, jlong, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jlong, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine (JNIEnv *env, jobject, jlong, jdouble, jint, jint, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash (JNIEnv *env, jobject, jlong, jdoubleArray, jint, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jlong, jobject, jfloat, jfloat, jint, jintArray, jfloatArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo (JNIEnv *env, jobject, jlong, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo (JNIEnv *env, jobject, jlong, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo (JNIEnv *env, jobject, jlong, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo (JNIEnv *env, jobject, jlong, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoCurveTo (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFill (JNIEnv *env, jobject, jlong, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter (JNIEnv *env, jobject, jlong, jint);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h
index 3bc263ffd97..88000095d7f 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h
@@ -11,15 +11,15 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_create (JNIEnv *env, jobject, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_destroy (JNIEnv *env, jobject);
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem (JNIEnv *env, jobject, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface (JNIEnv *env, jobject, jobject, jdoubleArray);
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_getPixels (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels (JNIEnv *env, jobject, jintArray);
-JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer (JNIEnv *env, jobject, jint);
-JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_newCairoContext (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative (JNIEnv *env, jobject, jint, jint, jint, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_destroy (JNIEnv *env, jobject, jlong, jlong);
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem (JNIEnv *env, jobject, jlong, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem (JNIEnv *env, jobject, jlong, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeDrawSurface (JNIEnv *env, jobject, jlong, jlong, jdoubleArray, jdouble);
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetPixels (JNIEnv *env, jobject, jlong, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetPixels (JNIEnv *env, jobject, jlong, jintArray);
+JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer (JNIEnv *env, jobject, jlong, jint);
+JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_nativeNewCairoContext (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative2 (JNIEnv *env, jobject, jlong, jint, jint, jint, jint, jint, jint, jint);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h
index e8ca711780e..4fd597effe6 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h
@@ -17,7 +17,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_start_1gdk_1
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_end_1gdk_1drawing (JNIEnv *env, jobject);
JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_hasXRender (JNIEnv *env, jclass);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative (JNIEnv *env, jobject, jobject, jint, jint, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile (JNIEnv *env, jobject, jobject, jobject, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile (JNIEnv *env, jobject, jobject, jlong, jint, jint, jint, jint);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
index 8c8434b6e25..10a4ea5e51f 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
@@ -10,7 +10,7 @@ extern "C"
{
#endif
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyph (JNIEnv *env, jobject, jint);
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs (JNIEnv *env, jobject, jintArray);
JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning (JNIEnv *env, jobject, jint, jint);
JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative (JNIEnv *env, jobject, jint);
JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative (JNIEnv *env, jobject, jint);
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h
deleted file mode 100644
index 8a87738f2c0..00000000000
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#ifndef __gnu_java_awt_peer_gtk_GdkGraphics__
-#define __gnu_java_awt_peer_gtk_GdkGraphics__
-
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initStaticState (JNIEnv *env, jclass);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II (JNIEnv *env, jobject, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeCopyState (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea (JNIEnv *env, jobject, jint, jint, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeDispose (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc (JNIEnv *env, jobject, jint, jint, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc (JNIEnv *env, jobject, jint, jint, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon (JNIEnv *env, jobject, jintArray, jintArray, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon (JNIEnv *env, jobject, jintArray, jintArray, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline (JNIEnv *env, jobject, jintArray, jintArray, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString (JNIEnv *env, jobject, jobject, jstring, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor (JNIEnv *env, jobject, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative (JNIEnv *env, jobject, jint, jint);
-#undef gnu_java_awt_peer_gtk_GdkGraphics_GDK_COPY
-#define gnu_java_awt_peer_gtk_GdkGraphics_GDK_COPY 0L
-#undef gnu_java_awt_peer_gtk_GdkGraphics_GDK_XOR
-#define gnu_java_awt_peer_gtk_GdkGraphics_GDK_XOR 2L
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gnu_java_awt_peer_gtk_GdkGraphics__ */
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
deleted file mode 100644
index 2d29cfc7371..00000000000
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#ifndef __gnu_java_awt_peer_gtk_GdkGraphics2D__
-#define __gnu_java_awt_peer_gtk_GdkGraphics2D__
-
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState (JNIEnv *env, jclass);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStateUnlocked (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II (JNIEnv *env, jobject, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState___3III (JNIEnv *env, jobject, jintArray, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_connectSignals (JNIEnv *env, jobject, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable (JNIEnv *env, jobject, jobject, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels (JNIEnv *env, jobject, jintArray, jint, jint, jint, jdoubleArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked (JNIEnv *env, jobject, jintArray, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels (JNIEnv *env, jobject, jintArray, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix (JNIEnv *env, jobject, jdoubleArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked (JNIEnv *env, jobject, jdoubleArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColor (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth (JNIEnv *env, jobject, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidthUnlocked (JNIEnv *env, jobject, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCapUnlocked (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoinUnlocked (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash (JNIEnv *env, jobject, jdoubleArray, jint, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDashUnlocked (JNIEnv *env, jobject, jdoubleArray, jint, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit (JNIEnv *env, jobject, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimitUnlocked (JNIEnv *env, jobject, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelLineTo (JNIEnv *env, jobject, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClosePath (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jobject, jfloat, jfloat, jint, jintArray, jfloatArray);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout (JNIEnv *env, jobject, jobject, jfloat, jfloat);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_releasePeerGraphicsResource (JNIEnv *env, jclass, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gnu_java_awt_peer_gtk_GdkGraphics2D__ */
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
index 680c4165f84..fae4d775b2e 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
@@ -16,7 +16,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_getExtents (JNIE
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_indexToPos (JNIEnv *env, jobject, jint, jdoubleArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_initState (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_cairoDrawGdkTextLayout (JNIEnv *env, jobject, jobject, jfloat, jfloat);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_cairoDrawGdkTextLayout (JNIEnv *env, jobject, jlong, jfloat, jfloat);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_initStaticState (JNIEnv *env, jclass);
JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline (JNIEnv *env, jobject, jobject);
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h
index 3a0efd3a9e4..43b55e828d3 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h
@@ -11,10 +11,10 @@ extern "C"
#endif
JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_init (JNIEnv *env, jobject, jobject, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy (JNIEnv *env, jobject);
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_copyArea (JNIEnv *env, jobject, jint, jint, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_drawVolatile (JNIEnv *env, jobject, jlong, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy (JNIEnv *env, jobject, jlong);
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeGetPixels (JNIEnv *env, jobject, jlong);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeCopyArea (JNIEnv *env, jobject, jlong, jint, jint, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeDrawVolatile (JNIEnv *env, jobject, jlong, jlong, jint, jint, jint, jint);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java
index cc42d04f274..3d3dcc319cc 100644
--- a/libjava/classpath/java/awt/Component.java
+++ b/libjava/classpath/java/awt/Component.java
@@ -1739,9 +1739,8 @@ public abstract class Component
if (gfx == null && parent != null)
{
gfx = parent.getGraphics();
- Rectangle bounds = getBounds();
- gfx.setClip(bounds);
- gfx.translate(bounds.x, bounds.y);
+ gfx.clipRect(getX(), getY(), getWidth(), getHeight());
+ gfx.translate(getX(), getY());
return gfx;
}
gfx.setFont(font);
diff --git a/libjava/classpath/java/awt/datatransfer/DataFlavor.java b/libjava/classpath/java/awt/datatransfer/DataFlavor.java
index 788ae6d6a52..5944c2eb7ec 100644
--- a/libjava/classpath/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/classpath/java/awt/datatransfer/DataFlavor.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.awt.datatransfer;
+import gnu.classpath.NotImplementedException;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -785,7 +787,8 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
*
* @exception IOException If an error occurs.
*/
- public void writeExternal(ObjectOutput stream) throws IOException
+ public void writeExternal(ObjectOutput stream)
+ throws IOException, NotImplementedException
{
// FIXME: Implement me
}
@@ -801,7 +804,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* cannot be found.
*/
public void readExternal(ObjectInput stream)
- throws IOException, ClassNotFoundException
+ throws IOException, ClassNotFoundException, NotImplementedException
{
// FIXME: Implement me
}
diff --git a/libjava/classpath/java/awt/dnd/DropTargetContext.java b/libjava/classpath/java/awt/dnd/DropTargetContext.java
index 19e27a9007f..4a26d904880 100644
--- a/libjava/classpath/java/awt/dnd/DropTargetContext.java
+++ b/libjava/classpath/java/awt/dnd/DropTargetContext.java
@@ -1,5 +1,5 @@
/* DropTargetContext.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation
+ Copyright (C) 2002, 2003, 2004, 2006, Free Software Foundation
This file is part of GNU Classpath.
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.awt.dnd;
+import gnu.classpath.NotImplementedException;
+
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@@ -59,23 +61,23 @@ public class DropTargetContext implements Serializable
protected boolean isLocal;
protected Transferable transferable;
- TransferableProxy (Transferable t, boolean local)
+ TransferableProxy(Transferable t, boolean local)
{
this.transferable = t;
this.isLocal = local;
}
- public DataFlavor[] getTransferDataFlavors ()
+ public DataFlavor[] getTransferDataFlavors()
{
- return transferable.getTransferDataFlavors ();
+ return transferable.getTransferDataFlavors();
}
- public boolean isDataFlavorSupported (DataFlavor flavor)
+ public boolean isDataFlavorSupported(DataFlavor flavor)
{
- return transferable.isDataFlavorSupported (flavor);
+ return transferable.isDataFlavorSupported(flavor);
}
- public Object getTransferData (DataFlavor flavor)
+ public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException
{
return transferable.getTransferData (flavor);
@@ -87,32 +89,32 @@ public class DropTargetContext implements Serializable
private java.awt.dnd.peer.DropTargetContextPeer dtcp;
// package private
- DropTargetContext (DropTarget dropTarget)
+ DropTargetContext(DropTarget dropTarget)
{
this.dropTarget = dropTarget;
}
- public DropTarget getDropTarget ()
+ public DropTarget getDropTarget()
{
return dropTarget;
}
- public Component getComponent ()
+ public Component getComponent()
{
- return dropTarget.getComponent ();
+ return dropTarget.getComponent();
}
- public void addNotify (java.awt.dnd.peer.DropTargetContextPeer dtcp)
+ public void addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp)
{
this.dtcp = dtcp;
}
- public void removeNotify ()
+ public void removeNotify()
{
this.dtcp = null;
}
- protected void setTargetActions (int actions)
+ protected void setTargetActions(int actions)
{
targetActions = actions;
}
@@ -127,45 +129,51 @@ public class DropTargetContext implements Serializable
*
* @exception InvalidDnDOperationException If a drop is not outstanding.
*/
- public void dropComplete (boolean success)
+ public void dropComplete(boolean success)
+ throws NotImplementedException
{
// FIXME: implement this
}
- protected void acceptDrag (int dragOperation)
+ protected void acceptDrag(int dragOperation)
+ throws NotImplementedException
{
// FIXME: implement this
}
- protected void rejectDrag ()
+ protected void rejectDrag()
+ throws NotImplementedException
{
// FIXME: implement this
}
- protected void acceptDrop (int dropOperation)
+ protected void acceptDrop(int dropOperation)
+ throws NotImplementedException
{
// FIXME: implement this
}
- protected void rejectDrop ()
+ protected void rejectDrop()
+ throws NotImplementedException
{
// FIXME: implement this
}
- protected DataFlavor[] getCurrentDataFlavors ()
+ protected DataFlavor[] getCurrentDataFlavors()
+ throws NotImplementedException
{
// FIXME: implement this
return null;
}
- protected List getCurrentDataFlavorsAsList ()
+ protected List getCurrentDataFlavorsAsList()
{
- return Arrays.asList (getCurrentDataFlavors ());
+ return Arrays.asList(getCurrentDataFlavors());
}
- protected boolean isDataFlavorSupported (DataFlavor flavor)
+ protected boolean isDataFlavorSupported(DataFlavor flavor)
{
- return getCurrentDataFlavorsAsList ().contains (flavor);
+ return getCurrentDataFlavorsAsList().contains(flavor);
}
/**
@@ -173,7 +181,8 @@ public class DropTargetContext implements Serializable
*
* @exception InvalidDnDOperationException If a drag is not outstanding.
*/
- protected Transferable getTransferable() throws InvalidDnDOperationException
+ protected Transferable getTransferable()
+ throws InvalidDnDOperationException, NotImplementedException
{
// FIXME: implement this
return null;
@@ -181,6 +190,6 @@ public class DropTargetContext implements Serializable
protected Transferable createTransferableProxy(Transferable t, boolean local)
{
- return new TransferableProxy (t, local);
+ return new TransferableProxy(t, local);
}
} // class DropTargetContext
diff --git a/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java b/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java
index 0c0777f78d0..a745bd256f8 100644
--- a/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java
+++ b/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.awt.dnd;
+import gnu.classpath.NotImplementedException;
+
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@@ -65,10 +67,10 @@ public class DropTargetDropEvent extends DropTargetEvent
* actions is not a bitwise mask of DnDConstants, or dtc is null.
* @exception NullPointerException If location is null.
*/
- public DropTargetDropEvent (DropTargetContext dtc, Point location,
- int dropAction, int actions)
+ public DropTargetDropEvent(DropTargetContext dtc, Point location,
+ int dropAction, int actions)
{
- this (dtc, location, dropAction, actions, false);
+ this(dtc, location, dropAction, actions, false);
}
/**
@@ -78,16 +80,16 @@ public class DropTargetDropEvent extends DropTargetEvent
* actions is not a bitwise mask of DnDConstants, or dtc is null.
* @exception NullPointerException If location is null.
*/
- public DropTargetDropEvent (DropTargetContext dtc, Point location,
- int dropAction, int actions, boolean isLocalTx)
+ public DropTargetDropEvent(DropTargetContext dtc, Point location,
+ int dropAction, int actions, boolean isLocalTx)
{
- super (dtc);
+ super(dtc);
if (location == null)
- throw new NullPointerException ();
+ throw new NullPointerException();
if (dtc == null)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException();
if (dropAction != DnDConstants.ACTION_NONE
&& dropAction != DnDConstants.ACTION_COPY
@@ -95,7 +97,7 @@ public class DropTargetDropEvent extends DropTargetEvent
&& dropAction != DnDConstants.ACTION_COPY_OR_MOVE
&& dropAction != DnDConstants.ACTION_LINK
&& dropAction != DnDConstants.ACTION_REFERENCE)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException();
int actionsMask = DnDConstants.ACTION_NONE
| DnDConstants.ACTION_COPY
@@ -105,7 +107,7 @@ public class DropTargetDropEvent extends DropTargetEvent
| DnDConstants.ACTION_REFERENCE;
if (~(actions ^ actionsMask) != 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException();
this.dropAction = dropAction;
this.actions = actions;
@@ -113,52 +115,53 @@ public class DropTargetDropEvent extends DropTargetEvent
this.isLocalTx = isLocalTx;
}
- public Point getLocation ()
+ public Point getLocation()
{
return location;
}
- public DataFlavor[] getCurrentDataFlavors ()
+ public DataFlavor[] getCurrentDataFlavors()
{
- return context.getCurrentDataFlavors ();
+ return context.getCurrentDataFlavors();
}
- public List getCurrentDataFlavorsAsList ()
+ public List getCurrentDataFlavorsAsList()
{
- return context.getCurrentDataFlavorsAsList ();
+ return context.getCurrentDataFlavorsAsList();
}
- public boolean isDataFlavorSupported (DataFlavor flavor)
+ public boolean isDataFlavorSupported(DataFlavor flavor)
{
- return context.isDataFlavorSupported (flavor);
+ return context.isDataFlavorSupported(flavor);
}
- public int getSourceActions ()
+ public int getSourceActions()
{
return actions;
}
- public int getDropAction ()
+ public int getDropAction()
{
return dropAction;
}
- public Transferable getTransferable ()
+ public Transferable getTransferable()
{
return context.getTransferable ();
}
- public void acceptDrop (int dropAction)
+ public void acceptDrop(int dropAction)
{
- context.acceptDrop (dropAction);
+ context.acceptDrop(dropAction);
}
- public void rejectDrop ()
+ public void rejectDrop()
{
- context.rejectDrop ();
+ context.rejectDrop();
}
- public void dropComplete (boolean success)
+ public void dropComplete(boolean success)
+ throws NotImplementedException
{
// FIXME: implement this
}
diff --git a/libjava/classpath/java/awt/font/LineBreakMeasurer.java b/libjava/classpath/java/awt/font/LineBreakMeasurer.java
index 14985b44cb9..c2a6d45d9f5 100644
--- a/libjava/classpath/java/awt/font/LineBreakMeasurer.java
+++ b/libjava/classpath/java/awt/font/LineBreakMeasurer.java
@@ -1,5 +1,5 @@
/* LineBreakMeasurer.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,84 +38,161 @@ exception statement from your version. */
package java.awt.font;
-import gnu.classpath.NotImplementedException;
-
import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
import java.text.BreakIterator;
+import java.awt.font.TextLayout;
+import java.awt.font.FontRenderContext;
+import java.awt.Shape;
public final class LineBreakMeasurer
{
- private AttributedCharacterIterator ci;
+ private AttributedCharacterIterator text;
+ private int position;
private FontRenderContext frc;
- private BreakIterator bi;
+ private TextLayout totalLayout;
+ private int numChars;
- /**
- * Constructs a <code>LineBreakMeasurer</code> object.
- */
- public LineBreakMeasurer (AttributedCharacterIterator text,
- FontRenderContext frc)
+ public LineBreakMeasurer(AttributedCharacterIterator text,
+ BreakIterator breakIter, FontRenderContext frc)
{
- this (text, null, frc);
+ this.text = text;
+ this.frc = frc;
+ position = 0;
+ totalLayout = new TextLayout(text, frc);
+ numChars = totalLayout.getCharacterCount();
}
- /**
- * Constructs a <code>LineBreakMeasurer</code> object.
- */
- public LineBreakMeasurer (AttributedCharacterIterator text,
- BreakIterator breakIter, FontRenderContext frc)
+ public LineBreakMeasurer(AttributedCharacterIterator text,
+ FontRenderContext frc)
{
- this.ci = text;
- this.bi = breakIter;
+ this.text = text;
this.frc = frc;
+ position = 0;
+ totalLayout = new TextLayout(text, frc);
+ numChars = totalLayout.getCharacterCount();
}
- public void deleteChar (AttributedCharacterIterator newParagraph,
- int deletePos)
- throws NotImplementedException
+ public void deleteChar(AttributedCharacterIterator newParagraph,
+ int deletePos)
{
- throw new Error ("not implemented");
+ totalLayout = new TextLayout(newParagraph, frc);
+ if( deletePos < 0 || deletePos > totalLayout.getCharacterCount() )
+ throw new NullPointerException("Invalid deletePos:"+deletePos);
+ numChars = totalLayout.getCharacterCount();
+ text = newParagraph;
+ position = 0;
}
- public int getPosition ()
+ public void insertChar(AttributedCharacterIterator newParagraph,
+ int insertPos)
{
- return ci.getIndex ();
+ totalLayout = new TextLayout(newParagraph, frc);
+ if( insertPos < 0 || insertPos > totalLayout.getCharacterCount() )
+ throw new NullPointerException("Invalid insertPos:"+insertPos);
+ numChars = totalLayout.getCharacterCount();
+ text = newParagraph;
+ position = 0;
}
- public void insertChar (AttributedCharacterIterator newParagraph,
- int insertPos)
- throws NotImplementedException
+ public TextLayout nextLayout(float wrappingWidth)
{
- throw new Error ("not implemented");
+ return nextLayout( wrappingWidth, numChars, false );
}
- public TextLayout nextLayout (float wrappingWidth)
- throws NotImplementedException
+ public TextLayout nextLayout(float wrappingWidth, int offsetLimit,
+ boolean requireNextWord)
{
- throw new Error ("not implemented");
+ int next = nextOffset( wrappingWidth, offsetLimit, requireNextWord );
+ AttributedCharacterIterator aci = (new AttributedString( text,
+ position, next )
+ ).getIterator();
+ position = next;
+ return new TextLayout( aci, frc );
}
- public TextLayout nextLayout (float wrappingWidth, int offsetLimit,
- boolean requireNextWord)
- throws NotImplementedException
+ public int nextOffset(float wrappingWidth)
{
- throw new Error ("not implemented");
+ return nextOffset( wrappingWidth, numChars, false );
}
- public int nextOffset (float wrappingWidth)
- throws NotImplementedException
+ public int nextOffset(float wrappingWidth, int offsetLimit,
+ boolean requireNextWord)
{
- throw new Error ("not implemented");
+ Shape s = totalLayout.getBlackBoxBounds( position, offsetLimit );
+ double remainingLength = s.getBounds2D().getWidth();
+
+ int guessOffset = (int)( ( (double)wrappingWidth / (double)remainingLength)
+ * ( (double)numChars - (double)position ) );
+ guessOffset += position;
+ if( guessOffset > offsetLimit )
+ guessOffset = offsetLimit;
+
+ s = totalLayout.getBlackBoxBounds( position, guessOffset );
+ double guessLength = s.getBounds2D().getWidth();
+
+ boolean makeSmaller = ( guessLength > wrappingWidth );
+ int inc = makeSmaller ? -1 : 1;
+ boolean keepGoing = true;
+
+ do
+ {
+ guessOffset = guessOffset + inc;
+ if( guessOffset <= position || guessOffset > offsetLimit )
+ {
+ keepGoing = false;
+ }
+ else
+ {
+ s = totalLayout.getBlackBoxBounds( position, guessOffset );
+ guessLength = s.getBounds2D().getWidth();
+ if( makeSmaller && ( guessLength <= wrappingWidth) )
+ keepGoing = false;
+ if( !makeSmaller && ( guessLength >= wrappingWidth) )
+ keepGoing = false;
+ }
+ }
+ while( keepGoing );
+
+ if( !makeSmaller )
+ guessOffset--;
+
+ if( guessOffset >= offsetLimit )
+ return offsetLimit;
+
+ text.setIndex( guessOffset );
+ if( !requireNextWord )
+ {
+ char c = text.previous();
+ while( !Character.isWhitespace( c ) && c != '-' &&
+ guessOffset > position )
+ {
+ guessOffset--;
+ c = text.previous();
+ }
+ }
+ else
+ {
+ char c = text.next();
+ while( !Character.isWhitespace( c ) && c != '-' &&
+ guessOffset < offsetLimit )
+ {
+ guessOffset++;
+ c = text.next();
+ }
+ }
+
+ return guessOffset;
}
- public int nextOffset (float wrappingWidth, int offsetLimit,
- boolean requireNextWord)
- throws NotImplementedException
+ public void setPosition(int newPosition)
{
- throw new Error ("not implemented");
+ position = newPosition;
}
- public void setPosition (int newPosition)
+ public int getPosition()
{
- ci.setIndex (newPosition);
+ return position;
}
}
+
diff --git a/libjava/classpath/java/awt/font/TextLayout.java b/libjava/classpath/java/awt/font/TextLayout.java
index bb641614a92..4f8c1c644c1 100644
--- a/libjava/classpath/java/awt/font/TextLayout.java
+++ b/libjava/classpath/java/awt/font/TextLayout.java
@@ -1,5 +1,5 @@
/* TextLayout.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,7 @@ exception statement from your version. */
package java.awt.font;
-import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathTextLayoutPeer;
+import gnu.classpath.NotImplementedException;
import java.awt.Font;
import java.awt.Graphics2D;
@@ -47,116 +46,269 @@ import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
+import java.text.Bidi;
import java.util.Map;
/**
- * @author Michael Koch
+ * @author Sven de Marothy
*/
public final class TextLayout implements Cloneable
{
- public static final CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy ();
- ClasspathTextLayoutPeer peer;
-
- public static class CaretPolicy
+ private GlyphVector[] runs;
+ private Font font;
+ private FontRenderContext frc;
+ private String string;
+ private Rectangle2D boundsCache;
+ private LineMetrics lm;
+
+ /**
+ * Start and end character indices of the runs.
+ * First index is the run number, second is 0 or 1 for the starting
+ * and ending character index of the run, respectively.
+ */
+ private int[][] runIndices;
+
+ /**
+ * Base directionality, determined from the first char.
+ */
+ private boolean leftToRight;
+
+ /**
+ * Whether this layout contains whitespace or not.
+ */
+ private boolean hasWhitespace = false;
+
+ /**
+ * The default caret policy.
+ */
+ static TextLayout.CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy();
+
+ /**
+ * Constructs a TextLayout.
+ */
+ public TextLayout (String string, Font font, FontRenderContext frc)
{
- public CaretPolicy ()
- {
- // Do nothing here.
- }
+ this.font = font;
+ this.frc = frc;
+ this.string = string;
+ lm = font.getLineMetrics(string, frc);
- public TextHitInfo getStrongCaret (TextHitInfo hit1, TextHitInfo hit2,
- TextLayout layout)
- {
- return layout.peer.getStrongCaret(hit1, hit2);
- }
- }
+ // Get base direction and whitespace info
+ getStringProperties();
- public TextLayout (AttributedCharacterIterator text, FontRenderContext frc)
- {
- AttributedString as = new AttributedString (text);
- ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- peer = tk.getClasspathTextLayoutPeer(as, frc);
+ if( Bidi.requiresBidi( string.toCharArray(), 0, string.length() ) )
+ {
+ Bidi bidi = new Bidi( string, leftToRight ?
+ Bidi.DIRECTION_LEFT_TO_RIGHT :
+ Bidi.DIRECTION_RIGHT_TO_LEFT );
+ int rc = bidi.getRunCount();
+ byte[] table = new byte[ rc ];
+ for(int i = 0; i < table.length; i++)
+ table[i] = (byte)bidi.getRunLevel(i);
+
+ runs = new GlyphVector[ rc ];
+ runIndices = new int[rc][2];
+ for(int i = 0; i < runs.length; i++)
+ {
+ runIndices[i][0] = bidi.getRunStart( i );
+ runIndices[i][1] = bidi.getRunLimit( i );
+ if( runIndices[i][0] != runIndices[i][1] ) // no empty runs.
+ {
+ runs[i] = font.layoutGlyphVector
+ ( frc, string.toCharArray(),
+ runIndices[i][0], runIndices[i][1],
+ ((table[i] & 1) == 0) ? Font.LAYOUT_LEFT_TO_RIGHT :
+ Font.LAYOUT_RIGHT_TO_LEFT );
+ }
+ }
+ Bidi.reorderVisually( table, 0, runs, 0, runs.length );
+ }
+ else
+ {
+ runs = new GlyphVector[ 1 ];
+ runIndices = new int[1][2];
+ runIndices[0][0] = 0;
+ runIndices[0][1] = string.length();
+ runs[ 0 ] = font.layoutGlyphVector( frc, string.toCharArray(),
+ 0, string.length(),
+ leftToRight ?
+ Font.LAYOUT_LEFT_TO_RIGHT :
+ Font.LAYOUT_RIGHT_TO_LEFT );
+ }
}
- public TextLayout (String string, Font font, FontRenderContext frc)
+ public TextLayout (String string, Map attributes, FontRenderContext frc)
{
- AttributedString as = new AttributedString (string);
- as.addAttribute (TextAttribute.FONT, font);
- ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- peer = tk.getClasspathTextLayoutPeer(as, frc);
+ this( string, new Font( attributes ), frc );
}
- public TextLayout (String string, Map attributes, FontRenderContext frc)
- {
- AttributedString as = new AttributedString (string, attributes);
- ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- peer = tk.getClasspathTextLayoutPeer(as, frc);
+ public TextLayout (AttributedCharacterIterator text, FontRenderContext frc)
+ throws NotImplementedException
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Scan the character run for the first strongly directional character,
+ * which in turn defines the base directionality of the whole layout.
+ */
+ private void getStringProperties()
+ {
+ boolean gotDirection = false;
+ int i = 0;
+
+ leftToRight = true;
+ while( i < string.length() && !gotDirection )
+ switch( Character.getDirectionality( string.charAt( i++ ) ) )
+ {
+ case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
+ case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
+ case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
+ gotDirection = true;
+ break;
+
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
+ leftToRight = false;
+ gotDirection = true;
+ break;
+ }
+
+ // Determine if there's whitespace in the thing.
+ // Ignore trailing chars.
+ i = string.length() - 1;
+ hasWhitespace = false;
+ while( i >= 0 && Character.isWhitespace( string.charAt(i) ) )
+ i--;
+ // Check the remaining chars
+ while( i >= 0 )
+ if( Character.isWhitespace( string.charAt(i--) ) )
+ hasWhitespace = true;
}
protected Object clone ()
{
- try
- {
- TextLayout tl = (TextLayout) super.clone ();
- tl.peer = (ClasspathTextLayoutPeer) this.peer.clone();
- return tl;
- }
- catch (CloneNotSupportedException e)
- {
- // This should never occur
- throw new InternalError ();
- }
+ return new TextLayout( string, font, frc );
}
-
public void draw (Graphics2D g2, float x, float y)
- {
- peer.draw(g2, x, y);
+ {
+ for(int i = 0; i < runs.length; i++)
+ {
+ g2.drawGlyphVector(runs[i], x, y);
+ Rectangle2D r = runs[i].getLogicalBounds();
+ x += r.getWidth();
+ }
}
public boolean equals (Object obj)
{
- if (! (obj instanceof TextLayout))
+ if( !( obj instanceof TextLayout) )
return false;
- return equals ((TextLayout) obj);
+ return equals( (TextLayout) obj );
}
public boolean equals (TextLayout tl)
{
- return this.peer.equals(tl.peer);
+ if( runs.length != tl.runs.length )
+ return false;
+ // Compare all glyph vectors.
+ for( int i = 0; i < runs.length; i++ )
+ if( !runs[i].equals( tl.runs[i] ) )
+ return false;
+ return true;
}
public float getAdvance ()
{
- return peer.getAdvance();
+ float totalAdvance = 0f;
+ for(int i = 0; i < runs.length; i++)
+ totalAdvance += runs[i].getLogicalBounds().getWidth();
+ return totalAdvance;
}
public float getAscent ()
{
- return peer.getAscent();
+ return lm.getAscent();
}
public byte getBaseline ()
{
- return peer.getBaseline();
+ return (byte)lm.getBaselineIndex();
}
public float[] getBaselineOffsets ()
{
- return peer.getBaselineOffsets();
+ return lm.getBaselineOffsets();
}
public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
{
- return peer.getBlackBoxBounds(firstEndpoint, secondEndpoint);
+ if( firstEndpoint < 0 || secondEndpoint > getCharacterCount() )
+ return new Rectangle2D.Float();
+
+ GeneralPath gp = new GeneralPath();
+ int i = 0; // run index
+ double advance = 0;
+
+ // go to first run
+ while( runIndices[i + 1][1] < firstEndpoint )
+ {
+ advance += runs[i].getLogicalBounds().getWidth();
+ i++;
+ }
+
+ int j = 0; // index into the run.
+ if( runIndices[i][1] - runIndices[i][0] > 1 )
+ {
+ while( runs[i].getGlyphCharIndex( j + 1 ) <
+ (firstEndpoint - runIndices[i][0] ) )j++;
+ }
+
+ gp.append(runs[i].getGlyphVisualBounds( j ), false);
+ boolean keepGoing = true;;
+
+ do
+ {
+ while( j < runs[i].getNumGlyphs() &&
+ runs[i].getGlyphCharIndex( j ) + runIndices[i][0] <
+ secondEndpoint )
+ {
+ Rectangle2D r2 = (runs[i].getGlyphVisualBounds( j )).
+ getBounds2D();
+ Point2D p = runs[i].getGlyphPosition( j );
+ r2.setRect( advance + p.getX(), r2.getY(),
+ r2.getWidth(), r2.getHeight() );
+ gp.append(r2, false);
+ j++;
+ }
+
+ if( j >= runs[i].getNumGlyphs() )
+ {
+ advance += runs[i].getLogicalBounds().getWidth();
+ i++;
+ j = 0;
+ }
+ else
+ keepGoing = false;
+ }
+ while( keepGoing );
+
+ return gp;
}
public Rectangle2D getBounds()
{
- return peer.getBounds();
+ if( boundsCache == null )
+ boundsCache = getOutline(new AffineTransform()).getBounds();
+ return boundsCache;
}
public float[] getCaretInfo (TextHitInfo hit)
@@ -165,144 +317,274 @@ public final class TextLayout implements Cloneable
}
public float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
+ throws NotImplementedException
{
- return peer.getCaretInfo(hit, bounds);
+ throw new Error ("not implemented");
}
public Shape getCaretShape (TextHitInfo hit)
{
- return getCaretShape(hit, getBounds());
+ return getCaretShape( hit, getBounds() );
}
public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
+ throws NotImplementedException
{
- return peer.getCaretShape(hit, bounds);
+ throw new Error ("not implemented");
}
public Shape[] getCaretShapes (int offset)
{
- return getCaretShapes(offset, getBounds());
+ return getCaretShapes( offset, getBounds() );
}
public Shape[] getCaretShapes (int offset, Rectangle2D bounds)
+ throws NotImplementedException
{
- return getCaretShapes(offset, getBounds(), DEFAULT_CARET_POLICY);
- }
-
- public Shape[] getCaretShapes (int offset, Rectangle2D bounds,
- TextLayout.CaretPolicy policy)
- {
- return peer.getCaretShapes(offset, bounds, policy);
+ throw new Error ("not implemented");
}
public int getCharacterCount ()
{
- return peer.getCharacterCount();
+ return string.length();
}
public byte getCharacterLevel (int index)
+ throws NotImplementedException
{
- return peer.getCharacterLevel(index);
+ throw new Error ("not implemented");
}
public float getDescent ()
{
- return peer.getDescent();
+ return lm.getDescent();
}
public TextLayout getJustifiedLayout (float justificationWidth)
{
- return peer.getJustifiedLayout(justificationWidth);
+ TextLayout newLayout = (TextLayout)clone();
+
+ if( hasWhitespace )
+ newLayout.handleJustify( justificationWidth );
+
+ return newLayout;
}
public float getLeading ()
{
- return peer.getLeading();
+ return lm.getLeading();
}
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint)
{
- return getLogicalHighlightShape (firstEndpoint, secondEndpoint, getBounds());
+ return getLogicalHighlightShape( firstEndpoint, secondEndpoint,
+ getBounds() );
}
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
Rectangle2D bounds)
{
- return peer.getLogicalHighlightShape(firstEndpoint, secondEndpoint, bounds);
+ if( firstEndpoint < 0 || secondEndpoint > getCharacterCount() )
+ return new Rectangle2D.Float();
+
+ int i = 0; // run index
+ double advance = 0;
+
+ // go to first run
+ if( i > 0 )
+ while( runIndices[i + 1][1] < firstEndpoint )
+ {
+ advance += runs[i].getLogicalBounds().getWidth();
+ i++;
+ }
+
+ int j = 0; // index into the run.
+ if( runIndices[i][1] - runIndices[i][0] > 1 )
+ {
+ while( runs[i].getGlyphCharIndex( j + 1 ) <
+ (firstEndpoint - runIndices[i][0] ) )j++;
+ }
+
+ Rectangle2D r = (runs[i].getGlyphLogicalBounds( j )).getBounds2D();
+ boolean keepGoing = true;;
+
+ do
+ {
+ while( j < runs[i].getNumGlyphs() &&
+ runs[i].getGlyphCharIndex( j ) + runIndices[i][0] <
+ secondEndpoint )
+ {
+ Rectangle2D r2 = (runs[i].getGlyphLogicalBounds( j )).
+ getBounds2D();
+ Point2D p = runs[i].getGlyphPosition( j );
+ r2.setRect( advance + p.getX(), r2.getY(),
+ r2.getWidth(), r2.getHeight() );
+ r = r.createUnion( r2 );
+ j++;
+ }
+
+ if( j >= runs[i].getNumGlyphs() )
+ {
+ advance += runs[i].getLogicalBounds().getWidth();
+ i++;
+ j = 0;
+ }
+ else
+ keepGoing = false;
+ }
+ while( keepGoing );
+
+ return r;
}
public int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint)
+ throws NotImplementedException
{
- return peer.getLogicalRangesForVisualSelection(firstEndpoint, secondEndpoint);
+ throw new Error ("not implemented");
}
public TextHitInfo getNextLeftHit (int offset)
+ throws NotImplementedException
{
- return getNextLeftHit(offset, DEFAULT_CARET_POLICY);
- }
-
- public TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy)
- {
- return peer.getNextLeftHit(offset, policy);
+ throw new Error ("not implemented");
}
public TextHitInfo getNextLeftHit (TextHitInfo hit)
+ throws NotImplementedException
{
- return getNextLeftHit(hit.getCharIndex());
+ throw new Error ("not implemented");
}
public TextHitInfo getNextRightHit (int offset)
+ throws NotImplementedException
{
- return getNextRightHit(offset, DEFAULT_CARET_POLICY);
- }
-
- public TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy)
- {
- return peer.getNextRightHit(offset, policy);
+ throw new Error ("not implemented");
}
public TextHitInfo getNextRightHit (TextHitInfo hit)
+ throws NotImplementedException
{
- return getNextRightHit(hit.getCharIndex());
+ throw new Error ("not implemented");
}
public Shape getOutline (AffineTransform tx)
{
- return peer.getOutline(tx);
+ float x = 0f;
+ GeneralPath gp = new GeneralPath();
+ for(int i = 0; i < runs.length; i++)
+ {
+ gp.append( runs[i].getOutline( x, 0f ), false );
+ Rectangle2D r = runs[i].getLogicalBounds();
+ x += r.getWidth();
+ }
+ if( tx != null )
+ gp.transform( tx );
+ return gp;
}
public float getVisibleAdvance ()
{
- return peer.getVisibleAdvance();
+ float totalAdvance = 0f;
+
+ if( runs.length <= 0 )
+ return 0f;
+
+ // No trailing whitespace
+ if( !Character.isWhitespace( string.charAt( string.length() -1 ) ) )
+ return getAdvance();
+
+ // Get length of all runs up to the last
+ for(int i = 0; i < runs.length - 1; i++)
+ totalAdvance += runs[i].getLogicalBounds().getWidth();
+
+ int lastRun = runIndices[ runs.length - 1 ][0];
+ int j = string.length() - 1;
+ while( j >= lastRun && Character.isWhitespace( string.charAt( j ) ) ) j--;
+
+ if( j < lastRun )
+ return totalAdvance; // entire last run is whitespace
+
+ int lastNonWSChar = j - lastRun;
+ j = 0;
+ while( runs[ runs.length - 1 ].getGlyphCharIndex( j )
+ <= lastNonWSChar )
+ {
+ totalAdvance += runs[ runs.length - 1 ].getGlyphLogicalBounds( j ).
+ getBounds2D().getWidth();
+ j ++;
+ }
+
+ return totalAdvance;
}
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint)
{
- return getVisualHighlightShape(firstEndpoint, secondEndpoint, getBounds());
+ return getVisualHighlightShape( firstEndpoint, secondEndpoint,
+ getBounds() );
}
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint,
Rectangle2D bounds)
+ throws NotImplementedException
{
- return peer.getVisualHighlightShape(firstEndpoint, secondEndpoint, bounds);
+ throw new Error ("not implemented");
}
public TextHitInfo getVisualOtherHit (TextHitInfo hit)
+ throws NotImplementedException
{
- return peer.getVisualOtherHit(hit);
+ throw new Error ("not implemented");
}
+ /**
+ * This is a protected method of a <code>final</code> class, meaning
+ * it exists only to taunt you.
+ */
protected void handleJustify (float justificationWidth)
{
- peer.handleJustify(justificationWidth);
- }
-
- public int hashCode ()
- {
- return peer.hashCode();
+ // We assume that the text has non-trailing whitespace.
+ // First get the change in width to insert into the whitespaces.
+ double deltaW = justificationWidth - getVisibleAdvance();
+ int nglyphs = 0; // # of whitespace chars
+
+ // determine last non-whitespace char.
+ int lastNWS = string.length() - 1;
+ while( Character.isWhitespace( string.charAt( lastNWS ) ) ) lastNWS--;
+
+ // locations of the glyphs.
+ int[] wsglyphs = new int[string.length() * 10];
+ for(int run = 0; run < runs.length; run++ )
+ for(int i = 0; i < runs[run].getNumGlyphs(); i++ )
+ {
+ int cindex = runIndices[run][0] + runs[run].getGlyphCharIndex( i );
+ if( Character.isWhitespace( string.charAt( cindex ) ) )
+ // && cindex < lastNWS )
+ {
+ wsglyphs[ nglyphs * 2 ] = run;
+ wsglyphs[ nglyphs * 2 + 1] = i;
+ nglyphs++;
+ }
+ }
+
+ deltaW = deltaW / nglyphs; // Change in width per whitespace glyph
+ double w = 0;
+ int cws = 0;
+ // Shift all characters
+ for(int run = 0; run < runs.length; run++ )
+ for(int i = 0; i < runs[ run ].getNumGlyphs(); i++ )
+ {
+ if( wsglyphs[ cws * 2 ] == run && wsglyphs[ cws * 2 + 1 ] == i )
+ {
+ cws++; // update 'current whitespace'
+ w += deltaW; // increment the shift
+ }
+ Point2D p = runs[ run ].getGlyphPosition( i );
+ p.setLocation( p.getX() + w, p.getY() );
+ runs[ run ].setGlyphPosition( i, p );
+ }
}
public TextHitInfo hitTestChar (float x, float y)
@@ -312,21 +594,48 @@ public final class TextLayout implements Cloneable
public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
{
- return peer.hitTestChar(x, y, bounds);
+ return hitTestChar( x, y, getBounds() );
}
public boolean isLeftToRight ()
{
- return peer.isLeftToRight();
+ return leftToRight;
}
public boolean isVertical ()
{
- return peer.isVertical();
+ return false; // FIXME: How do you create a vertical layout?
+ }
+
+ public int hashCode ()
+ throws NotImplementedException
+ {
+ throw new Error ("not implemented");
}
public String toString ()
{
- return peer.toString();
+ return "TextLayout [string:"+string+", Font:"+font+" Rendercontext:"+
+ frc+"]";
+ }
+
+ /**
+ * Inner class describing a caret policy
+ */
+ public static class CaretPolicy
+ {
+ public CaretPolicy()
+ {
+ }
+
+ public TextHitInfo getStrongCaret(TextHitInfo hit1,
+ TextHitInfo hit2,
+ TextLayout layout)
+ throws NotImplementedException
+ {
+ throw new Error ("not implemented");
+ }
}
}
+
+
diff --git a/libjava/classpath/java/awt/geom/AffineTransform.java b/libjava/classpath/java/awt/geom/AffineTransform.java
index 4d1a4d6d5d4..55b6883553d 100644
--- a/libjava/classpath/java/awt/geom/AffineTransform.java
+++ b/libjava/classpath/java/awt/geom/AffineTransform.java
@@ -414,7 +414,9 @@ public class AffineTransform implements Cloneable, Serializable
public static AffineTransform getTranslateInstance(double tx, double ty)
{
AffineTransform t = new AffineTransform();
- t.setToTranslation(tx, ty);
+ t.m02 = tx;
+ t.m12 = ty;
+ t.type = (tx == 0 && ty == 0) ? TYPE_UNIFORM_SCALE : TYPE_TRANSLATION;
return t;
}
diff --git a/libjava/classpath/java/awt/image/BufferedImage.java b/libjava/classpath/java/awt/image/BufferedImage.java
index 16b0143850c..77b8d6cc174 100644
--- a/libjava/classpath/java/awt/image/BufferedImage.java
+++ b/libjava/classpath/java/awt/image/BufferedImage.java
@@ -1,5 +1,5 @@
/* BufferedImage.java --
- Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation
+ Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, Free Software Foundation
This file is part of GNU Classpath.
@@ -99,6 +99,13 @@ public class BufferedImage extends Image
Vector observers;
+ /**
+ * Creates a new buffered image.
+ *
+ * @param w the width.
+ * @param h the height.
+ * @param type the image type (see the constants defined by this class).
+ */
public BufferedImage(int w, int h, int type)
{
ColorModel cm = null;
@@ -363,11 +370,28 @@ public class BufferedImage extends Image
return 1;
}
+ /**
+ * Returns the value of the specified property, or
+ * {@link Image#UndefinedProperty} if the property is not defined.
+ *
+ * @param string the property key (<code>null</code> not permitted).
+ *
+ * @return The property value.
+ *
+ * @throws NullPointerException if <code>string</code> is <code>null</code>.
+ */
public Object getProperty(String string)
{
- if (properties == null)
- return null;
- return properties.get(string);
+ if (string == null)
+ throw new NullPointerException("The property name cannot be null.");
+ Object result = Image.UndefinedProperty;
+ if (properties != null)
+ {
+ Object v = properties.get(string);
+ if (v != null)
+ result = v;
+ }
+ return result;
}
public Object getProperty(String string, ImageObserver imageobserver)
@@ -375,10 +399,15 @@ public class BufferedImage extends Image
return getProperty(string);
}
-
+ /**
+ * Returns <code>null</code> always.
+ *
+ * @return <code>null</code> always.
+ */
public String[] getPropertyNames()
{
- // FIXME: implement
+ // This method should always return null, see:
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4640609
return null;
}
diff --git a/libjava/classpath/java/awt/image/PixelGrabber.java b/libjava/classpath/java/awt/image/PixelGrabber.java
index b8ca70c3379..70a80af3cf9 100644
--- a/libjava/classpath/java/awt/image/PixelGrabber.java
+++ b/libjava/classpath/java/awt/image/PixelGrabber.java
@@ -112,7 +112,8 @@ public class PixelGrabber implements ImageConsumer
* in the grab rectangle will be stored at
* <code>pix[(n - y) * scansize + (m - x) + off]</code>.
*
- * @param ip the ImageProducer from which to grab pixels
+ * @param ip the ImageProducer from which to grab pixels. This can
+ * be null.
* @param x the x coordinate of the grab rectangle's top-left pixel,
* specified relative to the top-left corner of the image produced
* by <code>ip</code>
@@ -131,9 +132,6 @@ public class PixelGrabber implements ImageConsumer
public PixelGrabber(ImageProducer ip, int x, int y, int w, int h,
int pix[], int off, int scansize)
{
- if (ip == null)
- throw new NullPointerException("The ImageProducer must not be null.");
-
this.ip = ip;
this.x = x;
this.y = y;
@@ -222,7 +220,6 @@ public class PixelGrabber implements ImageConsumer
}
catch (Exception ex)
{
- ex.printStackTrace();
imageComplete(ImageConsumer.IMAGEABORTED);
}
}
diff --git a/libjava/classpath/java/text/Bidi.java b/libjava/classpath/java/text/Bidi.java
index 43743604570..05b10f52d6a 100644
--- a/libjava/classpath/java/text/Bidi.java
+++ b/libjava/classpath/java/text/Bidi.java
@@ -644,6 +644,7 @@ public final class Bidi
case Character.DIRECTIONALITY_OTHER_NEUTRALS:
case Character.DIRECTIONALITY_SEGMENT_SEPARATOR:
case Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR:
+ case Character.DIRECTIONALITY_WHITESPACE:
if (neutralStart == -1)
neutralStart = i;
break;
@@ -657,7 +658,7 @@ public final class Bidi
? prevStrong
: embeddingDirection);
for (int j = neutralStart; j < i; ++j)
- types[i] = override;
+ types[j] = override;
}
prevStrong = newStrong;
neutralStart = -1;
diff --git a/libjava/classpath/javax/swing/JComponent.java b/libjava/classpath/javax/swing/JComponent.java
index b217bc78867..66c562d110b 100644
--- a/libjava/classpath/javax/swing/JComponent.java
+++ b/libjava/classpath/javax/swing/JComponent.java
@@ -2039,19 +2039,10 @@ public abstract class JComponent extends Container implements Serializable
continue;
boolean translated = false;
- try
- {
- g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
- g.translate(bounds.x, bounds.y);
- translated = true;
- children[i].paint(g);
- }
- finally
- {
- if (translated)
- g.translate(-bounds.x, -bounds.y);
- g.setClip(oldClip);
- }
+ Graphics g2 = g.create(bounds.x, bounds.y, bounds.width,
+ bounds.height);
+ children[i].paint(g2);
+ g2.dispose();
}
g.setClip(originalClip);
}
@@ -2183,13 +2174,19 @@ public abstract class JComponent extends Container implements Serializable
// Paint on the offscreen buffer.
Component root = getRoot(this);
- Image buffer = rm.getOffscreenBuffer(this, root.getWidth(),
- root.getHeight());
+ Image buffer = rm.getVolatileOffscreenBuffer(this, root.getWidth(),
+ root.getHeight());
+
+ // The volatile offscreen buffer may be null when that's not supported
+ // by the AWT backend. Fall back to normal backbuffer in this case.
+ if (buffer == null)
+ buffer = rm.getOffscreenBuffer(this, root.getWidth(), root.getHeight());
+
//Rectangle targetClip = SwingUtilities.convertRectangle(this, r, root);
Point translation = SwingUtilities.convertPoint(this, 0, 0, root);
Graphics g2 = buffer.getGraphics();
- g2.translate(translation.x, translation.y);
- g2.setClip(r.x, r.y, r.width, r.height);
+ clipAndTranslateGraphics(root, this, g2);
+ g2.clipRect(r.x, r.y, r.width, r.height);
g2 = getComponentGraphics(g2);
isPaintingDoubleBuffered = true;
try
@@ -2209,6 +2206,26 @@ public abstract class JComponent extends Container implements Serializable
}
/**
+ * Clips and translates the Graphics instance for painting on the double
+ * buffer. This has to be done, so that it reflects the component clip of the
+ * target component.
+ *
+ * @param root the root component (top-level container usually)
+ * @param target the component to be painted
+ * @param g the Graphics instance
+ */
+ private void clipAndTranslateGraphics(Component root, Component target,
+ Graphics g)
+ {
+ Component parent = target.getParent();
+ if (parent != root)
+ clipAndTranslateGraphics(root, parent, g);
+
+ g.translate(target.getX(), target.getY());
+ g.clipRect(0, 0, target.getWidth(), target.getHeight());
+ }
+
+ /**
* Performs normal painting without double buffering.
*
* @param r the area that should be repainted
diff --git a/libjava/classpath/javax/swing/JTabbedPane.java b/libjava/classpath/javax/swing/JTabbedPane.java
index 7e2864b8a44..ee6af857ee3 100644
--- a/libjava/classpath/javax/swing/JTabbedPane.java
+++ b/libjava/classpath/javax/swing/JTabbedPane.java
@@ -990,10 +990,6 @@ public class JTabbedPane extends JComponent implements Serializable,
checkIndex(index, -1, tabs.size());
if (index != getSelectedIndex())
{
- if (getSelectedIndex() != -1 && getSelectedComponent() != null)
- getSelectedComponent().hide();
- if (index != -1 && getComponentAt(index) != null)
- getComponentAt(index).show();
model.setSelectedIndex(index);
}
}
diff --git a/libjava/classpath/javax/swing/RepaintManager.java b/libjava/classpath/javax/swing/RepaintManager.java
index 4a0581c0e49..f95934123ea 100644
--- a/libjava/classpath/javax/swing/RepaintManager.java
+++ b/libjava/classpath/javax/swing/RepaintManager.java
@@ -767,10 +767,22 @@ public class RepaintManager
public Image getVolatileOffscreenBuffer(Component comp, int proposedWidth,
int proposedHeight)
{
- int maxWidth = doubleBufferMaximumSize.width;
- int maxHeight = doubleBufferMaximumSize.height;
- return comp.createVolatileImage(Math.min(maxWidth, proposedWidth),
- Math.min(maxHeight, proposedHeight));
+ Component root = getRoot(comp);
+ Image buffer = (Image) offscreenBuffers.get(root);
+ if (buffer == null
+ || buffer.getWidth(null) < proposedWidth
+ || buffer.getHeight(null) < proposedHeight
+ || !(buffer instanceof VolatileImage))
+ {
+ int width = Math.max(proposedWidth, root.getWidth());
+ width = Math.min(doubleBufferMaximumSize.width, width);
+ int height = Math.max(proposedHeight, root.getHeight());
+ height = Math.min(doubleBufferMaximumSize.height, height);
+ buffer = root.createVolatileImage(width, height);
+ if (buffer != null)
+ offscreenBuffers.put(root, buffer);
+ }
+ return buffer;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
index 56e4e7073e5..f796d9a730a 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
@@ -116,6 +116,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
this.shadow = shadow;
this.darkShadow = darkShadow;
this.highlight = highlight;
+ // Mark the button as not closing the popup, we handle this ourselves.
+ putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP, Boolean.TRUE);
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
index 1010139b8fc..43001b8dbfc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
@@ -57,7 +57,8 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI
*
* @return A new instance of <code>BasicCheckBoxUI</code>.
*/
- public static ComponentUI createUI(JComponent c) {
+ public static ComponentUI createUI(JComponent c)
+ {
return new BasicCheckBoxUI();
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
index 48195ff293b..3c8d1e8c589 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
@@ -75,12 +75,24 @@ public class BasicComboBoxRenderer
/**
* Returns preferredSize of the renderer
- *
+ *
* @return preferredSize of the renderer
*/
public Dimension getPreferredSize()
{
- return super.getPreferredSize();
+ if (this.getText() != null && ! this.getText().equals(""))
+ return super.getPreferredSize();
+ else
+ {
+ // If the combo box option's text is empty or null, it won't size
+ // properly (ie, it'll be way too short)... so we throw in a dummy
+ // space to trick the superclass's sizing methods.
+ String oldText = this.getText();
+ this.setText(" ");
+ Dimension d = super.getPreferredSize();
+ this.setText(oldText);
+ return d;
+ }
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
index ea6f9850435..2cb1623cbc2 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -921,8 +921,8 @@ public class BasicComboBoxUI extends ComboBoxUI
Object prototype = comboBox.getPrototypeDisplayValue();
if (prototype != null)
{
- Component comp = renderer.getListCellRendererComponent
- (listBox, prototype, -1, false, false);
+ Component comp = renderer.getListCellRendererComponent(listBox,
+ prototype, -1, false, false);
currentValuePane.add(comp);
comp.setFont(comboBox.getFont());
Dimension renderSize = comp.getPreferredSize();
@@ -938,8 +938,8 @@ public class BasicComboBoxUI extends ComboBoxUI
{
for (int i = 0; i < size; ++i)
{
- Component comp = renderer.getListCellRendererComponent
- (listBox, model.getElementAt(i), -1, false, false);
+ Component comp = renderer.getListCellRendererComponent(listBox,
+ model.getElementAt(i), -1, false, false);
currentValuePane.add(comp);
comp.setFont(comboBox.getFont());
Dimension renderSize = comp.getPreferredSize();
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
index 0d822955bbc..c29829d777d 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
@@ -677,7 +677,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
Point point = SwingUtilities.convertPoint((Component) e.getSource(),
e.getPoint(), list);
- MouseEvent newEvent= new MouseEvent((Component) e.getSource(),
+ MouseEvent newEvent = new MouseEvent((Component) e.getSource(),
e.getID(), e.getWhen(),
e.getModifiers(), point.x, point.y,
e.getModifiers(),
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
index 9adb0c642ba..1356db4aeec 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
@@ -699,10 +699,10 @@ public class BasicFileChooserUI extends FileChooserUI
String fileDescText;
/** Is a directory selected? */
- boolean dirSelected = false;
+ boolean dirSelected;
/** The current directory. */
- File currDir = null;
+ File currDir;
// FIXME: describe what is contained in the bottom panel
/** The bottom panel. */
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
index 6beac6c971b..23bcdc315ee 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
@@ -179,10 +179,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
protected final int RESIZE_NONE = 0;
/** The x offset from the top left corner of the JInternalFrame. */
- private transient int xOffset = 0;
+ private transient int xOffset;
/** The y offset from the top left corner of the JInternalFrame. */
- private transient int yOffset = 0;
+ private transient int yOffset;
/** The direction that the resize is occuring in. */
private transient int direction = -1;
@@ -314,7 +314,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
frame.setCursor(Cursor.getDefaultCursor());
showingCursor = Cursor.DEFAULT_CURSOR;
}
- else if (e.getSource()==frame && frame.isResizable())
+ else if (e.getSource() == frame && frame.isResizable())
{
setCursor(e);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
index 5a08b2a3982..0f6e0243fcf 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -79,7 +79,9 @@ import javax.swing.plaf.IconUIResource;
import javax.swing.plaf.InsetsUIResource;
/**
- * BasicLookAndFeel
+ * A basic implementation of Swing's Look and Feel framework. This can serve
+ * as a base for custom look and feel implementations.
+ *
* @author Andrew Selkirk
*/
public abstract class BasicLookAndFeel extends LookAndFeel
@@ -126,8 +128,11 @@ public abstract class BasicLookAndFeel extends LookAndFeel
Component target = ev.getComponent();
if (target instanceof Container)
target = ((Container) target).findComponentAt(ev.getPoint());
- if (! m.isComponentPartOfCurrentMenu(target))
- m.clearSelectedPath();
+ if (m.getSelectedPath().length > 0
+ && ! m.isComponentPartOfCurrentMenu(target))
+ {
+ m.clearSelectedPath();
+ }
}
}
@@ -193,10 +198,21 @@ public abstract class BasicLookAndFeel extends LookAndFeel
static final long serialVersionUID = -6096995660290287879L;
/**
+ * This is a key for a client property that tells the PopupHelper that
+ * it shouldn't close popups when the mouse event target has this
+ * property set. This is used when the component handles popup closing
+ * itself.
+ */
+ static final String DONT_CANCEL_POPUP = "noCancelPopup";
+
+ /**
* Helps closing menu popups when user clicks outside of the menu area.
*/
private transient PopupHelper popupHelper;
+ /**
+ * Maps the audio actions for this l&f.
+ */
private ActionMap audioActionMap;
/**
@@ -425,9 +441,15 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}
/**
- * loadResourceBundle
- * @param defaults TODO
+ * Loads the resource bundle in 'resources/basic' and adds the contained
+ * key/value pairs to the <code>defaults</code> table.
+ *
+ * @param defaults the UI defaults to load the resources into
*/
+ // FIXME: This method is not used atm and private and thus could be removed.
+ // However, I consider this method useful for providing localized
+ // descriptions and similar stuff and therefore think that we should use it
+ // instead and provide the resource bundles.
private void loadResourceBundle(UIDefaults defaults)
{
ResourceBundle bundle;
@@ -446,7 +468,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}
/**
- * initComponentDefaults
+ * Populates the <code>defaults</code> table with UI default values for
+ * colors, fonts, keybindings and much more.
+ *
* @param defaults the defaults table (<code>null</code> not permitted).
*/
protected void initComponentDefaults(UIDefaults defaults)
@@ -509,7 +533,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
return BasicIconFactory.getMenuItemCheckIcon();
}
},
- "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2),
+ "CheckBox.margin", new InsetsUIResource(2, 2, 2, 2),
"CheckBox.textIconGap", new Integer(4),
"CheckBox.textShiftOffset", new Integer(0),
"CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog",
@@ -599,7 +623,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ctrl F4", "close",
"KP_DOWN", "down",
"ctrl F10", "maximize",
- "ctrl alt shift F6","selectPreviousFrame"
+ "ctrl alt shift F6", "selectPreviousFrame"
}),
"DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
@@ -1069,14 +1093,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"PAGE_DOWN", "positiveBlockIncrement",
"END", "maxScroll",
"HOME", "minScroll",
- "LEFT", "positiveUnitIncrement",
+ "LEFT", "negativeUnitIncrement",
"KP_UP", "negativeUnitIncrement",
"KP_DOWN", "positiveUnitIncrement",
"UP", "negativeUnitIncrement",
- "RIGHT", "negativeUnitIncrement",
- "KP_LEFT", "positiveUnitIncrement",
+ "RIGHT", "positiveUnitIncrement",
+ "KP_LEFT", "negativeUnitIncrement",
"DOWN", "positiveUnitIncrement",
- "KP_RIGHT", "negativeUnitIncrement"
+ "KP_RIGHT", "positiveUnitIncrement"
}),
"ScrollBar.foreground", new ColorUIResource(light),
"ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096),
@@ -1091,7 +1115,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"PAGE_UP", "scrollUp",
"KP_LEFT", "unitScrollLeft",
- "ctrl PAGE_DOWN","scrollRight",
+ "ctrl PAGE_DOWN", "scrollRight",
"PAGE_DOWN", "scrollDown",
"KP_RIGHT", "unitScrollRight",
"LEFT", "unitScrollLeft",
@@ -1167,7 +1191,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"SplitPaneDivider.border", BasicBorders.getSplitPaneDividerBorder(),
"SplitPaneDivider.draggingColor", new ColorUIResource(Color.DARK_GRAY),
"TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "ctrl PAGE_DOWN","navigatePageDown",
+ "ctrl PAGE_DOWN", "navigatePageDown",
"ctrl PAGE_UP", "navigatePageUp",
"ctrl UP", "requestFocus",
"ctrl KP_UP", "requestFocus"
@@ -1220,13 +1244,13 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"COPY", "copy",
"ctrl KP_UP", "selectPreviousRowChangeLead",
"PASTE", "paste",
- "shift PAGE_DOWN","scrollDownExtendSelection",
+ "shift PAGE_DOWN", "scrollDownExtendSelection",
"PAGE_DOWN", "scrollDownChangeSelection",
"END", "selectLastColumn",
"shift END", "selectLastColumnExtendSelection",
"HOME", "selectFirstColumn",
"ctrl END", "selectLastRow",
- "ctrl shift END","selectLastRowExtendSelection",
+ "ctrl shift END", "selectLastRowExtendSelection",
"LEFT", "selectPreviousColumn",
"shift HOME", "selectFirstColumnExtendSelection",
"UP", "selectPreviousRow",
@@ -1234,7 +1258,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ctrl HOME", "selectFirstRow",
"shift LEFT", "selectPreviousColumnExtendSelection",
"DOWN", "selectNextRow",
- "ctrl shift HOME","selectFirstRowExtendSelection",
+ "ctrl shift HOME", "selectFirstRowExtendSelection",
"shift UP", "selectPreviousRowExtendSelection",
"F2", "startEditing",
"shift RIGHT", "selectNextColumnExtendSelection",
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
index 69c9c4507b0..63a09bff6a2 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -239,9 +239,10 @@ public class BasicMenuItemUI extends MenuItemUI
{
if (e.getPropertyName() == "accelerator")
{
- InputMap map = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
+ InputMap map = SwingUtilities.getUIInputMap(menuItem,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
if (map != null)
- map.remove((KeyStroke)e.getOldValue());
+ map.remove((KeyStroke) e.getOldValue());
else
map = new ComponentInputMapUIResource(menuItem);
@@ -499,7 +500,8 @@ public class BasicMenuItemUI extends MenuItemUI
*/
public Dimension getPreferredSize(JComponent c)
{
- return getPreferredMenuItemSize(c, checkIcon, arrowIcon, defaultTextIconGap);
+ return getPreferredMenuItemSize(c, checkIcon, arrowIcon,
+ defaultTextIconGap);
}
/**
@@ -535,8 +537,10 @@ public class BasicMenuItemUI extends MenuItemUI
prefix + ".foreground", prefix + ".font");
menuItem.setMargin(UIManager.getInsets(prefix + ".margin"));
acceleratorFont = UIManager.getFont(prefix + ".acceleratorFont");
- acceleratorForeground = UIManager.getColor(prefix + ".acceleratorForeground");
- acceleratorSelectionForeground = UIManager.getColor(prefix + ".acceleratorSelectionForeground");
+ acceleratorForeground = UIManager.getColor(prefix
+ + ".acceleratorForeground");
+ acceleratorSelectionForeground = UIManager.getColor(prefix
+ + ".acceleratorSelectionForeground");
selectionBackground = UIManager.getColor(prefix + ".selectionBackground");
selectionForeground = UIManager.getColor(prefix + ".selectionForeground");
acceleratorDelimiter = UIManager.getString(prefix + ".acceleratorDelimiter");
@@ -551,13 +555,15 @@ public class BasicMenuItemUI extends MenuItemUI
*/
protected void installKeyboardActions()
{
- InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
+ InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
if (focusedWindowMap == null)
focusedWindowMap = new ComponentInputMapUIResource(menuItem);
KeyStroke accelerator = menuItem.getAccelerator();
if (accelerator != null)
focusedWindowMap.put(accelerator, "doClick");
- SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap);
+ SwingUtilities.replaceUIInputMap(menuItem,
+ JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap);
ActionMap UIActionMap = SwingUtilities.getUIActionMap(menuItem);
if (UIActionMap == null)
@@ -1268,8 +1274,8 @@ public class BasicMenuItemUI extends MenuItemUI
Insets insets = m.getInsets();
viewRect.x += insets.left;
viewRect.y += insets.top;
- viewRect.width -= (insets.left + insets.right);
- viewRect.height -= (insets.top + insets.bottom);
+ viewRect.width -= insets.left + insets.right;
+ viewRect.height -= insets.top + insets.bottom;
// Fetch the fonts.
Font font = m.getFont();
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
index 91bf614340d..9acf8210d9e 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -139,8 +139,8 @@ public class BasicOptionPaneUI extends OptionPaneUI
((JDialog) owner).dispose();
//else we probably have some kind of internal frame.
- JInternalFrame inf = (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class,
- optionPane);
+ JInternalFrame inf = (JInternalFrame) SwingUtilities.getAncestorOfClass(
+ JInternalFrame.class, optionPane);
if (inf != null)
{
try
@@ -433,7 +433,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
public static final int MinimumHeight = 90;
/** Whether the JOptionPane contains custom components. */
- protected boolean hasCustomComponents = false;
+ protected boolean hasCustomComponents;
// The initialFocusComponent seems to always be set to a button (even if
// I try to set initialSelectionValue). This is different from what the
@@ -821,8 +821,8 @@ public class BasicOptionPaneUI extends OptionPaneUI
if (remainder.length() == 0)
return;
- // Recursivly call ourselves to burst the remainder of the string,
- if ((remainder.length() > maxll || remainder.contains("\n")))
+ // Recursively call ourselves to burst the remainder of the string,
+ if (remainder.length() > maxll || remainder.contains("\n"))
burstStringInto(c, remainder, maxll);
else
// Add the remainder to the container and be done.
@@ -979,7 +979,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
case JOptionPane.DEFAULT_OPTION:
return (optionPane.getWantsInput()) ?
new Object[] { OK_STRING, CANCEL_STRING } :
- ( optionPane.getMessageType() == JOptionPane.QUESTION_MESSAGE ) ?
+ (optionPane.getMessageType() == JOptionPane.QUESTION_MESSAGE) ?
new Object[] { YES_STRING, NO_STRING, CANCEL_STRING } :
// ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, PLAIN_MESSAGE
new Object[] { OK_STRING };
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
index 2518a91997a..df4c3aebdfd 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
@@ -384,7 +384,7 @@ public class BasicProgressBarUI extends ProgressBarUI
}
int index = getAnimationIndex();
- if (animationIndex > (numFrames) / 2)
+ if (animationIndex > numFrames / 2)
index = numFrames - getAnimationIndex();
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
@@ -671,7 +671,8 @@ public class BasicProgressBarUI extends ProgressBarUI
else
{
g.setColor(c.getForeground());
- g.fillRect(vr.x, vr.y + vr.height - amountFull, vr.width, amountFull);
+ g.fillRect(vr.x, vr.y + vr.height - amountFull, vr.width,
+ amountFull);
}
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
index 64a1deca572..a7da21c4f6e 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -70,7 +70,8 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
*
* @return a new instance of <code>BasicRadioButtonUI</code>
*/
- public static ComponentUI createUI(final JComponent c) {
+ public static ComponentUI createUI(final JComponent c)
+ {
return new BasicRadioButtonUI();
}
@@ -155,8 +156,8 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
currentIcon = b.getDisabledIcon();
SwingUtilities.calculateInnerArea(b, vr);
- String text = SwingUtilities.layoutCompoundLabel
- (c, g.getFontMetrics(f), b.getText(), currentIcon,
+ String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
+ b.getText(), currentIcon,
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
vr, ir, tr, b.getIconTextGap() + defaultTextShiftOffset);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
index f2448548472..b29026342e0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -1,5 +1,5 @@
/* BasicScrollBarUI.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
@@ -56,10 +54,14 @@ import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
import javax.swing.BoundedRangeModel;
+import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
+import javax.swing.JSlider;
import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
@@ -67,6 +69,7 @@ import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI;
@@ -397,9 +400,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
return false;
if (direction == POSITIVE_SCROLL)
- return (value > scrollbar.getValue());
+ return value > scrollbar.getValue();
else
- return (value < scrollbar.getValue());
+ return value < scrollbar.getValue();
}
}
@@ -724,7 +727,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
int orientation = scrollbar.getOrientation();
switch (orientation)
{
- case (JScrollBar.HORIZONTAL):
+ case JScrollBar.HORIZONTAL:
incrButton = createIncreaseButton(EAST);
decrButton = createDecreaseButton(WEST);
break;
@@ -762,15 +765,151 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs the keyboard actions for the scrollbar.
+ * Installs the input map from the look and feel defaults, and a
+ * corresponding action map. Note the the keyboard bindings will only
+ * work when the {@link JScrollBar} component has the focus, which is rare.
*/
protected void installKeyboardActions()
- throws NotImplementedException
{
- // FIXME: implement.
+ InputMap keyMap = getInputMap(
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ SwingUtilities.replaceUIInputMap(scrollbar,
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, keyMap);
+ ActionMap map = getActionMap();
+ SwingUtilities.replaceUIActionMap(scrollbar, map);
+ }
+
+ /**
+ * Uninstalls the input map and action map installed by
+ * {@link #installKeyboardActions()}.
+ */
+ protected void uninstallKeyboardActions()
+ {
+ SwingUtilities.replaceUIActionMap(scrollbar, null);
+ SwingUtilities.replaceUIInputMap(scrollbar,
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
+ }
+
+ InputMap getInputMap(int condition)
+ {
+ if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+ return (InputMap) UIManager.get("ScrollBar.focusInputMap");
+ return null;
+ }
+
+ /**
+ * Returns the action map for the {@link JScrollBar}. All scroll bars
+ * share a single action map which is created the first time this method is
+ * called, then stored in the UIDefaults table for subsequent access.
+ *
+ * @return The shared action map.
+ */
+ ActionMap getActionMap()
+ {
+ ActionMap map = (ActionMap) UIManager.get("ScrollBar.actionMap");
+
+ if (map == null) // first time here
+ {
+ map = createActionMap();
+ if (map != null)
+ UIManager.put("ScrollBar.actionMap", map);
+ }
+ return map;
}
/**
+ * Creates the action map shared by all {@link JSlider} instances.
+ * This method is called once by {@link #getActionMap()} when it
+ * finds no action map in the UIDefaults table...after the map is
+ * created, it gets added to the defaults table so that subsequent
+ * calls to {@link #getActionMap()} will return the same shared
+ * instance.
+ *
+ * @return The action map.
+ */
+ ActionMap createActionMap()
+ {
+ ActionMap map = new ActionMapUIResource();
+ map.put("positiveUnitIncrement",
+ new AbstractAction("positiveUnitIncrement") {
+ public void actionPerformed(ActionEvent event)
+ {
+ JScrollBar sb = (JScrollBar) event.getSource();
+ if (sb.isVisible())
+ {
+ int delta = sb.getUnitIncrement(1);
+ sb.setValue(sb.getValue() + delta);
+ }
+ }
+ }
+ );
+ map.put("positiveBlockIncrement",
+ new AbstractAction("positiveBlockIncrement") {
+ public void actionPerformed(ActionEvent event)
+ {
+ JScrollBar sb = (JScrollBar) event.getSource();
+ if (sb.isVisible())
+ {
+ int delta = sb.getBlockIncrement(1);
+ sb.setValue(sb.getValue() + delta);
+ }
+ }
+ }
+ );
+ map.put("negativeUnitIncrement",
+ new AbstractAction("negativeUnitIncrement") {
+ public void actionPerformed(ActionEvent event)
+ {
+ JScrollBar sb = (JScrollBar) event.getSource();
+ if (sb.isVisible())
+ {
+ int delta = sb.getUnitIncrement(-1);
+ sb.setValue(sb.getValue() + delta);
+ }
+ }
+ }
+ );
+ map.put("negativeBlockIncrement",
+ new AbstractAction("negativeBlockIncrement") {
+ public void actionPerformed(ActionEvent event)
+ {
+ JScrollBar sb = (JScrollBar) event.getSource();
+ if (sb.isVisible())
+ {
+ int delta = sb.getBlockIncrement(-1);
+ sb.setValue(sb.getValue() + delta);
+ }
+ }
+ }
+ );
+ map.put("minScroll",
+ new AbstractAction("minScroll") {
+ public void actionPerformed(ActionEvent event)
+ {
+ JScrollBar sb = (JScrollBar) event.getSource();
+ if (sb.isVisible())
+ {
+ sb.setValue(sb.getMinimum());
+ }
+ }
+ }
+ );
+ map.put("maxScroll",
+ new AbstractAction("maxScroll") {
+ public void actionPerformed(ActionEvent event)
+ {
+ JScrollBar sb = (JScrollBar) event.getSource();
+ if (sb.isVisible())
+ {
+ sb.setValue(sb.getMaximum());
+ }
+ }
+ }
+ );
+ return map;
+ }
+
+ /**
* This method installs any listeners for the scrollbar. This method also
* installs listeners for things such as the JButtons and the timer.
*/
@@ -806,19 +945,20 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
super.installUI(c);
if (c instanceof JScrollBar)
{
- scrollbar = (JScrollBar) c;
+ scrollbar = (JScrollBar) c;
- trackRect = new Rectangle();
- thumbRect = new Rectangle();
+ trackRect = new Rectangle();
+ thumbRect = new Rectangle();
- scrollTimer = new Timer(300, null);
+ scrollTimer = new Timer(300, null);
installDefaults();
- installComponents();
- configureScrollBarColors();
- installListeners();
+ installComponents();
+ configureScrollBarColors();
+ installListeners();
+ installKeyboardActions();
- calculatePreferredSize();
+ calculatePreferredSize();
}
}
@@ -1140,16 +1280,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any keyboard actions this scrollbar acquired
- * during install.
- */
- protected void uninstallKeyboardActions()
- throws NotImplementedException
- {
- // FIXME: implement.
- }
-
- /**
* This method uninstalls any listeners that were registered during install.
*/
protected void uninstallListeners()
@@ -1186,6 +1316,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void uninstallUI(JComponent c)
{
+ uninstallKeyboardActions();
uninstallListeners();
uninstallDefaults();
uninstallComponents();
@@ -1226,9 +1357,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// If the length is 0, you shouldn't be able to even see where the thumb is.
// This really shouldn't ever happen, but just in case, we'll return the middle.
if (len == 0)
- return ((max - min) / 2);
+ return (max - min) / 2;
- value = ((yPos - trackRect.y) * (max - min) / len + min);
+ value = (yPos - trackRect.y) * (max - min) / len + min;
// If this isn't a legal value, then we'll have to move to one now.
if (value > max)
@@ -1259,9 +1390,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// If the length is 0, you shouldn't be able to even see where the slider is.
// This really shouldn't ever happen, but just in case, we'll return the middle.
if (len == 0)
- return ((max - min) / 2);
+ return (max - min) / 2;
- value = ((xPos - trackRect.x) * (max - min) / len + min);
+ value = (xPos - trackRect.x) * (max - min) / len + min;
// If this isn't a legal value, then we'll have to move to one now.
if (value > max)
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
index 03fb2255e88..a0616a8c1cf 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
@@ -516,7 +516,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI
{
map = createActionMap();
if (map != null)
- UIManager.put("Slider.actionMap", map);
+ UIManager.put("ScrollPane.actionMap", map);
}
return map;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
index 0569768a627..2fb16f12e63 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
@@ -68,7 +68,6 @@ import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.LookAndFeel;
-import javax.swing.RepaintManager;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;
@@ -483,9 +482,9 @@ public class BasicSliderUI extends SliderUI
value = valueForYPosition(currentMouseY);
if (direction == POSITIVE_SCROLL)
- return (value > slider.getValue());
+ return value > slider.getValue();
else
- return (value < slider.getValue());
+ return value < slider.getValue();
}
}
@@ -1152,10 +1151,6 @@ public class BasicSliderUI extends SliderUI
Dimension d = getThumbSize();
thumbRect.width = d.width;
thumbRect.height = d.height;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- thumbRect.y = trackRect.y;
- else
- thumbRect.x = trackRect.x;
}
/**
@@ -1189,11 +1184,11 @@ public class BasicSliderUI extends SliderUI
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
- thumbRect.y = trackRect.y;
+ thumbRect.y = trackRect.y + 1;
}
else
{
- thumbRect.x = trackRect.x;
+ thumbRect.x = trackRect.x + 1;
thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
}
}
@@ -1298,7 +1293,11 @@ public class BasicSliderUI extends SliderUI
tickRect.x = trackRect.x;
tickRect.y = trackRect.y + trackRect.height;
tickRect.width = trackRect.width;
- tickRect.height = (slider.getPaintTicks() ? getTickLength() : 0);
+ tickRect.height = slider.getPaintTicks() ? getTickLength() : 0;
+
+ // this makes our Mauve tests pass...can't explain it!
+ if (!slider.getPaintTicks())
+ tickRect.y--;
if (tickRect.y + tickRect.height > contentRect.y + contentRect.height)
tickRect.height = contentRect.y + contentRect.height - tickRect.y;
@@ -1307,33 +1306,55 @@ public class BasicSliderUI extends SliderUI
{
tickRect.x = trackRect.x + trackRect.width;
tickRect.y = trackRect.y;
- tickRect.width = (slider.getPaintTicks() ? getTickLength() : 0);
+ tickRect.width = slider.getPaintTicks() ? getTickLength() : 0;
tickRect.height = trackRect.height;
+ // this makes our Mauve tests pass...can't explain it!
+ if (!slider.getPaintTicks())
+ tickRect.x--;
+
if (tickRect.x + tickRect.width > contentRect.x + contentRect.width)
tickRect.width = contentRect.x + contentRect.width - tickRect.x;
}
}
/**
- * This method calculates the size and position of the labelRect. It must
- * take into account the orientation of the slider.
+ * Calculates the <code>labelRect</code> field, taking into account the
+ * orientation of the slider.
*/
protected void calculateLabelRect()
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- labelRect.x = contentRect.x;
- labelRect.y = tickRect.y + tickRect.height;
- labelRect.width = contentRect.width;
+ if (slider.getPaintLabels())
+ {
+ labelRect.x = contentRect.x;
+ labelRect.y = tickRect.y + tickRect.height - 1;
+ labelRect.width = contentRect.width;
+ }
+ else
+ {
+ labelRect.x = trackRect.x;
+ labelRect.y = tickRect.y + tickRect.height;
+ labelRect.width = trackRect.width;
+ }
labelRect.height = getHeightOfTallestLabel();
}
else
{
- labelRect.x = tickRect.x + tickRect.width;
- labelRect.y = contentRect.y;
+ if (slider.getPaintLabels())
+ {
+ labelRect.x = tickRect.x + tickRect.width - 1;
+ labelRect.y = contentRect.y;
+ labelRect.height = contentRect.height;
+ }
+ else
+ {
+ labelRect.x = tickRect.x + tickRect.width;
+ labelRect.y = trackRect.y;
+ labelRect.height = trackRect.height;
+ }
labelRect.width = getWidthOfWidestLabel();
- labelRect.height = contentRect.height;
}
}
@@ -1644,7 +1665,7 @@ public class BasicSliderUI extends SliderUI
int width;
int height;
- Point a = new Point(trackRect.x, trackRect.y);
+ Point a = new Point(trackRect.x, trackRect.y + 1);
Point b = new Point(a);
Point c = new Point(a);
Point d = new Point(a);
@@ -2226,12 +2247,12 @@ public class BasicSliderUI extends SliderUI
// is. This really shouldn't ever happen, but just in case, we'll return
// the middle.
if (len == 0)
- return ((max - min) / 2);
+ return (max - min) / 2;
if (! drawInverted())
- value = ((len - (yPos - trackRect.y)) * (max - min) / len + min);
+ value = (len - (yPos - trackRect.y)) * (max - min) / len + min;
else
- value = ((yPos - trackRect.y) * (max - min) / len + min);
+ value = (yPos - trackRect.y) * (max - min) / len + min;
// If this isn't a legal value, then we'll have to move to one now.
if (value > max)
@@ -2262,12 +2283,12 @@ public class BasicSliderUI extends SliderUI
// is. This really shouldn't ever happen, but just in case, we'll return
// the middle.
if (len == 0)
- return ((max - min) / 2);
+ return (max - min) / 2;
if (! drawInverted())
- value = ((xPos - trackRect.x) * (max - min) / len + min);
+ value = (xPos - trackRect.x) * (max - min) / len + min;
else
- value = ((len - (xPos - trackRect.x)) * (max - min) / len + min);
+ value = (len - (xPos - trackRect.x)) * (max - min) / len + min;
// If this isn't a legal value, then we'll have to move to one now.
if (value > max)
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index 1b5249770ec..1b2552837c6 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -530,6 +530,20 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int tabPlacement = tabPane.getTabPlacement();
Insets insets = tabPane.getInsets();
+
+ int selectedIndex = tabPane.getSelectedIndex();
+
+ Component selectedComponent = null;
+ if (selectedIndex >= 0)
+ selectedComponent = tabPane.getComponentAt(selectedIndex);
+ // The RI doesn't seem to change the component if the new selected
+ // component == null. This is probably so that applications can add
+ // one single component for every tab.
+ if (selectedComponent != null)
+ {
+ setVisibleComponent(selectedComponent);
+ }
+
int childCount = tabPane.getComponentCount();
if (childCount > 0)
{
@@ -1411,6 +1425,11 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
private boolean tabsOpaque;
/**
+ * The currently visible component.
+ */
+ private Component visibleComponent;
+
+ /**
* Creates a new BasicTabbedPaneUI object.
*/
public BasicTabbedPaneUI()
@@ -2479,7 +2498,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
protected Component getVisibleComponent()
{
- return tabPane.getComponentAt(tabPane.getSelectedIndex());
+ return visibleComponent;
}
/**
@@ -2489,8 +2508,19 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
protected void setVisibleComponent(Component component)
{
- component.setVisible(true);
- tabPane.setSelectedComponent(component);
+ // Make old component invisible.
+ if (visibleComponent != null && visibleComponent != component
+ && visibleComponent.getParent() == tabPane)
+ {
+ visibleComponent.setVisible(false);
+ }
+
+ // Make new component visible.
+ if (component != null && ! component.isVisible())
+ {
+ component.setVisible(true);
+ }
+ visibleComponent = component;
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
index ce8846ff8af..abe7cab43b3 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
@@ -249,11 +249,11 @@ public class BasicTableHeaderUI extends TableHeaderUI
originalCursor = header.getCursor();
if (p < x)
- header.setCursor(Cursor.getPredefinedCursor
- (Cursor.W_RESIZE_CURSOR));
+ header.setCursor(Cursor.getPredefinedCursor(
+ Cursor.W_RESIZE_CURSOR));
else
- header.setCursor(Cursor.getPredefinedCursor
- (Cursor.E_RESIZE_CURSOR));
+ header.setCursor(Cursor.getPredefinedCursor(
+ Cursor.E_RESIZE_CURSOR));
}
else
{
@@ -368,7 +368,7 @@ public class BasicTableHeaderUI extends TableHeaderUI
int x = e.getX();
int p = 0;
- int col = model.getColumnCount()-1;
+ int col = model.getColumnCount() - 1;
int n = model.getColumnCount();
// This loop does not find the column if the mouse if out of the
@@ -504,7 +504,7 @@ public class BasicTableHeaderUI extends TableHeaderUI
comp.setBackground(header.getBackground());
comp.setForeground(header.getForeground());
if (comp instanceof JComponent)
- ((JComponent)comp).setBorder(cellBorder);
+ ((JComponent) comp).setBorder(cellBorder);
rendererPane.paintComponent(gfx, comp, header, bounds.x, bounds.y,
bounds.width, bounds.height);
}
@@ -513,11 +513,11 @@ public class BasicTableHeaderUI extends TableHeaderUI
// This displays a running rectangle that is much simplier than the total
// animation, as it is seen in Sun's application.
// TODO animate the collumn dragging like in Sun's jre.
- if (draggingHeaderRect!=null)
+ if (draggingHeaderRect != null)
{
gfx.setColor(header.getForeground());
- gfx.drawRect(draggingHeaderRect.x, draggingHeaderRect.y+2,
- draggingHeaderRect.width-1, draggingHeaderRect.height-6);
+ gfx.drawRect(draggingHeaderRect.x, draggingHeaderRect.y + 2,
+ draggingHeaderRect.width - 1, draggingHeaderRect.height - 6);
}
}
@@ -533,7 +533,7 @@ public class BasicTableHeaderUI extends TableHeaderUI
TableColumnModel cmod = header.getColumnModel();
TableCellRenderer defaultRend = header.getDefaultRenderer();
int ncols = cmod.getColumnCount();
- Dimension ret = new Dimension(0,0);
+ Dimension ret = new Dimension(0, 0);
int spacing = 0;
if (header.getTable() != null
@@ -556,7 +556,7 @@ public class BasicTableHeaderUI extends TableHeaderUI
comp.setBackground(header.getBackground());
comp.setForeground(header.getForeground());
if (comp instanceof JComponent)
- ((JComponent)comp).setBorder(cellBorder);
+ ((JComponent) comp).setBorder(cellBorder);
Dimension d = comp.getPreferredSize();
ret.width += spacing;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
index d3abba217cd..cdd44a711e7 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
@@ -269,8 +269,8 @@ public class BasicTableUI extends TableUI
begin = new Point(e.getX(), e.getY());
curr = new Point(e.getX(), e.getY());
//if control is pressed and the cell is already selected, deselect it
- if (e.isControlDown() && table.
- isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin)))
+ if (e.isControlDown() && table.isCellSelected(
+ table.rowAtPoint(begin), table.columnAtPoint(begin)))
{
table.getSelectionModel().
removeSelectionInterval(table.rowAtPoint(begin),
@@ -467,22 +467,21 @@ public class BasicTableUI extends TableUI
// Register key bindings in the UI InputMap-ActionMap pair
for (int i = 0; i < keys.length; i++)
{
- KeyStroke stroke = (KeyStroke)keys[i];
+ KeyStroke stroke = (KeyStroke) keys[i];
String actionString = (String) ancestorMap.get(stroke);
parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(),
stroke.getModifiers()),
actionString);
- parentActionMap.put (actionString,
- new ActionListenerProxy (action, actionString));
+ parentActionMap.put(actionString,
+ new ActionListenerProxy(action, actionString));
}
// Set the UI InputMap-ActionMap pair to be the parents of the
// JTable's InputMap-ActionMap pair
- parentInputMap.setParent
- (table.getInputMap
- (JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).getParent());
+ parentInputMap.setParent(table.getInputMap(
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).getParent());
parentActionMap.setParent(table.getActionMap().getParent());
table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
setParent(parentInputMap);
@@ -532,10 +531,12 @@ public class BasicTableUI extends TableUI
*
* @param e the ActionEvent that caused this action.
*/
- public void actionPerformed (ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
- DefaultListSelectionModel rowModel = (DefaultListSelectionModel) table.getSelectionModel();
- DefaultListSelectionModel colModel = (DefaultListSelectionModel) table.getColumnModel().getSelectionModel();
+ DefaultListSelectionModel rowModel
+ = (DefaultListSelectionModel) table.getSelectionModel();
+ DefaultListSelectionModel colModel
+ = (DefaultListSelectionModel) table.getColumnModel().getSelectionModel();
int rowLead = rowModel.getLeadSelectionIndex();
int rowMax = table.getModel().getRowCount() - 1;
@@ -556,7 +557,7 @@ public class BasicTableUI extends TableUI
else if (command.equals("startEditing"))
{
if (table.isCellEditable(rowLead, colLead))
- table.editCellAt(rowLead,colLead);
+ table.editCellAt(rowLead, colLead);
}
else if (command.equals("selectFirstRowExtendSelection"))
{
@@ -572,7 +573,7 @@ public class BasicTableUI extends TableUI
}
else if (command.equals("selectLastRow"))
{
- rowModel.setSelectionInterval(rowMax,rowMax);
+ rowModel.setSelectionInterval(rowMax, rowMax);
}
else if (command.equals("selectNextRowExtendSelection"))
{
@@ -580,7 +581,7 @@ public class BasicTableUI extends TableUI
}
else if (command.equals("selectFirstRow"))
{
- rowModel.setSelectionInterval(0,0);
+ rowModel.setSelectionInterval(0, 0);
}
else if (command.equals("selectNextColumnExtendSelection"))
{
@@ -603,9 +604,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (rowLead == getFirstVisibleRowIndex())
- target = Math.max
- (0, rowLead - (getLastVisibleRowIndex() -
- getFirstVisibleRowIndex() + 1));
+ target = Math.max(0, rowLead - (getLastVisibleRowIndex()
+ - getFirstVisibleRowIndex() + 1));
else
target = getFirstVisibleRowIndex();
@@ -621,9 +621,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (colLead == getLastVisibleColumnIndex())
- target = Math.min
- (colMax, colLead + (getLastVisibleColumnIndex() -
- getFirstVisibleColumnIndex() + 1));
+ target = Math.min(colMax, colLead + (getLastVisibleColumnIndex()
+ - getFirstVisibleColumnIndex() + 1));
else
target = getLastVisibleColumnIndex();
@@ -639,9 +638,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (colLead == getFirstVisibleColumnIndex())
- target = Math.max
- (0, colLead - (getLastVisibleColumnIndex() -
- getFirstVisibleColumnIndex() + 1));
+ target = Math.max(0, colLead - (getLastVisibleColumnIndex()
+ - getFirstVisibleColumnIndex() + 1));
else
target = getFirstVisibleColumnIndex();
@@ -701,12 +699,10 @@ public class BasicTableUI extends TableUI
{
if (command.indexOf("Column") != -1)
advanceSingleSelection(colModel, colMax, rowModel, rowMax,
- (command.equals
- ("selectPreviousColumnCell")));
+ command.equals("selectPreviousColumnCell"));
else
advanceSingleSelection(rowModel, rowMax, colModel, colMax,
- (command.equals
- ("selectPreviousRowCell")));
+ command.equals("selectPreviousRowCell"));
return;
}
@@ -728,15 +724,13 @@ public class BasicTableUI extends TableUI
// cell and wrap at the edges of the selection.
if (command.indexOf("Column") != -1)
advanceMultipleSelection(colModel, colMinSelected, colMaxSelected,
- rowModel, rowMinSelected, rowMaxSelected,
- (command.equals
- ("selectPreviousColumnCell")), true);
+ rowModel, rowMinSelected, rowMaxSelected,
+ command.equals("selectPreviousColumnCell"), true);
else
advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected,
- colModel, colMinSelected, colMaxSelected,
- (command.equals
- ("selectPreviousRowCell")), false);
+ colModel, colMinSelected, colMaxSelected,
+ command.equals("selectPreviousRowCell"), false);
}
else if (command.equals("selectNextColumn"))
{
@@ -747,9 +741,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (colLead == getFirstVisibleColumnIndex())
- target = Math.max
- (0, colLead - (getLastVisibleColumnIndex() -
- getFirstVisibleColumnIndex() + 1));
+ target = Math.max(0, colLead - (getLastVisibleColumnIndex()
+ - getFirstVisibleColumnIndex() + 1));
else
target = getFirstVisibleColumnIndex();
@@ -760,9 +753,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (rowLead == getLastVisibleRowIndex())
- target = Math.min
- (rowMax, rowLead + (getLastVisibleRowIndex() -
- getFirstVisibleRowIndex() + 1));
+ target = Math.min(rowMax, rowLead + (getLastVisibleRowIndex()
+ - getFirstVisibleRowIndex() + 1));
else
target = getLastVisibleRowIndex();
@@ -773,9 +765,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (colLead == getLastVisibleColumnIndex())
- target = Math.min
- (colMax, colLead + (getLastVisibleColumnIndex() -
- getFirstVisibleColumnIndex() + 1));
+ target = Math.min(colMax, colLead + (getLastVisibleColumnIndex()
+ - getFirstVisibleColumnIndex() + 1));
else
target = getLastVisibleColumnIndex();
@@ -795,9 +786,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (rowLead == getLastVisibleRowIndex())
- target = Math.min
- (rowMax, rowLead + (getLastVisibleRowIndex() -
- getFirstVisibleRowIndex() + 1));
+ target = Math.min(rowMax, rowLead + (getLastVisibleRowIndex()
+ - getFirstVisibleRowIndex() + 1));
else
target = getLastVisibleRowIndex();
@@ -808,9 +798,8 @@ public class BasicTableUI extends TableUI
{
int target;
if (rowLead == getFirstVisibleRowIndex())
- target = Math.max
- (0, rowLead - (getLastVisibleRowIndex() -
- getFirstVisibleRowIndex() + 1));
+ target = Math.max(0, rowLead - (getLastVisibleRowIndex()
+ - getFirstVisibleRowIndex() + 1));
else
target = getFirstVisibleRowIndex();
@@ -819,34 +808,37 @@ public class BasicTableUI extends TableUI
}
else if (command.equals("selectNextRowChangeLead"))
{
- if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ if (rowModel.getSelectionMode()
+ != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
{
// just "selectNextRow"
rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
Math.min(rowLead + 1, rowMax));
- colModel.setSelectionInterval(colLead,colLead);
+ colModel.setSelectionInterval(colLead, colLead);
}
else
rowModel.moveLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
}
else if (command.equals("selectPreviousRowChangeLead"))
{
- if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ if (rowModel.getSelectionMode()
+ != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
{
// just selectPreviousRow
rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
- Math.min(rowLead -1, 0));
- colModel.setSelectionInterval(colLead,colLead);
+ Math.min(rowLead - 1, 0));
+ colModel.setSelectionInterval(colLead, colLead);
}
else
rowModel.moveLeadSelectionIndex(Math.max(rowLead - 1, 0));
}
else if (command.equals("selectNextColumnChangeLead"))
{
- if (colModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ if (colModel.getSelectionMode()
+ != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
{
// just selectNextColumn
- rowModel.setSelectionInterval(rowLead,rowLead);
+ rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
Math.min(colLead + 1, colMax));
}
@@ -855,10 +847,11 @@ public class BasicTableUI extends TableUI
}
else if (command.equals("selectPreviousColumnChangeLead"))
{
- if (colModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ if (colModel.getSelectionMode()
+ != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
{
// just selectPreviousColumn
- rowModel.setSelectionInterval(rowLead,rowLead);
+ rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(Math.max(colLead - 1, 0),
Math.max(colLead - 1, 0));
@@ -924,9 +917,9 @@ public class BasicTableUI extends TableUI
&& command != "addToSelection")
table.editingStopped(new ChangeEvent("update"));
- table.scrollRectToVisible
- (table.getCellRect(rowModel.getLeadSelectionIndex(),
- colModel.getLeadSelectionIndex(), false));
+ table.scrollRectToVisible(table.getCellRect(
+ rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(),
+ false));
}
/**
@@ -1010,13 +1003,13 @@ public class BasicTableUI extends TableUI
* @param reverse true if shift was held for the event
* @param eventIsTab true if TAB was pressed, false if ENTER pressed
*/
- void advanceMultipleSelection (ListSelectionModel firstModel, int firstMin,
- int firstMax, ListSelectionModel secondModel,
- int secondMin, int secondMax, boolean reverse,
- boolean eventIsTab)
+ void advanceMultipleSelection(ListSelectionModel firstModel, int firstMin,
+ int firstMax, ListSelectionModel secondModel,
+ int secondMin, int secondMax, boolean reverse,
+ boolean eventIsTab)
{
- // If eventIsTab, all the "firsts" correspond to columns, otherwise, to rows
- // "seconds" correspond to the opposite
+ // If eventIsTab, all the "firsts" correspond to columns, otherwise, to
+ // rows "seconds" correspond to the opposite
int firstLead = firstModel.getLeadSelectionIndex();
int secondLead = secondModel.getLeadSelectionIndex();
int numFirsts = eventIsTab ?
@@ -1115,9 +1108,9 @@ public class BasicTableUI extends TableUI
* @param reverse true if SHIFT was pressed for the event
*/
- void advanceSingleSelection (ListSelectionModel firstModel, int firstMax,
- ListSelectionModel secondModel, int secondMax,
- boolean reverse)
+ void advanceSingleSelection(ListSelectionModel firstModel, int firstMax,
+ ListSelectionModel secondModel, int secondMax,
+ boolean reverse)
{
// for TABs, "first" corresponds to columns and "seconds" to rows.
// the opposite is true for ENTERs
@@ -1136,8 +1129,8 @@ public class BasicTableUI extends TableUI
// do we have to wrap the "seconds"?
if (reverse && (firstLead == 0) || !reverse && (firstLead == firstMax))
- secondModel.setSelectionInterval((secondLead + 1)%(secondMax + 1),
- (secondLead + 1)%(secondMax + 1));
+ secondModel.setSelectionInterval((secondLead + 1) % (secondMax + 1),
+ (secondLead + 1) % (secondMax + 1));
// if not, just reselect the current lead
else
secondModel.setSelectionInterval(secondLead, secondLead);
@@ -1152,8 +1145,8 @@ public class BasicTableUI extends TableUI
firstLead -= 2;
}
// select the next "first"
- firstModel.setSelectionInterval ((firstLead + 1)%(firstMax + 1),
- (firstLead + 1)%(firstMax + 1));
+ firstModel.setSelectionInterval((firstLead + 1) % (firstMax + 1),
+ (firstLead + 1) % (firstMax + 1));
}
}
@@ -1212,7 +1205,7 @@ public class BasicTableUI extends TableUI
public void installUI(JComponent comp)
{
- table = (JTable)comp;
+ table = (JTable) comp;
rendererPane = new CellRendererPane();
table.add(rendererPane);
@@ -1282,8 +1275,8 @@ public class BasicTableUI extends TableUI
int rowMargin = table.getRowMargin();
TableColumnModel cmodel = table.getColumnModel();
- int [] widths = new int[cn+1];
- for (int i = c0; i <=cn ; i++)
+ int[] widths = new int[cn + 1];
+ for (int i = c0; i <= cn; i++)
{
widths[i] = cmodel.getColumn(i).getWidth() - columnMargin;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
index b058175a454..34261cfe644 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
@@ -603,10 +603,12 @@ public abstract class BasicTextUI extends TextUI
// Fetch the colors for enabled/disabled text components.
background = UIManager.getColor(prefix + ".background");
inactiveBackground = UIManager.getColor(prefix + ".inactiveBackground");
- textComponent.setDisabledTextColor
- (UIManager.getColor(prefix + ".inactiveForeground"));
- textComponent.setSelectedTextColor(UIManager.getColor(prefix + ".selectionForeground"));
- textComponent.setSelectionColor(UIManager.getColor(prefix + ".selectionBackground"));
+ textComponent.setDisabledTextColor(UIManager.getColor(prefix
+ + ".inactiveForeground"));
+ textComponent.setSelectedTextColor(UIManager.getColor(prefix
+ + ".selectionForeground"));
+ textComponent.setSelectionColor(UIManager.getColor(prefix
+ + ".selectionBackground"));
}
/**
@@ -639,7 +641,8 @@ public abstract class BasicTextUI extends TextUI
Clipboard cb = Toolkit.getDefaultToolkit().getSystemSelection();
if (cb != null)
{
- StringSelection selection = new StringSelection(textComponent.getSelectedText());
+ StringSelection selection = new StringSelection(
+ textComponent.getSelectedText());
cb.setContents(selection, selection);
}
}
@@ -853,7 +856,8 @@ public abstract class BasicTextUI extends TextUI
*/
protected void uninstallKeyboardActions()
{
- SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED, null);
+ SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED,
+ null);
SwingUtilities.replaceUIActionMap(textComponent, null);
}
@@ -1114,13 +1118,14 @@ public abstract class BasicTextUI extends TextUI
&& Utilities.getRowStart(t, nextPosBelow) != p1RowStart)
{
posBelow = nextPosBelow;
- nextPosBelow = Utilities.getPositionBelow(t, posBelow, l1.x);
+ nextPosBelow = Utilities.getPositionBelow(t, posBelow,
+ l1.x);
if (posBelow == nextPosBelow)
break;
}
- // Now posBelow is an offset on the last line which has to be damaged
- // completely. (newPosBelow is on the same line as p1)
+ // Now posBelow is an offset on the last line which has to be
+ // damaged completely. (newPosBelow is on the same line as p1)
// Retrieve the rectangle of posBelow and use its y and height
// value to calculate the final height of the multiple line
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
index eabac157036..8fce2f08a66 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -417,8 +417,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
int w = 0;
int h = 0;
- boolean tmp = ((loc == SwingConstants.NORTH)
- || (loc == SwingConstants.SOUTH) || (loc == -1));
+ boolean tmp = (loc == SwingConstants.NORTH)
+ || (loc == SwingConstants.SOUTH) || (loc == -1);
cachedOrientation = toolBar.getOrientation();
cachedBounds = toolBar.getSize();
@@ -1084,7 +1084,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
isDragging = true;
if (dragWindow != null)
- dragWindow.setOffset(new Point(cachedBounds.width/2, cachedBounds.height/2));
+ dragWindow.setOffset(new Point(cachedBounds.width / 2,
+ cachedBounds.height / 2));
dragTo(e.getPoint(), origin);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
index 8cbea7f592d..4c139fe465b 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
@@ -248,7 +248,7 @@ public class BasicTreeUI
int gap = 4;
/** The max height of the nodes in the tree. */
- int maxHeight = 0;
+ int maxHeight;
/** The hash color. */
Color hashColor;
@@ -1129,7 +1129,7 @@ public class BasicTreeUI
{
Enumeration expanded = tree.getExpandedDescendants(path);
while (expanded.hasMoreElements())
- treeState.setExpandedState(((TreePath) expanded.nextElement()), true);
+ treeState.setExpandedState((TreePath) expanded.nextElement(), true);
}
/**
@@ -1140,7 +1140,7 @@ public class BasicTreeUI
*/
protected TreePath getLastChildPath(TreePath parent)
{
- return ((TreePath) parent.getLastPathComponent());
+ return (TreePath) parent.getLastPathComponent();
}
/**
@@ -1295,21 +1295,21 @@ public class BasicTreeUI
ActionMapUIResource am = new ActionMapUIResource();
Action action;
- action= new TreeAction();
+ action = new TreeAction();
am.put(action.getValue(Action.NAME), action);
// TreeHomeAction.
- action= new TreeHomeAction(-1, "selectFirst");
+ action = new TreeHomeAction(-1, "selectFirst");
am.put(action.getValue(Action.NAME), action);
- action= new TreeHomeAction(-1, "selectFirstChangeLead");
+ action = new TreeHomeAction(-1, "selectFirstChangeLead");
am.put(action.getValue(Action.NAME), action);
- action= new TreeHomeAction(-1, "selectFirstExtendSelection");
+ action = new TreeHomeAction(-1, "selectFirstExtendSelection");
am.put(action.getValue(Action.NAME), action);
- action= new TreeHomeAction(1, "selectLast");
+ action = new TreeHomeAction(1, "selectLast");
am.put(action.getValue(Action.NAME), action);
- action= new TreeHomeAction(1, "selectLastChangeLead");
+ action = new TreeHomeAction(1, "selectLastChangeLead");
am.put(action.getValue(Action.NAME), action);
- action= new TreeHomeAction(1, "selectLastExtendSelection");
+ action = new TreeHomeAction(1, "selectLastExtendSelection");
am.put(action.getValue(Action.NAME), action);
// TreeIncrementAction.
@@ -1414,8 +1414,8 @@ public class BasicTreeUI
if (treeSelectionModel != null
&& selectionModelPropertyChangeListener != null)
{
- treeSelectionModel.addPropertyChangeListener
- (selectionModelPropertyChangeListener);
+ treeSelectionModel.addPropertyChangeListener(
+ selectionModelPropertyChangeListener);
}
componentListener = createComponentListener();
@@ -1819,7 +1819,7 @@ public class BasicTreeUI
Insets i = tree.getInsets();
int left = getRowX(tree.getRowForPath(path), path.getPathCount() - 1)
- -getRightChildIndent() - width / 2 + i.left;
+ - getRightChildIndent() - width / 2 + i.left;
cntlClick = mouseX >= left && mouseX <= left + width;
}
return cntlClick;
@@ -2207,7 +2207,7 @@ public class BasicTreeUI
{
cancelEditing(tree);
}
- }// CellEditorHandler
+ } // CellEditorHandler
/**
* Repaints the lead selection row when focus is lost/grained.
@@ -2255,7 +2255,7 @@ public class BasicTreeUI
void repaintLeadRow()
{
TreePath lead = tree.getLeadSelectionPath();
- if (lead!=null)
+ if (lead != null)
tree.repaint(tree.getPathBounds(lead));
}
}
@@ -2588,7 +2588,7 @@ public class BasicTreeUI
{
return BasicTreeUI.this.getRowX(row, depth);
}
- }// NodeDimensionsHandler
+ } // NodeDimensionsHandler
/**
* PropertyChangeListener for the tree. Updates the appropriate variable, or
@@ -2742,7 +2742,7 @@ public class BasicTreeUI
tree.revalidate();
tree.repaint();
}
- }// TreeExpansionHandler
+ } // TreeExpansionHandler
/**
* TreeHomeAction is used to handle end/home actions. Scrolls either the first
@@ -3040,7 +3040,7 @@ public class BasicTreeUI
treeState.treeStructureChanged(e);
tree.repaint();
}
- }// TreeModelHandler
+ } // TreeModelHandler
/**
* TreePageAction handles page up and page down events.
@@ -3125,7 +3125,7 @@ public class BasicTreeUI
}
else
{
- newVisible.y -= (visible.height - newVisible.height);
+ newVisible.y -= visible.height - newVisible.height;
newVisible.height = visible.height;
}
@@ -3169,7 +3169,7 @@ public class BasicTreeUI
{
return (tree != null) && tree.isEnabled();
}
- }// TreePageAction
+ } // TreePageAction
/**
* Listens for changes in the selection model and updates the display
@@ -3208,13 +3208,13 @@ public class BasicTreeUI
Rectangle n = treeState.getBounds(event.getNewLeadSelectionPath(),
new Rectangle());
- if (o!=null)
+ if (o != null)
tree.repaint(o);
- if (n!=null)
+ if (n != null)
tree.repaint(n);
}
}
- }// TreeSelectionHandler
+ } // TreeSelectionHandler
/**
* For the first selected row expandedness will be toggled.
@@ -3315,7 +3315,7 @@ public class BasicTreeUI
// is not visible.
TreePath parent = current.getParentPath();
if (parent != null &&
- !(parent.getPathCount()==1 && !tree.isRootVisible()) )
+ ! (parent.getPathCount() == 1 && ! tree.isRootVisible()))
tree.setSelectionPath(parent);
}
}
@@ -3647,7 +3647,7 @@ public class BasicTreeUI
if (parent != null)
{
Rectangle parentBounds = getPathBounds(tree, parent);
- paintVerticalLine(g, tree, parentBounds.x + 2* gap,
+ paintVerticalLine(g, tree, parentBounds.x + 2 * gap,
parentBounds.y + parentBounds.height / 2,
bounds.y + bounds.height / 2);
}
@@ -3717,7 +3717,7 @@ public class BasicTreeUI
boolean isLeaf)
{
Object node = path.getLastPathComponent();
- return (! isLeaf && hasControlIcons());
+ return ! isLeaf && hasControlIcons();
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
index d6cc1bc07f9..8addfc66c72 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
-import java.awt.Container;
+import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
@@ -51,7 +51,6 @@ import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
@@ -240,63 +239,61 @@ public class MetalButtonUI
public void update(Graphics g, JComponent c)
{
AbstractButton b = (AbstractButton) c;
- if (b.isContentAreaFilled()
- && (UIManager.get(getPropertyPrefix() + "gradient") != null)
- && b.isEnabled()
- && (b.getBackground() instanceof UIResource))
- updateWidthGradient(g, b, b.getParent());
- else
- super.update(g, c);
- }
-
- private void updateWidthGradient(Graphics g, AbstractButton b, Container parent)
- {
- ButtonModel m = b.getModel();
- String gradientPropertyName = getPropertyPrefix() + "gradient";
-
- // Gradient painting behavior depends on whether the button is part of a
- // JToolBar.
- if (parent instanceof JToolBar)
+ if ((b.getBackground() instanceof UIResource)
+ && b.isContentAreaFilled() && b.isEnabled())
{
- if (! m.isPressed() && ! m.isArmed())
+ ButtonModel m = b.getModel();
+ String uiKey = "Button.gradient";
+ if (! isToolbarButton(b))
{
- if (m.isRollover())
+ if (! m.isArmed() && ! m.isPressed() && isDrawingGradient(uiKey))
{
- // Paint the gradient when the mouse cursor hovers over the
- // button but is not pressed down.
MetalUtils.paintGradient(g, 0, 0, b.getWidth(), b.getHeight(),
SwingConstants.VERTICAL,
- gradientPropertyName);
- }
- else
- {
- // If mouse does not hover over the button let the JToolBar
- // paint itself at the location where the button is (the button
- // is transparent).
-
- // There where cases where the button was not repainted and
- // therefore showed its old state. With this statement it does
- // not happen.
- b.repaint();
-
- Rectangle area = new Rectangle();
- SwingUtilities.calculateInnerArea(b, area);
- SwingUtilities.convertRectangle(b, area, b.getParent());
- b.getParent().repaint(area.x, area.y, area.width, area.height);
+ uiKey);
+ paint(g, c);
+ return;
}
}
-
- }
- else if (! m.isPressed() && ! m.isArmed())
- {
- // When the button is not part of a JToolBar just paint itself with a
- // gradient and everything is fine.
- MetalUtils.paintGradient(g, 0, 0, b.getWidth(), b.getHeight(),
- SwingConstants.VERTICAL,
- gradientPropertyName);
+ else if (m.isRollover() && isDrawingGradient(uiKey))
+ {
+ MetalUtils.paintGradient(g, 0, 0, b.getWidth(), b.getHeight(),
+ SwingConstants.VERTICAL,
+ uiKey);
+ paint(g, c);
+ return;
+ }
}
-
- paint(g, b);
+ // Fallback if we didn't have any of the two above cases.
+ super.update(g, c);
+ }
+
+ /**
+ * Returns <code>true</code> when the button is a toolbar button,
+ * <code>false</code> otherwise.
+ *
+ * @param b the button component to test
+ *
+ * @return <code>true</code> when the button is a toolbar button,
+ * <code>false</code> otherwise
+ */
+ private boolean isToolbarButton(Component b)
+ {
+ Component parent = b.getParent();
+ return parent instanceof JToolBar;
+ }
+
+ /**
+ * Returns <code>true</code> if we should draw the button gradient,
+ * <code>false</code> otherwise.
+ *
+ * @param uiKey the UIManager key for the gradient
+ *
+ * @return <code>true</code> if we should draw the button gradient,
+ * <code>false</code> otherwise
+ */
+ private boolean isDrawingGradient(String uiKey)
+ {
+ return (UIManager.get(uiKey) != null);
}
-
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
index 4e4c863c979..a317e3fc00d 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
@@ -967,7 +967,7 @@ public class MetalIconFactory implements Serializable
* This mask is used to paint the gradient in the shape of the thumb.
*/
int[][] gradientMask = new int[][] { {0, 12}, {0, 12}, {0, 12}, {0, 12},
- {0, 12}, {0, 12}, {0, 12}, {1, 12},
+ {0, 12}, {0, 12}, {0, 12}, {1, 11},
{2, 10}, {3, 9}, {4, 8}, {5, 7},
{6, 6}};
@@ -1623,7 +1623,7 @@ public class MetalIconFactory implements Serializable
* This mask is used to paint the gradient in the shape of the thumb.
*/
int[][] gradientMask = new int[][] { {0, 12}, {0, 12}, {0, 12}, {0, 12},
- {0, 12}, {0, 12}, {0, 12}, {1, 12},
+ {0, 12}, {0, 12}, {0, 12}, {1, 11},
{2, 10}, {3, 9}, {4, 8}, {5, 7},
{6, 6}};
diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
index 625ba4c3dcc..bd21e55c6fb 100644
--- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
+++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
@@ -1053,14 +1053,6 @@ public class DefaultStyledDocument extends AbstractDocument implements
Edit edit = getEditForParagraphAndIndex(paragraph, index);
edit.addAddedElement(leaf);
-
- if (end != toRec.getEndOffset())
- {
- recreateLeaves(end, toRec, onlyContent);
-
- if (onlyContent)
- edit.addRemovedElement(target);
- }
}
else
paragraph.replace(0, 0, new Element[] { leaf });
diff --git a/libjava/classpath/javax/swing/text/GapContent.java b/libjava/classpath/javax/swing/text/GapContent.java
index 1780d7ddfad..4f06003b458 100644
--- a/libjava/classpath/javax/swing/text/GapContent.java
+++ b/libjava/classpath/javax/swing/text/GapContent.java
@@ -918,7 +918,7 @@ public class GapContent
int mid = 0;
while (low <= hi)
{
- mid = (low + hi) >> 1;
+ mid = (low + hi) >>> 1;
final int d = a[mid];
if (d == key)
return mid;
diff --git a/libjava/classpath/javax/swing/text/html/HTMLDocument.java b/libjava/classpath/javax/swing/text/html/HTMLDocument.java
index b7a706904a4..e714a857b61 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLDocument.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLDocument.java
@@ -39,13 +39,15 @@ exception statement from your version. */
package javax.swing.text.html;
import gnu.classpath.NotImplementedException;
-
import gnu.javax.swing.text.html.CharacterAttributeTranslator;
+
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Stack;
import java.util.Vector;
+
+import javax.swing.JEditorPane;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
@@ -59,9 +61,15 @@ import javax.swing.text.StyleConstants;
import javax.swing.text.html.HTML.Tag;
/**
- * TODO: Add more comments here
+ * Represents the HTML document that is constructed by defining the text and
+ * other components (images, buttons, etc) in HTML language. This class can
+ * becomes the default document for {@link JEditorPane} after setting its
+ * content type to "text/html". HTML document also serves as an intermediate
+ * data structure when it is needed to parse HTML and then obtain the content of
+ * the certain types of tags. This class also has methods for modifying the HTML
+ * content.
*
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
* @author Anthony Balkissoon (abalkiss@redhat.com)
* @author Lillian Angel (langel@redhat.com)
*/
@@ -640,17 +648,25 @@ public class HTMLDocument extends DefaultStyledDocument
}
}
- public class HiddenAction extends TagAction
+ /**
+ * This action indicates that the content between starting and closing HTML
+ * elements (like script - /script) should not be visible. The content is
+ * still inserted and can be accessed when iterating the HTML document. The
+ * parser will only fire
+ * {@link javax.swing.text.html.HTMLEditorKit.ParserCallback#handleText} for
+ * the hidden tags, regardless from that html tags the hidden section may
+ * contain.
+ */
+ public class HiddenAction
+ extends TagAction
{
/**
* This method is called when a start tag is seen for one of the types
* of tags associated with this Action.
*/
public void start(HTML.Tag t, MutableAttributeSet a)
- throws NotImplementedException
{
- // FIXME: Implement.
- print ("HiddenAction.start not implemented");
+ blockOpen(t, a);
}
/**
@@ -658,10 +674,8 @@ public class HTMLDocument extends DefaultStyledDocument
* with this Action.
*/
public void end(HTML.Tag t)
- throws NotImplementedException
{
- // FIXME: Implement.
- print ("HiddenAction.end not implemented");
+ blockClose(t);
}
}
@@ -727,11 +741,17 @@ public class HTMLDocument extends DefaultStyledDocument
}
}
+ /**
+ * Inserts the elements that are represented by ths single tag with
+ * attributes (only). The closing tag, even if present, mut follow
+ * immediately after the starting tag without providing any additional
+ * information. Hence the {@link TagAction#end} method need not be
+ * overridden and still does nothing.
+ */
public class SpecialAction extends TagAction
{
/**
- * This method is called when a start tag is seen for one of the types
- * of tags associated with this Action.
+ * The functionality is delegated to {@link HTMLReader#addSpecialElement}
*/
public void start(HTML.Tag t, MutableAttributeSet a)
{
@@ -1407,10 +1427,21 @@ public class HTMLDocument extends DefaultStyledDocument
* @param a the attribute set specifying the special content
*/
protected void addSpecialElement(HTML.Tag t, MutableAttributeSet a)
- throws NotImplementedException
{
- // FIXME: Implement
- print ("HTMLReader.addSpecialElement not implemented yet");
+ a.addAttribute(StyleConstants.NameAttribute, t);
+
+ // Migrate from the rather htmlAttributeSet to the faster, lighter and
+ // unchangeable alternative implementation.
+ AttributeSet copy = a.copyAttributes();
+
+ // TODO: Figure out why we must always insert this single character
+ // (otherwise the element does not appear). Either fix or add explaining
+ // comment or at least report a normal bug.
+ DefaultStyledDocument.ElementSpec spec;
+ spec = new DefaultStyledDocument.ElementSpec(copy,
+ DefaultStyledDocument.ElementSpec.ContentType,
+ new char[] {' '}, 0, 1 );
+ parseBuffer.add(spec);
}
void printBuffer()
diff --git a/libjava/classpath/native/Makefile.am b/libjava/classpath/native/Makefile.am
index 4fa593e0327..25aa364d111 100644
--- a/libjava/classpath/native/Makefile.am
+++ b/libjava/classpath/native/Makefile.am
@@ -8,6 +8,10 @@ if CREATE_GTK_PEER_LIBRARIES
JAWTDIR = jawt
endif
-SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) target
-DIST_SUBDIRS = fdlibm jni jawt target
+if CREATE_PLUGIN
+ PLUGINDIR = plugin
+endif
+
+SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) $(PLUGINDIR) target
+DIST_SUBDIRS = fdlibm jni jawt plugin target
diff --git a/libjava/classpath/native/Makefile.in b/libjava/classpath/native/Makefile.in
index a05b06dd784..386b99b7984 100644
--- a/libjava/classpath/native/Makefile.in
+++ b/libjava/classpath/native/Makefile.in
@@ -278,8 +278,9 @@ target_vendor = @target_vendor@
vm_classes = @vm_classes@
@CREATE_JNI_LIBRARIES_TRUE@JNIDIR = jni
@CREATE_GTK_PEER_LIBRARIES_TRUE@JAWTDIR = jawt
-SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) target
-DIST_SUBDIRS = fdlibm jni jawt target
+@CREATE_PLUGIN_TRUE@PLUGINDIR = plugin
+SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) $(PLUGINDIR) target
+DIST_SUBDIRS = fdlibm jni jawt plugin target
all: all-recursive
.SUFFIXES:
diff --git a/libjava/classpath/native/jawt/Makefile.am b/libjava/classpath/native/jawt/Makefile.am
index 01abf3bb934..7c1ddcf9848 100644
--- a/libjava/classpath/native/jawt/Makefile.am
+++ b/libjava/classpath/native/jawt/Makefile.am
@@ -1,8 +1,16 @@
-nativeexeclib_LTLIBRARIES = libjawt.la
+## GCJ LOCAL: install this library in GCJ's versioned library
+## directory
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
+gcjversionedlib_LTLIBRARIES = libjawt.la
libjawt_la_SOURCES = jawt.c
libjawt_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
+## GCJ LOCAL: encode the library path and use GCJ's library version
+libjawt_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
+ -version-info `grep -v '^\#' $(top_srcdir)/../libtool-version`
+
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ @XTEST_LIBS@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
diff --git a/libjava/classpath/native/jawt/Makefile.in b/libjava/classpath/native/jawt/Makefile.in
index 683bbb9dea5..1f0101beb76 100644
--- a/libjava/classpath/native/jawt/Makefile.in
+++ b/libjava/classpath/native/jawt/Makefile.in
@@ -58,9 +58,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
-nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(gcjversionedlibdir)"
+gcjversionedlibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(gcjversionedlib_LTLIBRARIES)
libjawt_la_DEPENDENCIES = \
$(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
am_libjawt_la_OBJECTS = jawt.lo
@@ -295,9 +295,14 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-nativeexeclib_LTLIBRARIES = libjawt.la
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
+gcjversionedlib_LTLIBRARIES = libjawt.la
libjawt_la_SOURCES = jawt.c
libjawt_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
+libjawt_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
+ -version-info `grep -v '^\#' $(top_srcdir)/../libtool-version`
+
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ @XTEST_LIBS@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
@@ -339,35 +344,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+install-gcjversionedlibLTLIBRARIES: $(gcjversionedlib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
- @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(gcjversionedlibdir)" || $(mkdir_p) "$(DESTDIR)$(gcjversionedlibdir)"
+ @list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gcjversionedlibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gcjversionedlibdir)/$$f"; \
else :; fi; \
done
-uninstall-nativeexeclibLTLIBRARIES:
+uninstall-gcjversionedlibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gcjversionedlibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gcjversionedlibdir)/$$p"; \
done
-clean-nativeexeclibLTLIBRARIES:
- -test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
- @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+clean-gcjversionedlibLTLIBRARIES:
+ -test -z "$(gcjversionedlib_LTLIBRARIES)" || rm -f $(gcjversionedlib_LTLIBRARIES)
+ @list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjawt.la: $(libjawt_la_OBJECTS) $(libjawt_la_DEPENDENCIES)
- $(LINK) -rpath $(nativeexeclibdir) $(libjawt_la_LDFLAGS) $(libjawt_la_OBJECTS) $(libjawt_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(gcjversionedlibdir) $(libjawt_la_LDFLAGS) $(libjawt_la_OBJECTS) $(libjawt_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -487,7 +492,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+ for dir in "$(DESTDIR)$(gcjversionedlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -516,7 +521,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+clean-am: clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
@@ -535,9 +540,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-gcjversionedlibLTLIBRARIES
-install-exec-am: install-nativeexeclibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -563,20 +568,21 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+uninstall-am: uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am install-man \
- install-nativeexeclibLTLIBRARIES install-strip installcheck \
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am \
+ install-gcjversionedlibLTLIBRARIES install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-info-am \
- uninstall-nativeexeclibLTLIBRARIES
+ tags uninstall uninstall-am \
+ uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/gtk-peer/cairographics2d.h b/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
index 2c12384deaf..675bc0b1744 100644
--- a/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
+++ b/libjava/classpath/native/jni/gtk-peer/cairographics2d.h
@@ -113,7 +113,4 @@ struct cairographics2d
char *pattern_pixels;
};
-cairo_t *cp_gtk_get_cairo_t(JNIEnv *env,
- jobject cairographics2dobj);
-
#endif
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
index f4f7c28d37e..5aa1ada4b61 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
@@ -51,33 +51,6 @@ exception statement from your version. */
static void install_font_peer(cairo_t *cr, struct peerfont *pfont);
static void update_pattern_transform (struct cairographics2d *gr);
-static struct cairographics2d *getPointer(JNIEnv *env, jobject obj);
-
-static struct cairographics2d *
-getPointer(JNIEnv *env, jobject obj)
-{
- jclass cls;
- jlong value;
- jfieldID nofid;
- cls = (*env)->GetObjectClass( env, obj );
- nofid = (*env)->GetFieldID( env, cls, "nativePointer", "J" );
- value = (*env)->GetLongField( env, obj, nofid );
- (*env)->DeleteLocalRef( env, cls );
-
- return JLONG_TO_PTR(struct cairographics2d, value);
-}
-
-/**
- * Returns the cairo_t * associated with a CairoGraphics2D object,
- * This is used by GdkTextLayout.
- */
-cairo_t *cp_gtk_get_cairo_t(JNIEnv *env,
- jobject cairographics2dobj)
-{
- struct cairographics2d *gr = getPointer(env, cairographics2dobj);
- g_assert(gr != NULL);
- return gr->cr;
-}
/**
* Allocates the cairographics2d structure.
@@ -106,9 +79,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_init
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative
- (JNIEnv *env, jobject obj)
+ (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer(env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
if (gr == NULL)
return;
@@ -136,7 +110,8 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_disposeNative
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
- (JNIEnv *env, jobject obj,
+ (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer,
jdouble x1, jdouble y1,
jdouble x2, jdouble y2,
jint r1, jint g1, jint b1, jint a1,
@@ -147,7 +122,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
cairo_pattern_t* pattern;
cairo_extend_t extend;
- gr = getPointer (env, obj);
+ gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert( gr != NULL );
pattern = cairo_pattern_create_linear(x1, y1, x2, y2);
@@ -169,12 +144,13 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setGradient
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels
- (JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
+ (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jintArray jarr, jint w, jint h, jint stride)
{
struct cairographics2d *gr = NULL;
jint *jpixels = NULL;
- gr = getPointer (env, obj);
+ gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
if (gr->pattern)
@@ -210,12 +186,13 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setTexturePixels
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels
- (JNIEnv *env, jobject obj, jintArray java_pixels,
- jint w, jint h, jint stride, jdoubleArray java_matrix)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jintArray java_pixels,
+ jint w, jint h, jint stride, jdoubleArray java_matrix, jdouble alpha)
{
jint *native_pixels = NULL;
jdouble *native_matrix = NULL;
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL);
@@ -241,7 +218,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels
if (gr->pattern)
cairo_pattern_set_filter (p, cairo_pattern_get_filter (gr->pattern));
cairo_set_source (gr->cr, p);
- cairo_paint (gr->cr);
+ if (alpha == 1.)
+ cairo_paint (gr->cr);
+ else
+ cairo_paint_with_alpha(gr->cr, alpha);
+
cairo_pattern_destroy (p);
cairo_surface_destroy (surf);
}
@@ -253,10 +234,13 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_drawPixels
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
- (JNIEnv *env, jobject obj, jdoubleArray java_matrix)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdoubleArray java_matrix)
{
jdouble *native_matrix = NULL;
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
+ g_assert (obj != NULL);
+ g_assert (gr != NULL);
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
g_assert (native_matrix != NULL);
@@ -270,6 +254,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
native_matrix[0], native_matrix[1],
native_matrix[2], native_matrix[3],
native_matrix[4], native_matrix[5]);
+ g_assert (gr != NULL);
cairo_set_matrix (gr->cr, &mat);
}
@@ -279,11 +264,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetMatrix
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
- (JNIEnv *env, jobject obj,
- jobject font,
- jfloat x, jfloat y, jint n,
- jintArray java_codes,
- jfloatArray java_positions)
+(JNIEnv *env, jobject obj, jlong pointer,
+ jobject font,
+ jfloat x, jfloat y, jint n,
+ jintArray java_codes,
+ jfloatArray java_positions)
{
struct cairographics2d *gr = NULL;
@@ -297,7 +282,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
g_assert (java_codes != NULL);
g_assert (java_positions != NULL);
- gr = getPointer (env, obj);
+ gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
@@ -329,9 +314,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator
- (JNIEnv *env, jobject obj, jint op)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jint op)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
switch ((enum java_awt_alpha_composite_rule) op)
@@ -388,9 +374,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetOperator
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor
- (JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble r, jdouble g, jdouble b, jdouble a)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_set_source_rgba (gr->cr, r, g, b, a);
@@ -398,9 +385,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetRGBAColor
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule
- (JNIEnv *env, jobject obj, jint rule)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jint rule)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
switch ((enum java_awt_geom_path_iterator_winding_rule) rule)
@@ -419,9 +407,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
- (JNIEnv *env, jobject obj, jdouble width, int cap, int join, double miterLimit)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble width, int cap, int join, double miterLimit)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
/* set width */
@@ -468,10 +457,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash
- (JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
+(JNIEnv *env, jobject obj __attribute__((unused)),
+ jlong pointer, jdoubleArray dashes, jint ndash, jdouble offset)
{
jdouble *dasharr = NULL;
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
dasharr = (*env)->GetDoubleArrayElements (env, dashes, NULL);
@@ -484,9 +474,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath
- (JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_new_path (gr->cr);
@@ -494,9 +485,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoNewPath
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo
- (JNIEnv *env, jobject obj, jdouble x, jdouble y)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_move_to (gr->cr, x, y);
@@ -504,9 +496,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoMoveTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo
- (JNIEnv *env, jobject obj, jdouble x, jdouble y)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_line_to (gr->cr, x, y);
@@ -514,18 +507,21 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoLineTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoCurveTo
- (JNIEnv *env, jobject obj, jdouble x1, jdouble y1, jdouble x2, jdouble y2, jdouble x3, jdouble y3)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x1, jdouble y1,
+ jdouble x2, jdouble y2, jdouble x3, jdouble y3)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo
- (JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble dx, jdouble dy)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_rel_move_to (gr->cr, dx, dy);
@@ -533,9 +529,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelMoveTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo
- (JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble dx, jdouble dy)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_rel_line_to (gr->cr, dx, dy);
@@ -543,9 +540,11 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelLineTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo
- (JNIEnv *env, jobject obj, jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble dx1, jdouble dy1,
+ jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3);
@@ -553,18 +552,20 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRelCurveTo
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle
- (JNIEnv *env, jobject obj, jdouble x, jdouble y, jdouble width, jdouble height)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble x, jdouble y, jdouble width, jdouble height)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
cairo_rectangle (gr->cr, x, y, width, height);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath
- (JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_close_path (gr->cr);
@@ -572,9 +573,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClosePath
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke
- (JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_stroke (gr->cr);
@@ -582,19 +584,29 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoStroke
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFill
- (JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jdouble alpha)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
- cairo_fill (gr->cr);
+ if (alpha == 1.0)
+ cairo_fill (gr->cr);
+ else
+ {
+ cairo_save(gr->cr);
+ cairo_clip(gr->cr);
+ cairo_paint_with_alpha(gr->cr, alpha);
+ cairo_restore(gr->cr);
+ }
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip
- (JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer( env, obj );
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert( gr != NULL );
cairo_clip( gr->cr );
@@ -602,9 +614,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoClip
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip
- (JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer( env, obj );
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_reset_clip( gr->cr );
@@ -612,9 +625,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip
-(JNIEnv *env, jobject obj)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer)
{
- struct cairographics2d *gr = getPointer( env, obj );
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
cairo_clip_preserve( gr->cr );
@@ -622,9 +636,10 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter
- (JNIEnv *env, jobject obj, jint filter)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong pointer, jint filter)
{
- struct cairographics2d *gr = getPointer (env, obj);
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
g_assert (gr != NULL);
if (gr->pattern == NULL)
@@ -650,6 +665,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter
}
}
+
/************************** FONT STUFF ****************************/
static void
install_font_peer(cairo_t *cr,
@@ -700,4 +716,3 @@ update_pattern_transform (struct cairographics2d *gr)
cairo_pattern_set_matrix (gr->pattern, &mat);
}
-
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c
index 3518aead590..a25f764b4dd 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c
@@ -50,7 +50,6 @@ exception statement from your version. */
#define BUFFER "bufferPointer"
/* prototypes */
-static void *getNativeObject( JNIEnv *env, jobject obj, const char *pointer );
static void setNativeObject( JNIEnv *env, jobject obj, void *ptr, const char *pointer );
/**
@@ -65,7 +64,7 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_create (JNIEnv *env, jobject obj, jint w
setNativeObject(env, obj, data, BUFFER);
surface = cairo_image_surface_create_for_data
- (data, CAIRO_FORMAT_ARGB32, width, height, stride);
+ (data, CAIRO_FORMAT_ARGB32, width, height, stride * 4);
setNativeObject(env, obj, surface, SURFACE);
}
@@ -74,14 +73,16 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_create (JNIEnv *env, jobject obj, jint w
* Destroy the surface
*/
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_destroy (JNIEnv *env, jobject obj)
+Java_gnu_java_awt_peer_gtk_CairoSurface_destroy
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong surfacePointer, jlong bufferPointer)
{
void *buffer;
- cairo_surface_t* surface = (cairo_surface_t *)getNativeObject(env, obj, SURFACE);
+ cairo_surface_t* surface = JLONG_TO_PTR(void, surfacePointer);
if( surface != NULL )
cairo_surface_destroy(surface);
- buffer = getNativeObject(env, obj, BUFFER);
+ buffer = JLONG_TO_PTR(void, bufferPointer);
if( buffer != NULL )
g_free(buffer);
}
@@ -90,9 +91,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_destroy (JNIEnv *env, jobject obj)
* Gets a pixel
*/
JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem (JNIEnv *env, jobject obj, jint i)
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer, jint i)
{
- jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
+ jint *pixeldata = JLONG_TO_PTR(void, bufferPointer);
if( pixeldata == NULL )
return 0;
@@ -105,9 +108,10 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetElem (JNIEnv *env, jobject obj,
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem
-(JNIEnv *env, jobject obj, jint i, jint val)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer, jint i, jint val)
{
- jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
+ jint *pixeldata = JLONG_TO_PTR(void, bufferPointer);
if( pixeldata == NULL )
return;
@@ -119,13 +123,14 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetElem
* Gets all pixels in an array
*/
JNIEXPORT jintArray JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_getPixels
-(JNIEnv *env, jobject obj, int size)
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeGetPixels
+(JNIEnv *env __attribute((unused)), jobject obj __attribute((unused)),
+ jlong bufferPointer, int size)
{
jint *pixeldata, *jpixdata;
jintArray jpixels;
- pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
+ pixeldata = JLONG_TO_PTR(void, bufferPointer);
g_assert(pixeldata != NULL);
jpixels = (*env)->NewIntArray (env, size);
@@ -140,8 +145,8 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_getPixels
* Sets all pixels by an array.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels
-(JNIEnv *env, jobject obj, jintArray jpixels)
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeSetPixels
+(JNIEnv *env, jobject obj, jlong bufferPointer, jintArray jpixels)
{
jint *pixeldata, *jpixdata;
int size;
@@ -161,7 +166,7 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels
g_assert (field != 0);
height = (*env)->GetIntField (env, obj, field);
- pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
+ pixeldata = JLONG_TO_PTR(void, bufferPointer);
g_assert(pixeldata != NULL);
jpixdata = (*env)->GetIntArrayElements (env, jpixels, NULL);
@@ -174,15 +179,15 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_setPixels
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface
- (JNIEnv *env, jobject obj, jobject context, jdoubleArray java_matrix)
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeDrawSurface
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong surfacePointer, jlong context, jdoubleArray java_matrix, double alpha)
{
- cairo_t *cr;
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, context);
+ cairo_t *cr = gr->cr;
jdouble *native_matrix = NULL;
- cairo_surface_t* surface = (cairo_surface_t *)getNativeObject(env, obj, SURFACE);
+ cairo_surface_t* surface = JLONG_TO_PTR(void, surfacePointer);
g_assert(surface != NULL);
-
- cr = cp_gtk_get_cairo_t(env, context);
g_assert(cr != NULL);
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
@@ -202,7 +207,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface
cairo_pattern_set_matrix (p, &mat);
cairo_set_source(cr, p);
- cairo_paint(cr);
+ if (alpha == 1.0)
+ cairo_paint(cr);
+ else
+ cairo_paint_with_alpha(cr, alpha);
+
cairo_pattern_destroy(p);
}
@@ -211,10 +220,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_drawSurface
JNIEXPORT jlong JNICALL
Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer
-(JNIEnv *env, jobject obj, jint size)
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer, jint size)
{
jint *dst;
- jint *src = (jint *)getNativeObject(env, obj, BUFFER);
+ jint *src = JLONG_TO_PTR(void, bufferPointer);
int i;
int t;
@@ -236,9 +246,11 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_getFlippedBuffer
* Create and return a cairo context for drawing to the surface.
*/
JNIEXPORT jlong JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_newCairoContext (JNIEnv *env, jobject obj)
+Java_gnu_java_awt_peer_gtk_CairoSurface_nativeNewCairoContext
+(JNIEnv *env __attribute((unused)), jobject obj __attribute((unused)),
+ jlong surfacePointer)
{
- cairo_surface_t* surface = (cairo_surface_t *)getNativeObject(env, obj, SURFACE);
+ cairo_surface_t* surface = JLONG_TO_PTR(cairo_surface_t, surfacePointer);
cairo_t *ptr;
g_assert(surface != NULL);
ptr = cairo_create(surface);
@@ -251,17 +263,15 @@ Java_gnu_java_awt_peer_gtk_CairoSurface_newCairoContext (JNIEnv *env, jobject ob
* copyArea.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative (JNIEnv *env,
- jobject obj,
- jint x, jint y,
- jint w, jint h,
- jint dx, jint dy,
- jint stride)
+Java_gnu_java_awt_peer_gtk_CairoSurface_copyAreaNative2
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
+ jlong bufferPointer,
+ jint x, jint y, jint w, jint h, jint dx, jint dy, jint stride)
{
int row;
int srcOffset, dstOffset;
jint *temp;
- jint *pixeldata = (jint *)getNativeObject(env, obj, BUFFER);
+ jint *pixeldata = JLONG_TO_PTR(jint, bufferPointer);
g_assert( pixeldata != NULL );
temp = g_malloc( h * w * 4 );
@@ -294,19 +304,3 @@ setNativeObject( JNIEnv *env, jobject obj, void *ptr, const char *pointer )
(*env)->SetLongField( env, obj, nofid, value );
(*env)->DeleteLocalRef( env, cls );
}
-
-/**
- * Gets the native object field.
- */
-static void *
-getNativeObject( JNIEnv *env, jobject obj, const char *pointer )
-{
- jclass cls;
- jlong value;
- jfieldID nofid;
- cls = (*env)->GetObjectClass( env, obj );
- nofid = (*env)->GetFieldID( env, cls, pointer, "J" );
- value = (*env)->GetLongField( env, obj, nofid );
- (*env)->DeleteLocalRef( env, cls );
- return JLONG_TO_PTR(void, value);
-}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
index 7e3c83808c8..d85ba326f00 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
@@ -186,7 +186,11 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_disposeSurface
surface = cairo_get_target (gr->cr);
if (surface != NULL)
- cairo_surface_destroy (surface);
+ {
+ gdk_threads_enter();
+ cairo_surface_destroy (surface);
+ gdk_threads_leave();
+ }
}
JNIEXPORT jlong JNICALL
@@ -275,7 +279,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
(JNIEnv *env, jobject obj __attribute__ ((unused)), jobject peer,
- jobject img, jint x, jint y, jint w, jint h)
+ jlong img, jint x, jint y, jint w, jint h)
{
GdkPixmap *pixmap;
GtkWidget *widget = NULL;
@@ -289,7 +293,7 @@ Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
widget = GTK_WIDGET (ptr);
g_assert (widget != NULL);
- pixmap = cp_gtk_get_pixmap( env, img );
+ pixmap = JLONG_TO_PTR(GdkPixmap, img);
gc = gdk_gc_new(widget->window);
gdk_draw_drawable(widget->window,
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
index 42abd983c7a..c8b74d207dc 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
@@ -81,24 +81,37 @@ getFont(JNIEnv *env, jobject obj)
return (PangoFcFont *)pfont->font;
}
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyph
- (JNIEnv *env, jobject obj, jint codepoint)
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs
+ (JNIEnv *env, jobject obj, jintArray codepoints)
{
FT_Face ft_face;
- jint glyph_index;
+ jintArray retArray;
PangoFcFont *font;
+ jint *values, *cpvals;
+ jint length;
+ int i;
font = getFont(env, obj);
ft_face = pango_fc_font_lock_face( font );
g_assert (ft_face != NULL);
- glyph_index = FT_Get_Char_Index( ft_face, codepoint );
+ length = (*env)->GetArrayLength (env, codepoints);
+ cpvals = (*env)->GetIntArrayElements (env, codepoints, NULL);
+
+ retArray = (*env)->NewIntArray (env, length);
+ values = (*env)->GetIntArrayElements (env, retArray, NULL);
+
+ for( i = 0; i < length; i++ )
+ values[i] = FT_Get_Char_Index( ft_face, cpvals[i] );
+
+ (*env)->ReleaseIntArrayElements (env, retArray, values, 0);
+ (*env)->ReleaseIntArrayElements (env, codepoints, cpvals, 0);
pango_fc_font_unlock_face (font);
- return glyph_index;
+ return retArray;
}
JNIEXPORT jobject JNICALL
@@ -143,7 +156,7 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative
FT_Set_Transform( ft_face, NULL, NULL );
- if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_DEFAULT ) != 0 )
+ if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_NO_BITMAP ) != 0 )
{
pango_fc_font_unlock_face( font );
printf("Couldn't load glyph %i\n", glyphIndex);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
deleted file mode 100644
index 29bc1855bbf..00000000000
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/* gdkgraphics.c
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include "gdkfont.h"
-#include "gnu_java_awt_peer_gtk_GdkGraphics.h"
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-
-static jmethodID initComponentGraphicsUnlockedID;
-
-/*
- * AWT applications may call Graphics methods from threads other than
- * the GDK main thread, so we must call XFlush after each batch of
- * drawing operations, otherwise animations flicker. Flushing after
- * every graphics operation is excessive and negatively affects
- * performance (PR 26486). We set the maximum frequency to 50 times
- * per second, or a minimum period of 20 milliseconds between calls to
- * XFlush. See gnu.classpath.examples.awt.AnimationApplet for an
- * example applet that requires these XFlush calls.
- */
-
-static short flush_scheduled = 0;
-
-static gboolean flush (gpointer data __attribute__((unused)))
-{
- gdk_threads_enter ();
-
- XFlush (GDK_DISPLAY ());
- flush_scheduled = 0;
-
- gdk_threads_leave ();
-
- return FALSE;
-}
-
-/* The minimum time period between calls to XFlush, in
- milliseconds. */
-#define MINIMUM_FLUSH_PERIOD 20
-
-/* schedule_flush must be called with the GDK lock held. */
-static void
-schedule_flush ()
-{
- if (!flush_scheduled)
- {
- g_timeout_add (MINIMUM_FLUSH_PERIOD, flush, NULL);
- flush_scheduled = 1;
- }
-}
-
-void
-cp_gtk_graphics_init_jni (void)
-{
- jclass gdkgraphics;
-
- gdkgraphics = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
- "gnu/java/awt/peer/gtk/GdkGraphics");
-
- initComponentGraphicsUnlockedID =
- (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics,
- "initComponentGraphicsUnlocked",
- "()V");
-}
-
-struct state_table *cp_gtk_native_graphics_state_table;
-
-static struct state_table *native_graphics_global_ref_table;
-
-#define NSA_GLOBAL_G_INIT(env, clazz) \
- native_graphics_global_ref_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_GLOBAL_G_REF(env, obj) \
- cp_gtk_get_state (env, obj, native_graphics_global_ref_table)
-
-#define NSA_SET_GLOBAL_G_REF(env, obj) \
- do {jobject *globRefPtr; \
- globRefPtr = (jobject *) malloc (sizeof (jobject)); \
- *globRefPtr = (*env)->NewGlobalRef (env, obj); \
- cp_gtk_set_state (env, obj, native_graphics_global_ref_table, (void *)globRefPtr);} while (0)
-
-#define NSA_DEL_GLOBAL_G_REF(env, obj) \
- do {jobject *globRefPtr = cp_gtk_get_state (env, obj, native_graphics_global_ref_table); \
- cp_gtk_remove_state_slot (env, obj, native_graphics_global_ref_table); \
- (*env)->DeleteGlobalRef (env, *globRefPtr); \
- free (globRefPtr);} while (0)
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_initStaticState
- (JNIEnv *env, jclass clazz)
-{
- gdk_threads_enter();
-
- NSA_G_INIT (env, clazz);
- NSA_GLOBAL_G_INIT (env, clazz);
-
- gdk_threads_leave();
-}
-
-#define GDK_STABLE_IS_PIXMAP(d) (GDK_IS_PIXMAP(d))
-
-static GdkPoint *translate_points (JNIEnv *env, jintArray xpoints,
- jintArray ypoints, jint npoints,
- jint x_offset, jint y_offset);
-static void realize_cb (GtkWidget *widget, jobject jgraphics);
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeCopyState
- (JNIEnv *env, jobject obj, jobject old)
-{
- struct graphics *g = NULL;
- struct graphics *g_old = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) g_malloc (sizeof (struct graphics));
- g_old = (struct graphics *) NSA_GET_G_PTR (env, old);
-
- *g = *g_old;
-
- g->gc = gdk_gc_new (g->drawable);
- gdk_gc_copy (g->gc, g_old->gc);
-
- if (GDK_STABLE_IS_PIXMAP (g->drawable))
- g_object_ref (g->drawable);
- else /* GDK_IS_WINDOW (g->drawable) */
- g_object_ref (g->drawable);
-
- if (g->cm != NULL)
- g_object_ref (g->cm);
-
- NSA_SET_G_PTR (env, obj, g);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
- (JNIEnv *env, jobject obj, jint width, jint height)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) g_malloc (sizeof (struct graphics));
- g->x_offset = g->y_offset = 0;
-
- g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
- gdk_rgb_get_visual ()->depth);
- g->cm = gdk_rgb_get_colormap ();
-
- if (g->cm != NULL)
- g_object_ref (g->cm);
- g->gc = gdk_gc_new (g->drawable);
-
- NSA_SET_G_PTR (env, obj, g);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
- (JNIEnv *env, jobject obj, jobject source)
-{
- struct graphics *g = NULL;
- GdkPixmap *pixmap = NULL;
-
- gdk_threads_enter ();
-
- pixmap = cp_gtk_image_get_pixmap (env, source);
- g_assert(pixmap != NULL);
- g_object_ref (pixmap);
-
- g = (struct graphics *) g_malloc (sizeof (struct graphics));
- g->x_offset = g->y_offset = 0;
-
- g->drawable = (GdkDrawable *)pixmap;
-
- g->cm = gdk_drawable_get_colormap (g->drawable);
-
- if (g->cm != NULL)
- g_object_ref (g->cm);
- g->gc = gdk_gc_new (g->drawable);
-
- NSA_SET_G_PTR (env, obj, g);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
- (JNIEnv *env, jobject obj, jobject peer)
-{
- struct graphics *g = NULL;
- void *ptr = NULL;
- GtkWidget *widget = NULL;
- GdkColor color;
-
- g = (struct graphics *) g_malloc (sizeof (struct graphics));
- ptr = NSA_GET_PTR (env, peer);
- g->x_offset = 0;
- g->y_offset = 0;
-
- widget = GTK_WIDGET (ptr);
- g->drawable = (GdkDrawable *) widget->window;
-
- g_object_ref (g->drawable);
- g->cm = gtk_widget_get_colormap (widget);
-
- if (g->cm != NULL)
- g_object_ref (g->cm);
-
- g->gc = gdk_gc_new (g->drawable);
- gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
- color = widget->style->fg[GTK_STATE_NORMAL];
-
- NSA_SET_G_PTR (env, obj, g);
-}
-
-/* copy the native state of the peer (GtkWidget *) to the native state
- of the graphics object */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
- (JNIEnv *env, jobject obj, jobject peer)
-{
- gdk_threads_enter ();
- Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
- (env, obj, peer);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals
- (JNIEnv *env, jobject obj, jobject peer)
-{
- void *ptr = NULL;
- jobject *gref = NULL;
-
- gdk_threads_enter ();
-
- NSA_SET_GLOBAL_G_REF (env, obj);
- gref = NSA_GET_GLOBAL_G_REF (env, obj);
-
- ptr = NSA_GET_PTR (env, peer);
-
- g_signal_connect_after (G_OBJECT (ptr), "realize",
- G_CALLBACK (realize_cb), *gref);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeDispose
- (JNIEnv *env, jobject obj)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_DEL_G_PTR (env, obj);
-
- /* check if dispose has been called already */
- if (!g)
- {
- gdk_threads_leave ();
- return;
- }
-
- XFlush (GDK_DISPLAY ());
-
- if (g->gc != NULL)
- g_object_unref (g->gc);
-
- if (GDK_STABLE_IS_PIXMAP (g->drawable))
- g_object_unref (g->drawable);
- else if (g->drawable != NULL)
- g_object_unref (g->drawable);
-
- if (g->cm != NULL)
- g_object_unref (g->cm);
-
- g_free (g);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
- (JNIEnv *env, jobject obj, jint x, jint y)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- g->x_offset += x;
- g->y_offset += y;
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
- (JNIEnv *env, jobject obj, jobject font, jstring str, jint x, jint y)
-{
- struct peerfont *pfont = NULL;
- struct graphics *g = NULL;
- const char *cstr = NULL;
- const char *sTmp = NULL;
- char *tmp = NULL;
- char *p = NULL;
- int count = 0;
- int charSize = 0;
- int baseline_y = 0;
- PangoLayoutIter *iter = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
- g_assert (g != NULL);
-
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
- g_assert (pfont != NULL);
-
- cstr = (*env)->GetStringUTFChars (env, str, NULL);
- g_assert (cstr != NULL);
-
- charSize = sizeof(char);
- p = malloc((strlen(cstr) + 1) * charSize);
- g_assert (p != NULL);
-
- tmp = p;
- sTmp = cstr;
- for (; *sTmp != '\0'; sTmp++)
- if (((unsigned char) *sTmp) >= ' ')
- {
- *p = *sTmp;
- count++;
- p++;
- }
- *p = '\0';
-
- p = realloc(tmp, (count + 1) * charSize);
- g_assert (p != NULL);
- pango_layout_set_text (pfont->layout, p, -1);
- free(p);
-
- pango_layout_set_font_description (pfont->layout, pfont->desc);
- iter = pango_layout_get_iter (pfont->layout);
-
- baseline_y = pango_layout_iter_get_baseline (iter);
-
- gdk_draw_layout (g->drawable, g->gc,
- x + g->x_offset,
- y + g->y_offset - PANGO_PIXELS (baseline_y),
- pfont->layout);
-
- pango_layout_iter_free (iter);
- pango_layout_set_text (pfont->layout, "", -1);
-
- schedule_flush ();
-
- (*env)->ReleaseStringUTFChars (env, str, cstr);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
- (JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_line (g->drawable, g->gc,
- x + g->x_offset, y + g->y_offset,
- x2 + g->x_offset, y2 + g->y_offset);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_rectangle (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset, width, height);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_rectangle (g->drawable, g->gc, FALSE,
- x + g->x_offset, y + g->y_offset, width, height);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
- (JNIEnv *env, jobject obj, jint x, jint y,
- jint width, jint height, jint dx, jint dy)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_drawable ((GdkWindow *)g->drawable,
- g->gc,
- (GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset,
- x + g->x_offset + dx, y + g->y_offset + dy,
- width, height);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g = NULL;
- GdkGCValues saved;
- GtkWidget *widget = NULL;
- union widget_union w;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- if (!g)
- {
- gdk_threads_leave ();
- return;
- }
-
- if (GDK_IS_WINDOW (g->drawable))
- {
- w.widget = &widget;
- gdk_window_get_user_data (GDK_WINDOW (g->drawable), w.void_widget);
- if (widget == NULL || !GTK_IS_EVENT_BOX (widget))
- gdk_window_clear_area ((GdkWindow *) g->drawable,
- x + g->x_offset, y + g->y_offset,
- width, height);
- }
- else
- {
- gdk_gc_get_values (g->gc, &saved);
- gdk_gc_set_background (g->gc, &(saved.background));
- gdk_draw_rectangle (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset, width, height);
- gdk_gc_set_foreground (g->gc, &(saved.foreground));
- }
-
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
- (JNIEnv *env, jobject obj, jint func)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_gc_set_function (g->gc, func);
-
- gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
- (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
-{
- GdkColor color;
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- color.red = red << 8;
- color.green = green << 8;
- color.blue = blue << 8;
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- if (g->cm != NULL)
- gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
-
- gdk_gc_set_foreground (g->gc, &color);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
- jint angle1, jint angle2)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_arc (g->drawable, g->gc, FALSE,
- x + g->x_offset, y + g->y_offset,
- width, height, angle1 << 6, angle2 << 6);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-static GdkPoint *
-translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
- jint npoints, jint x_offset, jint y_offset)
-{
- GdkPoint *points;
- jint *x, *y;
- int i;
-
- /* allocate one more point than necessary, in case we need to tack
- on an extra due to the semantics of Java polygons. */
- points = g_malloc (sizeof (GdkPoint) * (npoints + 1));
-
- x = (*env)->GetIntArrayElements (env, xpoints, NULL);
- y = (*env)->GetIntArrayElements (env, ypoints, NULL);
-
- for (i = 0; i < npoints; i++)
- {
- points[i].x = x[i] + x_offset;
- points[i].y = y[i] + y_offset;
- }
-
- (*env)->ReleaseIntArrayElements (env, xpoints, x, JNI_ABORT);
- (*env)->ReleaseIntArrayElements (env, ypoints, y, JNI_ABORT);
-
- return points;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
- (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
- jint npoints)
-{
- struct graphics *g = NULL;
- GdkPoint *points = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
- points = translate_points (env, xpoints, ypoints, npoints,
- g->x_offset, g->y_offset);
-
- gdk_draw_lines (g->drawable, g->gc, points, npoints);
- schedule_flush ();
-
- g_free (points);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
- (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
- jint npoints)
-{
- struct graphics *g = NULL;
- GdkPoint *points = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
- points = translate_points (env, xpoints, ypoints, npoints,
- g->x_offset, g->y_offset);
-
- /* make sure the polygon is closed, per Java semantics.
- if it's not, we close it. */
- if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
- points[npoints++] = points[0];
-
- gdk_draw_lines (g->drawable, g->gc, points, npoints);
- schedule_flush ();
-
- g_free (points);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
- (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
- jint npoints)
-{
- struct graphics *g = NULL;
- GdkPoint *points = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
- points = translate_points (env, xpoints, ypoints, npoints,
- g->x_offset, g->y_offset);
- gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
- schedule_flush ();
-
- g_free (points);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
- jint angle1, jint angle2)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_arc (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset,
- width, height, angle1 << 6, angle2 << 6);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_arc (g->drawable, g->gc, FALSE,
- x + g->x_offset, y + g->y_offset,
- width, height, 0, 23040);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g = NULL;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_draw_arc (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset,
- width, height, 0, 23040);
- schedule_flush ();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g = NULL;
- GdkRectangle rectangle;
-
- gdk_threads_enter ();
-
- g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- rectangle.x = x + g->x_offset;
- rectangle.y = y + g->y_offset;
- rectangle.width = width;
- rectangle.height = height;
-
- gdk_gc_set_clip_rectangle (g->gc, &rectangle);
-
- gdk_threads_leave ();
-}
-
-static void
-realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject jgraphics)
-{
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(),
- jgraphics,
- initComponentGraphicsUnlockedID);
-
- NSA_DEL_GLOBAL_G_REF (cp_gtk_gdk_env(), jgraphics);
-}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
deleted file mode 100644
index b42f649a15a..00000000000
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+++ /dev/null
@@ -1,2018 +0,0 @@
-/* gnu_java_awt_peer_gtk_GdkGraphics2d.c
- Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
-
-#include "jcl.h"
-#include "gtkcairopeer.h"
-#include "gdkfont.h"
-#include "gnu_java_awt_peer_gtk_GdkGraphics2D.h"
-#include <gdk/gdktypes.h>
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-#include <X11/extensions/Xrender.h>
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gdk-pixdata.h>
-
-#include <cairo-ft.h>
-#include <cairo-xlib.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static jmethodID initComponentGraphics2DUnlockedID;
-
-void
-cp_gtk_graphics2d_init_jni (void)
-{
- jclass gdkgraphics2d;
- JNIEnv *env = cp_gtk_gdk_env();
-
- gdkgraphics2d = (*env)->FindClass (env,
- "gnu/java/awt/peer/gtk/GdkGraphics2D");
- if ((*env)->ExceptionOccurred(env))
- return;
-
- initComponentGraphics2DUnlockedID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics2d,
- "initComponentGraphics2DUnlocked",
- "()V");
-}
-
-static struct state_table *native_graphics2d_state_table;
-
-#define NSA_G2D_INIT(env, clazz) \
- native_graphics2d_state_table = cp_gtk_init_state_table (env, clazz)
-
-#define NSA_GET_G2D_PTR(env, obj) \
- cp_gtk_get_state (env, obj, native_graphics2d_state_table)
-
-#define NSA_SET_G2D_PTR(env, obj, ptr) \
- cp_gtk_set_state (env, obj, native_graphics2d_state_table, (void *)ptr)
-
-#define NSA_DEL_G2D_PTR(env, obj) \
- cp_gtk_remove_state_slot (env, obj, native_graphics2d_state_table)
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState
- (JNIEnv *env, jclass clazz)
-{
- gdk_threads_enter();
-
- NSA_G2D_INIT (env, clazz);
-
- gdk_threads_leave();
-}
-
-/* these public final constants are part of the java2d public API, so we
- write them explicitly here to save fetching them from the constant pool
- all the time. */
-
-#ifndef min
-#define min(x,y) ((x) < (y) ? (x) : (y))
-#endif
-
-enum java_awt_alpha_composite_rule
- {
- java_awt_alpha_composite_CLEAR = 1,
- java_awt_alpha_composite_SRC = 2,
- java_awt_alpha_composite_SRC_OVER = 3,
- java_awt_alpha_composite_DST_OVER = 4,
- java_awt_alpha_composite_SRC_IN = 5,
- java_awt_alpha_composite_DST_IN = 6,
- java_awt_alpha_composite_SRC_OUT = 7,
- java_awt_alpha_composite_DST_OUT = 8,
- java_awt_alpha_composite_DST = 9,
- java_awt_alpha_composite_SRC_ATOP = 10,
- java_awt_alpha_composite_DST_ATOP = 11,
- java_awt_alpha_composite_XOR = 12
- };
-
-enum java_awt_basic_stroke_join_rule
- {
- java_awt_basic_stroke_JOIN_MITER = 0,
- java_awt_basic_stroke_JOIN_ROUND = 1,
- java_awt_basic_stroke_JOIN_BEVEL = 2
- };
-
-enum java_awt_basic_stroke_cap_rule
- {
- java_awt_basic_stroke_CAP_BUTT = 0,
- java_awt_basic_stroke_CAP_ROUND = 1,
- java_awt_basic_stroke_CAP_SQUARE = 2
- };
-
-enum java_awt_geom_path_iterator_winding_rule
- {
- java_awt_geom_path_iterator_WIND_EVEN_ODD = 0,
- java_awt_geom_path_iterator_WIND_NON_ZERO = 1
- };
-
-enum java_awt_rendering_hints_filter
- {
- java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR = 0,
- java_awt_rendering_hints_VALUE_INTERPOLATION_BILINEAR = 1,
- java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_SPEED = 2,
- java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_QUALITY = 3,
- java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_DEFAULT = 4
-
- };
-
-static int
-peer_is_disposed(JNIEnv *env, jobject obj)
-{
- static jfieldID fid = NULL;
- jclass cls;
- jobject peer;
-
- return 0;
-
- if (fid == NULL)
- {
- cls = (*env)->GetObjectClass(env, obj);
- fid = (*env)->GetFieldID(env, cls, "component",
- "Lgnu/java/awt/peer/gtk/GtkComponentPeer;");
- }
- g_assert(fid != NULL);
- peer = (*env)->GetObjectField(env, obj, fid);
- if (peer == NULL || NSA_GET_PTR (env, peer) != NULL)
- return 0;
- else
- {
- return 1;
- }
-}
-
-
-static void
-grab_current_drawable (GtkWidget *widget, GdkDrawable **draw, GdkWindow **win)
-{
- g_assert (widget != NULL);
- g_assert (draw != NULL);
- g_assert (win != NULL);
-
- *win = widget->window;
-
- *draw = *win;
- gdk_window_get_internal_paint_info (*win, draw, 0, 0);
- g_object_ref (*draw);
-}
-
-
-static int
-x_server_has_render_extension (void)
-{
- int ev = 0, err = 0;
- return (int) XRenderQueryExtension (GDK_DISPLAY (), &ev, &err);
-}
-
-static void
-init_graphics2d_as_pixbuf (struct graphics2d *gr)
-{
- gint width, height;
- gint bits_per_sample = 8;
- gint total_channels = 4;
- gboolean has_alpha = TRUE;
-
- g_assert (gr != NULL);
- g_assert (gr->drawable != NULL);
-
- if (gr->debug) printf ("initializing graphics2d as pixbuf\n");
- gdk_drawable_get_size (gr->drawable, &width, &height);
- gr->drawbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- has_alpha, bits_per_sample,
- width, height);
- g_assert (gr->drawbuf != NULL);
- g_assert (gdk_pixbuf_get_bits_per_sample (gr->drawbuf) == bits_per_sample);
- g_assert (gdk_pixbuf_get_n_channels (gr->drawbuf) == total_channels);
-
- gr->surface = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (gr->drawbuf),
- CAIRO_FORMAT_ARGB32,
- gdk_pixbuf_get_width (gr->drawbuf),
- gdk_pixbuf_get_height (gr->drawbuf),
- gdk_pixbuf_get_rowstride (gr->drawbuf));
- g_assert (gr->surface != NULL);
- gr->mode = MODE_DRAWABLE_NO_RENDER;
- if (gr->cr != NULL)
- cairo_destroy (gr->cr);
- gr->cr = cairo_create (gr->surface);
-}
-
-static void
-init_graphics2d_as_renderable (struct graphics2d *gr)
-{
- Drawable draw;
- Display * dpy;
- Visual * vis;
-
- g_assert (gr != NULL);
- g_assert (gr->drawable != NULL);
-
- gr->drawbuf = NULL;
-
- if (gr->debug) printf ("initializing graphics2d as renderable\n");
- draw = gdk_x11_drawable_get_xid (gr->drawable);
-
- dpy = gdk_x11_drawable_get_xdisplay (gr->drawable);
- g_assert (dpy != NULL);
-
- vis = gdk_x11_visual_get_xvisual (gdk_drawable_get_visual (gr->drawable));
- g_assert (vis != NULL);
-
- gr->surface = cairo_xlib_surface_create (dpy, draw, vis, gr->width, gr->height);
- g_assert (gr->surface != NULL);
- gr->mode = MODE_DRAWABLE_WITH_RENDER;
- if (gr->cr != NULL)
- cairo_destroy (gr->cr);
- gr->cr = cairo_create (gr->surface);
-}
-
-static void
-begin_drawing_operation (JNIEnv *env, struct graphics2d * gr)
-{
- cairo_status_t cst = cairo_status (gr->cr);
- if (cst != CAIRO_STATUS_SUCCESS)
- {
- const char *detail = cairo_status_to_string (cst);
- JCL_ThrowException (env, "java/lang/InternalError", detail);
- (*env)->ExceptionDescribe (env);
- return;
- }
-
- switch (gr->mode)
- {
- case MODE_DRAWABLE_WITH_RENDER:
- break;
-
- case MODE_DRAWABLE_NO_RENDER:
- {
-
- gint drawable_width, drawable_height;
- gint pixbuf_width, pixbuf_height;
- gint width, height;
-
- gdk_drawable_get_size (gr->drawable, &drawable_width, &drawable_height);
- pixbuf_width = gdk_pixbuf_get_width (gr->drawbuf);
- pixbuf_height = gdk_pixbuf_get_height (gr->drawbuf);
- width = min (drawable_width, pixbuf_width);
- height = min (drawable_height, pixbuf_height);
-
- gdk_pixbuf_get_from_drawable (gr->drawbuf, /* destination pixbuf */
- gr->drawable,
- NULL, /* colormap */
- 0, 0, 0, 0,
- width, height);
-
- if (gr->debug) printf ("copied (%d, %d) pixels from GDK drawable to pixbuf\n",
- width, height);
- }
- break;
-
- case MODE_JAVA_ARRAY:
- {
- jboolean isCopy;
- gr->javabuf = (*env)->GetPrimitiveArrayCritical (env, gr->jarray, &isCopy);
- gr->isCopy |= isCopy;
- if (gr->isCopy)
- {
- /* Make sure that the pixel buffer copy is already initalized,
- i.e. we already failed to get direct access in initState. */
- g_assert (gr->javabuf_copy != NULL);
- memcpy (gr->javabuf_copy, gr->javabuf, gr->width * gr->height * 4);
- }
- }
- break;
- }
-}
-
-static void
-end_drawing_operation (JNIEnv *env, struct graphics2d * gr)
-{
- cairo_status_t cst = cairo_status (gr->cr);
- if (cst != CAIRO_STATUS_SUCCESS)
- {
- /* Report error. */
- const char *detail = cairo_status_to_string (cst);
- JCL_ThrowException (env, "java/lang/InternalError", detail);
- (*env)->ExceptionDescribe (env);
-
- /* Recreate cairo status. */
- cairo_destroy (gr->cr);
- gr->cr = cairo_create (gr->surface);
- return;
- }
-
- switch (gr->mode)
- {
- case MODE_DRAWABLE_WITH_RENDER:
- break;
-
- case MODE_DRAWABLE_NO_RENDER:
- {
-
- gint drawable_width, drawable_height;
- gint pixbuf_width, pixbuf_height;
- gint width, height;
-
- gdk_drawable_get_size (gr->drawable, &drawable_width, &drawable_height);
- pixbuf_width = gdk_pixbuf_get_width (gr->drawbuf);
- pixbuf_height = gdk_pixbuf_get_height (gr->drawbuf);
- width = min (drawable_width, pixbuf_width);
- height = min (drawable_height, pixbuf_height);
-
- gdk_draw_pixbuf (gr->drawable, NULL, gr->drawbuf,
- 0, 0, 0, 0,
- width, height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
-
- if (gr->debug) printf ("copied (%d, %d) pixels from pixbuf to GDK drawable\n",
- width, height);
- }
- break;
-
- case MODE_JAVA_ARRAY:
- if (gr->isCopy)
- memcpy (gr->javabuf, gr->javabuf_copy, gr->width * gr->height * 4);
- (*env)->ReleasePrimitiveArrayCritical (env, gr->jarray, gr->javabuf, JNI_COMMIT);
- }
-}
-
-
-static void
-update_pattern_transform (struct graphics2d *gr)
-{
- cairo_matrix_t mat;
-
- g_assert (gr != NULL);
- if (gr->pattern == NULL)
- return;
-
- cairo_get_matrix (gr->cr, &mat);
- cairo_pattern_set_matrix (gr->pattern, &mat);
-}
-
-static void
-check_for_debug (struct graphics2d *gr)
-{
- gr->debug = (gboolean)(getenv("DEBUGJ2D") != NULL);
-}
-
-static void
-realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject peer)
-{
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(),
- peer,
- initComponentGraphics2DUnlockedID);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState
- (JNIEnv *env, jobject obj, jobject old)
-{
- struct graphics2d *g = NULL, *g_old = NULL;
-
- gdk_threads_enter();
-
- g = (struct graphics2d *) g_malloc (sizeof (struct graphics2d));
- g_assert (g != NULL);
- memset (g, 0, sizeof(struct graphics2d));
-
- g_old = (struct graphics2d *) NSA_GET_G2D_PTR (env, old);
- g_assert (g_old != NULL);
-
- if (g_old->debug) printf ("copying state from existing graphics2d\n");
-
- g->debug = g_old->debug;
- g->mode = g_old->mode;
-
- g->width = g_old->width;
- g->height = g_old->height;
-
- if (g_old->mode == MODE_JAVA_ARRAY)
- {
- jint size = g->width * g->height * 4;
-
- g->jarray = (*env)->NewGlobalRef (env, g_old->jarray);
- g->javabuf = (*env)->GetIntArrayElements (env, g->jarray, &g->isCopy);
- g->isCopy = JNI_TRUE;
- g->javabuf_copy = (jint *) g_malloc (size);
- memcpy (g->javabuf_copy, g->javabuf, size);
- g->surface = cairo_image_surface_create_for_data ((unsigned char *) g->javabuf,
- CAIRO_FORMAT_ARGB32,
- g->width,
- g->height,
- g->width * 4);
- g_assert (g->surface != NULL);
- g->cr = cairo_create (g->surface);
- g_assert (g->cr != NULL);
- (*env)->ReleaseIntArrayElements (env, g->jarray, g->javabuf, JNI_ABORT);
- }
- else
- {
- g->drawable = g_old->drawable;
- g_object_ref (g->drawable);
-
- if (x_server_has_render_extension ())
- init_graphics2d_as_renderable (g);
- else
- init_graphics2d_as_pixbuf (g);
- }
-
- if (g->pattern)
- cairo_pattern_set_filter (g->pattern, CAIRO_FILTER_FAST);
-
- NSA_SET_G2D_PTR (env, obj, g);
-
- gdk_threads_leave();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState___3III
-(JNIEnv *env, jobject obj, jintArray jarr, jint width, jint height)
-{
- struct graphics2d *gr = NULL;
- jint *cairobuf = NULL;
-
- gdk_threads_enter();
-
- gr = (struct graphics2d *) g_malloc (sizeof (struct graphics2d));
- g_assert (gr != NULL);
- memset (gr, 0, sizeof(struct graphics2d));
-
- check_for_debug (gr);
-
- if (gr->debug) printf ("constructing java-backed image of size (%d,%d)\n",
- width, height);
-
- gr->width = width;
- gr->height = height;
- gr->jarray = (*env)->NewGlobalRef(env, jarr);
- gr->javabuf = (*env)->GetPrimitiveArrayCritical (env, gr->jarray, &gr->isCopy);
- if (gr->isCopy)
- {
- /* We didn't get direct access to the pixel buffer, so we'll have to
- maintain a separate copy for Cairo. */
- jint size = gr->width * gr->height * 4;
- gr->javabuf_copy = (jint *) g_malloc (size);
- memcpy (gr->javabuf_copy, gr->javabuf, size);
- cairobuf = gr->javabuf_copy;
- }
- else
- {
- /* Have Cairo write directly to the Java array. */
- cairobuf = gr->javabuf;
- }
- gr->surface = cairo_image_surface_create_for_data ((unsigned char *) cairobuf,
- CAIRO_FORMAT_ARGB32,
- gr->width,
- gr->height,
- gr->width * 4);
- g_assert (gr->surface != NULL);
- gr->cr = cairo_create (gr->surface);
- g_assert (gr->cr != NULL);
- (*env)->ReleasePrimitiveArrayCritical (env, gr->jarray, gr->javabuf, JNI_COMMIT);
-
- gr->mode = MODE_JAVA_ARRAY;
-
- if (gr->debug) printf ("constructed java-backed image of size (%d,%d)\n",
- width, height);
-
- NSA_SET_G2D_PTR (env, obj, gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
- (JNIEnv *env, jobject obj, jint width, jint height)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- gr = (struct graphics2d *) g_malloc (sizeof (struct graphics2d));
- g_assert (gr != NULL);
- memset (gr, 0, sizeof(struct graphics2d));
-
- check_for_debug (gr);
-
- if (gr->debug) printf ("constructing offscreen drawable of size (%d,%d)\n",
- width, height);
-
- gr->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
- gdk_rgb_get_visual ()->depth);
- g_assert (gr->drawable != NULL);
-
- gr->width = width;
- gr->height = height;
-
- if (x_server_has_render_extension ())
- init_graphics2d_as_renderable (gr);
- else
- init_graphics2d_as_pixbuf (gr);
-
- if (gr->debug) printf ("constructed offscreen drawable of size (%d,%d)\n",
- width, height);
- NSA_SET_G2D_PTR (env, obj, gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
- (JNIEnv *env, jobject self, jobject other, jint x, jint y)
-{
- struct graphics2d *src = NULL;
- struct graphics2d *dst = NULL;
- gint s_height;
- gint s_width;
- gint d_height;
- gint d_width;
- gint height;
- gint width;
- cairo_matrix_t matrix;
- cairo_operator_t tmp_op;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, self))
- {
- gdk_threads_leave();
- return;
- }
-
- src = (struct graphics2d *)NSA_GET_G2D_PTR (env, other);
- dst = (struct graphics2d *)NSA_GET_G2D_PTR (env, self);
- g_assert (src != NULL);
- g_assert (dst != NULL);
-
- if (src->debug) printf ("copying from offscreen drawable\n");
-
- begin_drawing_operation(env, dst);
-
- /* gdk_flush(); */
-
- if (!GDK_IS_DRAWABLE (src->drawable) ||
- !GDK_IS_DRAWABLE (dst->drawable))
- {
- gdk_threads_leave ();
- return;
- }
-
- gdk_drawable_get_size (src->drawable, &s_width, &s_height);
- gdk_drawable_get_size (dst->drawable, &d_width, &d_height);
- width = min (s_width, d_width);
- height = min (s_height, d_height);
-
- cairo_get_matrix (src->cr, &matrix);
- cairo_matrix_translate (&matrix, (double)-x, (double)-y);
- if (src->pattern)
- cairo_pattern_set_matrix (src->pattern, &matrix);
- tmp_op = cairo_get_operator (dst->cr);
- cairo_set_operator(dst->cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_surface (dst->cr, src->surface, 0, 0);
- cairo_paint (dst->cr);
- cairo_set_operator(dst->cr, tmp_op);
-
- cairo_matrix_translate (&matrix, (double)x, (double)y);
- if (src->pattern)
- cairo_pattern_set_matrix (src->pattern, &matrix);
-
- gdk_flush();
-
- end_drawing_operation(env, dst);
-
- if (src->debug) printf ("copied %d x %d pixels from offscreen drawable\n", width, height);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStateUnlocked
- (JNIEnv *env, jobject obj, jobject peer)
-{
- struct graphics2d *gr = NULL;
- GtkWidget *widget = NULL;
- void *ptr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- ptr = NSA_GET_PTR (env, peer);
- g_assert (ptr != NULL);
-
- gr = (struct graphics2d *) g_malloc (sizeof (struct graphics2d));
- g_assert (gr != NULL);
- memset (gr, 0, sizeof(struct graphics2d));
-
- check_for_debug (gr);
-
- widget = GTK_WIDGET (ptr);
- g_assert (widget != NULL);
-
- grab_current_drawable (widget, &(gr->drawable), &(gr->win));
- g_assert (gr->drawable != NULL);
-
- gr->width = widget->allocation.width;
- gr->height = widget->allocation.height;
-
- if (x_server_has_render_extension ())
- init_graphics2d_as_renderable (gr);
- else
- init_graphics2d_as_pixbuf (gr);
-
- NSA_SET_G2D_PTR (env, obj, gr);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
- (JNIEnv *env, jobject obj, jobject peer)
-{
- struct graphics2d *gr = NULL;
- GtkWidget *widget = NULL;
- void *ptr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
-
- ptr = NSA_GET_PTR (env, peer);
- g_assert (ptr != NULL);
-
- gr = (struct graphics2d *) g_malloc (sizeof (struct graphics2d));
- g_assert (gr != NULL);
- memset (gr, 0, sizeof(struct graphics2d));
-
- check_for_debug (gr);
-
- widget = GTK_WIDGET (ptr);
- g_assert (widget != NULL);
-
- grab_current_drawable (widget, &(gr->drawable), &(gr->win));
- g_assert (gr->drawable != NULL);
-
- gr->width = widget->allocation.width;
- gr->height = widget->allocation.height;
-
- if (x_server_has_render_extension ())
- init_graphics2d_as_renderable (gr);
- else
- init_graphics2d_as_pixbuf (gr);
-
- NSA_SET_G2D_PTR (env, obj, gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_connectSignals
- (JNIEnv *env, jobject obj, jobject peer)
-{
- void *ptr;
-
- gdk_threads_enter ();
-
- ptr = NSA_GET_PTR (env, peer);
-
- g_signal_connect_after (G_OBJECT (ptr), "realize",
- G_CALLBACK (realize_cb), obj);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- gr = (struct graphics2d *) NSA_DEL_G2D_PTR (env, obj);
-
- if (gr == NULL)
- {
- gdk_threads_leave();
- return; /* dispose has been called more than once */
- }
-
- if (gr->surface)
- cairo_surface_destroy (gr->surface);
-
- cairo_destroy (gr->cr);
-
- if (gr->drawbuf)
- g_object_unref (gr->drawbuf);
-
- if (gr->drawable)
- g_object_unref (gr->drawable);
-
- if (gr->pattern)
- cairo_pattern_destroy (gr->pattern);
-
- if (gr->pattern_surface)
- cairo_surface_destroy (gr->pattern_surface);
-
- if (gr->pattern_pixels)
- g_free (gr->pattern_pixels);
-
- if (gr->mode == MODE_JAVA_ARRAY)
- {
- (*env)->DeleteGlobalRef (env, gr->jarray);
- if (gr->javabuf_copy)
- g_free (gr->javabuf_copy);
- }
-
- if (gr->debug) printf ("disposed of graphics2d\n");
-
- g_free (gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient
- (JNIEnv *env, jobject obj,
- jdouble x1, jdouble y1,
- jdouble x2, jdouble y2,
- jint r1, jint g1, jint b1, jint a1,
- jint r2, jint g2, jint b2, jint a2,
- jboolean cyclic)
-{
- gdk_threads_enter();
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked
- (env, obj,
- x1, y1, x2, y2,
- r1, g1, b1, a1,
- r2, g2, b2, a2,
- cyclic);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked
- (JNIEnv *env, jobject obj,
- jdouble x1, jdouble y1,
- jdouble x2, jdouble y2,
- jint r1, jint g1, jint b1, jint a1,
- jint r2, jint g2, jint b2, jint a2,
- jboolean cyclic)
-{
- struct graphics2d *gr = NULL;
- cairo_surface_t *surf = NULL;
- cairo_t *cr2 = NULL;
- cairo_matrix_t mat;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
-
- if (peer_is_disposed(env, obj))
- return;
-
- if (gr->debug)
- printf ("setGradientUnlocked (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n",
- x1, y1,
- x2, y2,
- r1, g1, b1, a1,
- r2, g2, b2, a2);
-
- if (cyclic)
- surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 3, 2);
- else
- surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 2, 2);
- g_assert (surf != NULL);
-
- cr2 = cairo_create (surf);
-
- cairo_identity_matrix (cr2);
-
- cairo_set_source_rgba (cr2, r1 / 255.0, g1 / 255.0, b1 / 255.0, a1 / 255.0);
- cairo_rectangle (cr2, 0, 0, 1, 2);
- cairo_fill (cr2);
-
- cairo_set_source_rgba (cr2, r2 / 255.0, g2 / 255.0, b2 / 255.0, a2 / 255.0);
- cairo_rectangle (cr2, 1, 0, 1, 2);
- cairo_fill (cr2);
-
- if (cyclic)
- {
- cairo_set_source_rgba (cr2, r1 / 255.0, g1 / 255.0, b1 / 255.0, a1 / 255.0);
- cairo_rectangle (cr2, 2, 0, 1, 2);
- cairo_fill (cr2);
- }
-
- cairo_matrix_init_identity (&mat);
-
- /*
- consider the vector [x2 - x1, y2 - y1] = [p,q]
-
- this is a line in space starting at an 'origin' x1, y1.
-
- it can also be thought of as a "transformed" unit vector in either the
- x or y directions. we have just *drawn* our gradient as a unit vector
- (well, a 2-3x unit vector) in the x dimension. so what we want to know
- is which transformation turns our existing unit vector into [p,q].
-
- which means solving for M in
-
- [p,q] = M[1,0]
-
- [p,q] = |a b| [1,0]
- |c d|
-
- [p,q] = [a,c], with b = d = 0.
-
- what does this mean? it means that our gradient is 1-dimensional; as
- you move through the x axis of our 2 or 3 pixel gradient from logical
- x positions 0 to 1, the transformation of your x coordinate under the
- matrix M causes you to accumulate both x and y values in fill
- space. the y value of a gradient coordinate is ignored, since the
- gradient is one dimensional. which is correct.
-
- unfortunately we want the opposite transformation, it seems, because of
- the way cairo is going to use this transformation. I'm a bit confused by
- that, but it seems to work right, so we take reciprocals of values and
- negate offsets. oh well.
-
- */
- {
- double a = (x2 - x1 == 0.) ? 0. : ((cyclic ? 3.0 : 2.0) / (x2 - x1));
- double c = (y2 - y1 == 0.) ? 0. : (1. / (y2 - y1));
- double dx = (x1 == 0.) ? 0. : 1. / x1;
- double dy = (y1 == 0.) ? 0. : 1. / y1;
- cairo_pattern_t *p;
-
- cairo_matrix_init (&mat,
- a, 0.,
- c, 0.,
- dx, dy);
-
- p = cairo_pattern_create_for_surface (surf);
- cairo_pattern_set_matrix (p, &mat);
- cairo_pattern_set_filter (p, CAIRO_FILTER_BILINEAR);
- }
-
- /* FIXME: repeating gradients (not to mention hold gradients) don't seem to work. */
- /* cairo_surface_set_repeat (surf, cyclic ? 1 : 0); */
-
- if (gr->pattern)
- cairo_pattern_destroy (gr->pattern);
-
- if (gr->pattern_surface)
- cairo_surface_destroy (gr->pattern_surface);
-
- if (gr->pattern_pixels)
- g_free (gr->pattern_pixels);
-
- gr->pattern_pixels = NULL;
- gr->pattern_surface = surf;
- gr->pattern = cairo_pattern_create_for_surface(surf);
-
- cairo_set_source (gr->cr, gr->pattern);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
- (JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
- (env, obj, jarr, w, h, stride);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
- (JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
-{
- struct graphics2d *gr = NULL;
- jint *jpixels = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
-
- if (gr->debug)
- printf ("setTexturePixelsUnlocked (%d pixels, %dx%d, stride: %d)\n",
- (*env)->GetArrayLength (env, jarr), w, h, stride);
-
- if (gr->pattern)
- cairo_pattern_destroy (gr->pattern);
-
- if (gr->pattern_surface)
- cairo_surface_destroy (gr->pattern_surface);
-
- if (gr->pattern_pixels)
- g_free (gr->pattern_pixels);
-
- gr->pattern = NULL;
- gr->pattern_surface = NULL;
- gr->pattern_pixels = NULL;
-
- gr->pattern_pixels = (char *) g_malloc (h * stride * 4);
- g_assert (gr->pattern_pixels != NULL);
-
- jpixels = (*env)->GetIntArrayElements (env, jarr, NULL);
- g_assert (jpixels != NULL);
- memcpy (gr->pattern_pixels, jpixels, h * stride * 4);
- (*env)->ReleaseIntArrayElements (env, jarr, jpixels, 0);
-
- gr->pattern_surface = cairo_image_surface_create_for_data ((unsigned char *)gr->pattern_pixels,
- CAIRO_FORMAT_ARGB32,
- w, h, stride * 4);
- g_assert (gr->pattern_surface != NULL);
- gr->pattern = cairo_pattern_create_for_surface (gr->pattern_surface);
- g_assert (gr->pattern != NULL);
- cairo_pattern_set_extend (gr->pattern, CAIRO_EXTEND_REPEAT);
- cairo_set_source (gr->cr, gr->pattern);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
- (JNIEnv *env, jobject obj, jintArray java_pixels,
- jint w, jint h, jint stride, jdoubleArray java_matrix)
-{
- struct graphics2d *gr = NULL;
- jint *native_pixels = NULL;
- jdouble *native_matrix = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
-
- if (gr->debug)
- printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n",
- (*env)->GetArrayLength (env, java_pixels), w, h, stride);
-
- native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL);
- native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
- g_assert (native_pixels != NULL);
- g_assert (native_matrix != NULL);
- g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
-
- begin_drawing_operation (env, gr);
-
- {
- cairo_matrix_t mat;
- cairo_pattern_t *p;
- cairo_surface_t *surf = cairo_image_surface_create_for_data ((unsigned char *)native_pixels,
- CAIRO_FORMAT_ARGB32,
- w, h, stride * 4);
- cairo_matrix_init_identity (&mat);
- cairo_matrix_init (&mat,
- native_matrix[0], native_matrix[1],
- native_matrix[2], native_matrix[3],
- native_matrix[4], native_matrix[5]);
-
- p = cairo_pattern_create_for_surface (surf);
- cairo_pattern_set_matrix (p, &mat);
- if (gr->pattern)
- cairo_pattern_set_filter (p, cairo_pattern_get_filter (gr->pattern));
- cairo_set_source (gr->cr, p);
- cairo_paint (gr->cr);
- cairo_pattern_destroy (p);
- cairo_surface_destroy (surf);
- }
-
- end_drawing_operation (env, gr);
-
- (*env)->ReleaseIntArrayElements (env, java_pixels, native_pixels, 0);
- (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
-
- gdk_threads_leave();
-}
-
-/* passthrough methods to cairo */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_save\n");
- cairo_save (gr->cr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_restore\n");
- cairo_restore (gr->cr);
- update_pattern_transform (gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
- (JNIEnv *env, jobject obj, jdoubleArray java_matrix)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked
- (env, obj, java_matrix);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked
- (JNIEnv *env, jobject obj, jdoubleArray java_matrix)
-{
- struct graphics2d *gr = NULL;
- jdouble *native_matrix = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-
- /* cairoSetMatrix was called before this graphics object's component
- was realized. */
- if (gr == NULL)
- return;
-
- native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
- g_assert (native_matrix != NULL);
- g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
-
- if (gr->debug)
- printf ("cairo_matrix_init [ %f, %f, %f, %f, %f, %f ]\n",
- native_matrix[0], native_matrix[1],
- native_matrix[2], native_matrix[3],
- native_matrix[4], native_matrix[5]);
-
- {
- cairo_matrix_t mat;
-
- cairo_matrix_init_identity (&mat);
- cairo_matrix_init (&mat,
- native_matrix[0], native_matrix[1],
- native_matrix[2], native_matrix[3],
- native_matrix[4], native_matrix[5]);
- cairo_set_matrix (gr->cr, &mat);
- }
-
- (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
- update_pattern_transform (gr);
-}
-
-static void
-install_font_peer(cairo_t *cr,
- struct peerfont *pfont,
- int debug)
-{
- cairo_font_face_t *ft;
- FT_Face face = NULL;
-
- g_assert(cr != NULL);
- g_assert(pfont != NULL);
-
- if (pfont->graphics_resource == NULL)
- {
- face = pango_ft2_font_get_face (pfont->font);
- g_assert (face != NULL);
-
- ft = cairo_ft_font_face_create_for_ft_face (face, 0);
- g_assert (ft != NULL);
-
- if (debug) printf ("install_font_peer made new cairo font for '%s' at %f\n",
- face->family_name,
- (pango_font_description_get_size (pfont->desc) /
- (double)PANGO_SCALE));
-
- cairo_set_font_face (cr, ft);
- cairo_font_face_destroy (ft);
- cairo_set_font_size (cr,
- (pango_font_description_get_size (pfont->desc) /
- (double)PANGO_SCALE));
- ft = cairo_get_font_face (cr);
- pfont->graphics_resource = ft;
- }
- else
- {
- if (debug) printf ("install_font_peer reused existing font resource\n");
- ft = (cairo_font_face_t *) pfont->graphics_resource;
- cairo_set_font_face (cr, ft);
- }
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_releasePeerGraphicsResource
- (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font)
-{
- struct peerfont *pfont = NULL;
-
- gdk_threads_enter();
-
- g_assert(java_font != NULL);
-
- pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
- g_assert (pfont != NULL);
- if (pfont->graphics_resource != NULL)
- {
- cairo_font_face_destroy ((cairo_font_face_t *) pfont->graphics_resource);
- pfont->graphics_resource = NULL;
- }
-
- gdk_threads_leave();
-}
-
-static void
-paint_glyph_run(JNIEnv *env,
- struct graphics2d *gr,
- cairo_glyph_t **glyphs,
- gint *n_glyphs,
- PangoLayoutRun *run)
-{
- gint i = 0;
- gint x = 0, y = 0;
-
- g_assert (gr != NULL);
- g_assert (glyphs != NULL);
- g_assert (n_glyphs != NULL);
- g_assert (run != NULL);
-
- if (run->glyphs != NULL && run->glyphs->num_glyphs > 0)
- {
- if (*n_glyphs < run->glyphs->num_glyphs)
- {
- *glyphs = g_realloc(*glyphs,
- (sizeof(cairo_glyph_t)
- * run->glyphs->num_glyphs));
- *n_glyphs = run->glyphs->num_glyphs;
- }
-
- g_assert (*glyphs != NULL);
-
- if (gr->debug) printf ("painting %d glyphs: ", run->glyphs->num_glyphs);
-
- for (i = 0; i < run->glyphs->num_glyphs; ++i)
- {
- (*glyphs)[i].index = run->glyphs->glyphs[i].glyph;
-
- (*glyphs)[i].x =
- ((double) (x + run->glyphs->glyphs[i].geometry.x_offset))
- / ((double) PANGO_SCALE);
-
- (*glyphs)[i].y =
- ((double) (y + run->glyphs->glyphs[i].geometry.y_offset))
- / ((double) PANGO_SCALE);
-
- if (gr->debug) printf(" (%ld @ %f,%f)",
- (*glyphs)[i].index,
- (*glyphs)[i].x,
- (*glyphs)[i].y);
-
- x += run->glyphs->glyphs[i].geometry.width;
- }
-
- if (gr->debug) printf("\n");
- begin_drawing_operation (env, gr);
- cairo_show_glyphs (gr->cr, *glyphs, run->glyphs->num_glyphs);
- end_drawing_operation (env, gr);
- }
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector
- (JNIEnv *env, jobject self,
- jobject font,
- jfloat x, jfloat y, jint n,
- jintArray java_codes,
- jfloatArray java_positions)
-{
-
- struct graphics2d *gr = NULL;
- struct peerfont *pfont = NULL;
- cairo_glyph_t *glyphs = NULL;
- int *native_codes;
- float *native_positions;
- jint i = 0;
-
- gdk_threads_enter ();
-
- g_assert (self != NULL);
- g_assert (java_codes != NULL);
- g_assert (java_positions != NULL);
-
- if (peer_is_disposed(env, self))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *)NSA_GET_G2D_PTR (env, self);
- g_assert (gr != NULL);
-
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
- g_assert (pfont != NULL);
-
- install_font_peer(gr->cr, pfont, gr->debug);
-
- glyphs = g_malloc( sizeof(cairo_glyph_t) * n);
- g_assert (glyphs != NULL);
-
- native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
- native_positions = (*env)->GetFloatArrayElements (env, java_positions, NULL);
-
- for (i = 0; i < n; ++i)
- {
- glyphs[i].index = native_codes[i];
- glyphs[i].x = x + native_positions[ 2*i ];
- glyphs[i].y = y + native_positions[ 2*i + 1];
- }
-
- (*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
- (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
-
- begin_drawing_operation (env, gr);
- cairo_show_glyphs (gr->cr, glyphs, n);
- end_drawing_operation (env, gr);
-
- g_free(glyphs);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout
- (JNIEnv *env, jobject self, jobject java_layout, jfloat x, jfloat y)
-{
- /*
- * FIXME: Some day we expect either cairo or pango will know how to make
- * a pango layout paint to a cairo surface. that day is not yet here.
- */
-
- struct graphics2d *gr = NULL;
- struct textlayout *tl = NULL;
- PangoLayoutIter *i = NULL;
- PangoLayoutRun *run = NULL;
- cairo_glyph_t *glyphs = NULL;
- gint n_glyphs = 0;
-
- gdk_threads_enter ();
-
- g_assert (self != NULL);
- g_assert (java_layout != NULL);
-
- gr = (struct graphics2d *)NSA_GET_G2D_PTR (env, self);
- tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, java_layout);
-
- g_assert (gr != NULL);
- g_assert (tl != NULL);
- g_assert (tl->pango_layout != NULL);
-
- if (gr->debug) printf ("painting pango layout\n");
-
- if (peer_is_disposed(env, self))
- {
- gdk_threads_leave();
- return;
- }
-
- i = pango_layout_get_iter (tl->pango_layout);
- g_assert (i != NULL);
-
- cairo_translate (gr->cr, x, y);
-
- do
- {
- run = pango_layout_iter_get_run (i);
- if (run != NULL)
- paint_glyph_run (env, gr, &glyphs, &n_glyphs, run);
- }
- while (pango_layout_iter_next_run (i));
-
- if (glyphs != NULL)
- g_free (glyphs);
-
- cairo_translate (gr->cr, -x, -y);
-
- pango_layout_iter_free (i);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator
- (JNIEnv *env, jobject obj, jint op)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_operator %d\n", op);
- switch ((enum java_awt_alpha_composite_rule) op)
- {
- case java_awt_alpha_composite_CLEAR:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_CLEAR);
- break;
-
- case java_awt_alpha_composite_SRC:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_SOURCE);
- break;
-
- case java_awt_alpha_composite_SRC_OVER:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_OVER);
- break;
-
- case java_awt_alpha_composite_DST_OVER:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_OVER);
- break;
-
- case java_awt_alpha_composite_SRC_IN:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_IN);
- break;
-
- case java_awt_alpha_composite_DST_IN:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_IN);
- break;
-
- case java_awt_alpha_composite_SRC_OUT:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_OUT);
- break;
-
- case java_awt_alpha_composite_DST_OUT:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_OUT);
- break;
-
- case java_awt_alpha_composite_DST:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST);
- break;
-
- case java_awt_alpha_composite_SRC_ATOP:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_ATOP);
- break;
-
- case java_awt_alpha_composite_DST_ATOP:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_DEST_ATOP);
- break;
-
- case java_awt_alpha_composite_XOR:
- cairo_set_operator (gr->cr, CAIRO_OPERATOR_XOR);
- break;
- }
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColor
- (JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked
- (env, obj, r, g, b, a);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked
- (JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
-{
- struct graphics2d *gr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
-
- /* this is a very weird fact: GDK Pixbufs and RENDER drawables consider
- colors in opposite pixel order. I have no idea why. thus when you
- draw to a PixBuf, you must exchange the R and B components of your
- color. */
-
- if (gr->debug)
- printf ("cairo_set_source_rgba (%f, %f, %f, %f)\n", r, g, b, a);
-
- if (gr->drawbuf)
- cairo_set_source_rgba (gr->cr, b, g, r, a);
- else
- cairo_set_source_rgba (gr->cr, r, g, b, a);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule
- (JNIEnv *env, jobject obj, jint rule)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- if (gr->debug) printf ("cairo_set_fill_rule %d\n", rule);
- g_assert (gr != NULL);
- switch ((enum java_awt_geom_path_iterator_winding_rule) rule)
- {
- case java_awt_geom_path_iterator_WIND_NON_ZERO:
- cairo_set_fill_rule (gr->cr, CAIRO_FILL_RULE_WINDING);
- break;
- case java_awt_geom_path_iterator_WIND_EVEN_ODD:
- cairo_set_fill_rule (gr->cr, CAIRO_FILL_RULE_EVEN_ODD);
- break;
- }
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth
- (JNIEnv *env, jobject obj, jdouble width)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidthUnlocked
- (env, obj, width);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidthUnlocked
- (JNIEnv *env, jobject obj, jdouble width)
-{
- struct graphics2d *gr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_line_width %f\n", width);
- cairo_set_line_width (gr->cr, width);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
- (JNIEnv *env, jobject obj, jint cap)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCapUnlocked
- (env, obj, cap);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCapUnlocked
- (JNIEnv *env, jobject obj, jint cap)
-{
- struct graphics2d *gr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_line_cap %d\n", cap);
- switch ((enum java_awt_basic_stroke_cap_rule) cap)
- {
- case java_awt_basic_stroke_CAP_BUTT:
- cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_BUTT);
- break;
-
- case java_awt_basic_stroke_CAP_ROUND:
- cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_ROUND);
- break;
-
- case java_awt_basic_stroke_CAP_SQUARE:
- cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_SQUARE);
- break;
- }
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
- (JNIEnv *env, jobject obj, jint join)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoinUnlocked
- (env, obj, join);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoinUnlocked
- (JNIEnv *env, jobject obj, jint join)
-{
- struct graphics2d *gr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_line_join %d\n", join);
- switch ((enum java_awt_basic_stroke_join_rule) join)
- {
- case java_awt_basic_stroke_JOIN_MITER:
- cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_MITER);
- break;
-
- case java_awt_basic_stroke_JOIN_ROUND:
- cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_ROUND);
- break;
-
- case java_awt_basic_stroke_JOIN_BEVEL:
- cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_BEVEL);
- break;
- }
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
- (JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDashUnlocked
- (env, obj, dashes, ndash, offset);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDashUnlocked
- (JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
-{
- struct graphics2d *gr = NULL;
- jdouble *dasharr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_dash\n");
- dasharr = (*env)->GetDoubleArrayElements (env, dashes, NULL);
- g_assert (dasharr != NULL);
- cairo_set_dash (gr->cr, dasharr, ndash, offset);
- (*env)->ReleaseDoubleArrayElements (env, dashes, dasharr, 0);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit
- (JNIEnv *env, jobject obj, jdouble miter)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimitUnlocked
- (env, obj, miter);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimitUnlocked
- (JNIEnv *env, jobject obj, jdouble miter)
-{
- struct graphics2d *gr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_miter_limit %f\n", miter);
- cairo_set_miter_limit (gr->cr, miter);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-
- if (gr == NULL)
- {
- gdk_threads_leave ();
- return;
- }
-
- if (gr->debug) printf ("cairo_new_path\n");
- cairo_new_path (gr->cr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo
- (JNIEnv *env, jobject obj, jdouble x, jdouble y)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_move_to (%f, %f)\n", x, y);
- cairo_move_to (gr->cr, x, y);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo
- (JNIEnv *env, jobject obj, jdouble x, jdouble y)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_line_to (%f, %f)\n", x, y);
- cairo_line_to (gr->cr, x, y);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo
- (JNIEnv *env, jobject obj, jdouble x1, jdouble y1, jdouble x2, jdouble y2, jdouble x3, jdouble y3)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug)
- printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n",
- x1, y1, x2, y2, x3, y3);
- cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelMoveTo
- (JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_rel_move_to (%f, %f)\n", dx, dy);
- cairo_rel_move_to (gr->cr, dx, dy);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelLineTo
- (JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_rel_line_to (%f, %f)\n", dx, dy);
- cairo_rel_line_to (gr->cr, dx, dy);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo
- (JNIEnv *env, jobject obj, jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug)
- printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n",
- dx1, dy1, dx2, dy2, dx3, dy3);
- cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle
- (JNIEnv *env, jobject obj, jdouble x, jdouble y, jdouble width, jdouble height)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-
- if (gr == NULL)
- {
- gdk_threads_leave ();
- return;
- }
-
- if (gr->debug)
- printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height);
- cairo_rectangle (gr->cr, x, y, width, height);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClosePath
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_close_path\n");
- cairo_close_path (gr->cr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_stroke\n");
- begin_drawing_operation (env, gr);
- cairo_stroke (gr->cr);
- end_drawing_operation (env, gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_fill\n");
- begin_drawing_operation (env, gr);
- cairo_fill (gr->cr);
- end_drawing_operation (env, gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
- (JNIEnv *env, jobject obj)
-{
- struct graphics2d *gr = NULL;
-
- gdk_threads_enter();
-
- if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave();
- return;
- }
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-
- if (gr == NULL)
- {
- gdk_threads_leave ();
- return;
- }
-
- if (gr->debug) printf ("cairo_clip\n");
- begin_drawing_operation (env, gr);
- cairo_reset_clip (gr->cr);
- cairo_clip (gr->cr);
- end_drawing_operation (env, gr);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter
- (JNIEnv *env, jobject obj, jint filter)
-{
- gdk_threads_enter();
-
- Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked
- (env, obj, filter);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked
- (JNIEnv *env, jobject obj, jint filter)
-{
- struct graphics2d *gr = NULL;
-
- if (peer_is_disposed(env, obj))
- return;
-
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
-
- if (gr->pattern == NULL)
- return;
-
- if (gr->debug) printf ("cairo_pattern_set_filter %d\n", filter);
- switch ((enum java_awt_rendering_hints_filter) filter)
- {
- case java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR:
- cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_NEAREST);
- break;
- case java_awt_rendering_hints_VALUE_INTERPOLATION_BILINEAR:
- cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BILINEAR);
- break;
- case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_SPEED:
- cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_FAST);
- break;
- case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_DEFAULT:
- cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_NEAREST);
- break;
- case java_awt_rendering_hints_VALUE_ALPHA_INTERPOLATION_QUALITY:
- cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BEST);
- break;
- }
-}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
index eba00fb6827..c8d9fb5512c 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
@@ -278,7 +278,7 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
(JNIEnv *env, jclass clazz)
{
- jclass dataOutputClass;
+ jclass writerClass;
(*env)->GetJavaVM(env, &vm);
@@ -296,9 +296,9 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
"(Ljava/lang/String;Z)"
"Lgnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec;");
-
- dataOutputClass = (*env)->FindClass(env, "java/io/DataOutput");
- dataOutputWriteID = (*env)->GetMethodID (env, dataOutputClass,
+ writerClass = (*env)->FindClass
+ (env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder$GdkPixbufWriter");
+ dataOutputWriteID = (*env)->GetMethodID (env, writerClass,
"write", "([B)V");
query_formats (env, clazz);
@@ -344,7 +344,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpDone
struct stream_save_request
{
JNIEnv *env;
- jobject *stream;
+ jobject *writer;
};
static gboolean
@@ -358,30 +358,23 @@ save_to_stream(const gchar *buf,
jbyteArray jbuf;
jbyte *cbuf;
- /* FIXME. Don't call user code directly on this thread.
- Store bytes and signal a "pump" thread to deliver to user code.
- Then we don't have to drop/acquire any locks. */
- gdk_threads_leave ();
-
jbuf = (*(ssr->env))->NewByteArray ((ssr->env), count);
cbuf = (*(ssr->env))->GetByteArrayElements ((ssr->env), jbuf, NULL);
memcpy (cbuf, buf, count);
(*(ssr->env))->ReleaseByteArrayElements ((ssr->env), jbuf, cbuf, 0);
- (*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->stream),
+ (*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->writer),
dataOutputWriteID, jbuf);
(*(ssr->env))->DeleteLocalRef((ssr->env), jbuf);
- gdk_threads_enter ();
-
return TRUE;
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage
-(JNIEnv *env, jclass clazz __attribute__((unused)),
+(JNIEnv *env, jclass clazz __attribute__((unused)),
jintArray jarr, jstring jenctype, jint width, jint height,
- jboolean hasAlpha, jobject stream)
+ jboolean hasAlpha, jobject writer)
{
GdkPixbuf* pixbuf;
jint *ints;
@@ -391,7 +384,7 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage
int i;
struct stream_save_request ssr;
- ssr.stream = &stream;
+ ssr.writer = &writer;
ssr.env = env;
ints = (*env)->GetIntArrayElements (env, jarr, NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
index 92f2d37ca42..84999879147 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
@@ -44,6 +44,7 @@
#include <pango/pangofc-font.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
+#include "jcl.h"
#include "native_state.h"
#include "gdkfont.h"
#include "gnu_java_awt_peer_gtk_GdkTextLayout.h"
@@ -239,23 +240,21 @@ Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkTextLayout_cairoDrawGdkTextLayout
- (JNIEnv *env, jobject obj, jobject cairographics, jfloat x, jfloat y)
+ (JNIEnv *env, jobject obj, jlong cg2d, jfloat x, jfloat y)
{
/*
* FIXME: Some day we expect either cairo or pango will know how to make
* a pango layout paint to a cairo surface. that day is not yet here.
*/
- cairo_t *cr;
+ struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, cg2d);
+ cairo_t *cr = gr->cr;
struct textlayout *tl = NULL;
PangoLayoutIter *i = NULL;
PangoLayoutRun *run = NULL;
cairo_glyph_t *glyphs = NULL;
gint n_glyphs = 0;
- g_assert (cairographics != NULL);
-
- cr = cp_gtk_get_cairo_t(env, cairographics);
tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, obj);
g_assert (cr != NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
index 5ca21a5677a..d7ef474e002 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
@@ -47,11 +47,6 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkVolatileImage.h"
#include "cairographics2d.h"
-/* prototypes */
-static void *getNativeObject( JNIEnv *env, jobject obj );
-/* static void setNativeObject( JNIEnv *env, jobject obj, void *ptr ); */
-
-GdkPixmap *cp_gtk_get_pixmap( JNIEnv *env, jobject obj);
/**
* Creates a cairo surface, ARGB32, native ordering, premultiplied alpha.
@@ -91,9 +86,11 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_init (JNIEnv *env,
* Destroy the surface
*/
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy (JNIEnv *env, jobject obj)
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
+ jlong pointer)
{
- GdkPixmap* pixmap = getNativeObject(env, obj);
+ GdkPixmap* pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
if( pixmap != NULL )
{
gdk_threads_enter();
@@ -106,8 +103,8 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_destroy (JNIEnv *env, jobject obj)
* Gets all pixels in an array
*/
JNIEXPORT jintArray JNICALL
-Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels
-(JNIEnv *env, jobject obj)
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeGetPixels
+(JNIEnv *env, jobject obj, jlong pointer)
{
/* jint *pixeldata, *jpixdata; */
jint *jpixdata;
@@ -126,7 +123,7 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels
g_assert (field != 0);
height = (*env)->GetIntField (env, obj, field);
- pixmap = GDK_PIXMAP(getNativeObject(env, obj));
+ pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
g_assert(pixmap != NULL);
gdk_threads_enter();
@@ -149,11 +146,12 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_getPixels
* Copy area
*/
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkVolatileImage_copyArea
-(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h, jint dx, jint dy)
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeCopyArea
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
+ jlong pointer, jint x, jint y, jint w, jint h, jint dx, jint dy)
{
GdkPixbuf *pixbuf;
- GdkPixmap* pixmap = getNativeObject(env, obj);
+ GdkPixmap* pixmap = JLONG_TO_PTR(GdkPixmap, pointer);
g_assert (pixmap != NULL);
@@ -169,14 +167,15 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_copyArea
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkVolatileImage_drawVolatile
-(JNIEnv *env, jobject obj, jlong ptr, jint x, jint y, jint w, jint h)
+Java_gnu_java_awt_peer_gtk_GtkVolatileImage_nativeDrawVolatile
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute((unused)),
+ jlong pointer, jlong srcptr, jint x, jint y, jint w, jint h)
{
GdkPixmap *dst, *src;
GdkGC *gc;
- src = JLONG_TO_PTR(GdkPixmap, ptr);
- dst = getNativeObject(env, obj);
+ src = JLONG_TO_PTR(GdkPixmap, srcptr);
+ dst = JLONG_TO_PTR(GdkPixmap, pointer);
g_assert (src != NULL);
g_assert (dst != NULL);
@@ -194,23 +193,3 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_drawVolatile
gdk_threads_leave();
}
-GdkPixmap *cp_gtk_get_pixmap( JNIEnv *env, jobject obj)
-{
- return (GdkPixmap *)getNativeObject(env, obj);
-}
-
-/**
- * Gets the native object field.
- */
-static void *
-getNativeObject( JNIEnv *env, jobject obj )
-{
- jclass cls;
- jlong value;
- jfieldID nofid;
- cls = (*env)->GetObjectClass( env, obj );
- nofid = (*env)->GetFieldID( env, cls, "nativePointer", "J" );
- value = (*env)->GetLongField( env, obj, nofid );
- (*env)->DeleteLocalRef( env, cls );
- return JLONG_TO_PTR(void, value);
-}
diff --git a/libjava/classpath/native/jni/gtk-peer/gtkcairopeer.h b/libjava/classpath/native/jni/gtk-peer/gtkcairopeer.h
deleted file mode 100644
index dee843c8a70..00000000000
--- a/libjava/classpath/native/jni/gtk-peer/gtkcairopeer.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __GTKCAIROPEER_H__
-#define __GTKCAIROPEER_H__
-
-/* gtkcairopeer.h -- Some global variables and #defines
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include <cairo.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-/*
- A graphics2d struct is both simpler and uglier than a graphics
- struct.
-
- Most of the graphics2d drawing state is held in the referenced cairo_t
- and corresponding cairo_surface_t, so we can ignore it.
-
- In addition to the cairo_t, we need to hold an extra reference to the
- underlying GdkDrawable so its refcount matches the lifecycle of the java
- Graphics object which is peering with us; also a reference to a byte
- buffer and cairo_surface_t which contain the pattern you're drawing from
- (if it exists).
-
- Finally, it is possible that we are using a non-RENDER capable X server,
- therefore we will be drawing to an cairo_surface_t which is actually a
- pixbuf. When this is the case, the pointer to a GdkPixbuf will be
- non-NULL and any drawing operation needs to be bracketed by pixbuf
- load/save operations. If the GdkPixbuf pointer is NULL, we will treat
- the cairo_surface_t as RENDER-capable.
- */
-
-struct graphics2d
-{
- cairo_t *cr;
- cairo_surface_t *surface;
- GdkDrawable *drawable;
- GdkWindow *win;
- GdkPixbuf *drawbuf;
- char *pattern_pixels;
- cairo_surface_t *pattern_surface;
- cairo_pattern_t *pattern;
- gboolean debug;
- enum
- {
- MODE_DRAWABLE_WITH_RENDER,
- MODE_DRAWABLE_NO_RENDER,
- MODE_JAVA_ARRAY
- }
- mode;
-
- /* Support for MODE_JAVA_ARRAY */
- jintArray jarray;
- jint width, height;
- jint *javabuf;
- jint *javabuf_copy;
- jboolean isCopy;
-};
-
-#endif /* __GTKCAIROPEER_H */
diff --git a/libjava/classpath/native/plugin/Makefile.am b/libjava/classpath/native/plugin/Makefile.am
index 19c7618d8d5..920cce62014 100644
--- a/libjava/classpath/native/plugin/Makefile.am
+++ b/libjava/classpath/native/plugin/Makefile.am
@@ -1,17 +1,24 @@
-lib_LTLIBRARIES = libgcjwebplugin.la
+## GCJ LOCAL: install this library in GCJ's versioned library
+## directory
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
+gcjversionedlib_LTLIBRARIES = libgcjwebplugin.la
libgcjwebplugin_la_SOURCES = gcjwebplugin.cc
libgcjwebplugin_la_CXXFLAGS = \
- -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/appletviewer\"" \
+ -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \
-DPLUGIN_DATA_DIRECTORY="\"$(PLUGIN_DIR)/gcjwebplugin-data\"" \
$(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
-libgcjwebplugin_la_LDFLAGS = -avoid-version \
+## GCJ LOCAL: encode the library path and use GCJ's library version
+libgcjwebplugin_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
+ -version-info `grep -v '^\#' $(top_srcdir)/../libtool-version` \
$(GLIB_LIBS) $(GTK_LIBS) \
-lstdc++
-install-plugin: $(lib_LTLIBRARIES)
+## GCJ LOCAL: depend on gcjversionedlib_LTLIBRARIES
+install-plugin: $(gcjversionedlib_LTLIBRARIES)
$(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR)
$(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR)
diff --git a/libjava/classpath/native/plugin/Makefile.in b/libjava/classpath/native/plugin/Makefile.in
index 22b8d3d0934..b1fe45a72d8 100644
--- a/libjava/classpath/native/plugin/Makefile.in
+++ b/libjava/classpath/native/plugin/Makefile.in
@@ -58,9 +58,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(libdir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(lib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(gcjversionedlibdir)"
+gcjversionedlibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(gcjversionedlib_LTLIBRARIES)
libgcjwebplugin_la_LIBADD =
am_libgcjwebplugin_la_OBJECTS = libgcjwebplugin_la-gcjwebplugin.lo
libgcjwebplugin_la_OBJECTS = $(am_libgcjwebplugin_la_OBJECTS)
@@ -294,14 +294,17 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-lib_LTLIBRARIES = libgcjwebplugin.la
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+gcjversionedlibdir = $(libdir)/gcj-$(gcc_version)
+gcjversionedlib_LTLIBRARIES = libgcjwebplugin.la
libgcjwebplugin_la_SOURCES = gcjwebplugin.cc
libgcjwebplugin_la_CXXFLAGS = \
- -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/appletviewer\"" \
+ -Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \
-DPLUGIN_DATA_DIRECTORY="\"$(PLUGIN_DIR)/gcjwebplugin-data\"" \
$(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
-libgcjwebplugin_la_LDFLAGS = -avoid-version \
+libgcjwebplugin_la_LDFLAGS = -rpath $(gcjversionedlibdir) \
+ -version-info `grep -v '^\#' $(top_srcdir)/../libtool-version` \
$(GLIB_LIBS) $(GTK_LIBS) \
-lstdc++
@@ -338,35 +341,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+install-gcjversionedlibLTLIBRARIES: $(gcjversionedlib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(gcjversionedlibdir)" || $(mkdir_p) "$(DESTDIR)$(gcjversionedlibdir)"
+ @list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gcjversionedlibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(gcjversionedlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gcjversionedlibdir)/$$f"; \
else :; fi; \
done
-uninstall-libLTLIBRARIES:
+uninstall-gcjversionedlibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gcjversionedlibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gcjversionedlibdir)/$$p"; \
done
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+clean-gcjversionedlibLTLIBRARIES:
+ -test -z "$(gcjversionedlib_LTLIBRARIES)" || rm -f $(gcjversionedlib_LTLIBRARIES)
+ @list='$(gcjversionedlib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libgcjwebplugin.la: $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_DEPENDENCIES)
- $(CXXLINK) -rpath $(libdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS)
+ $(CXXLINK) -rpath $(gcjversionedlibdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -493,7 +496,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(libdir)"; do \
+ for dir in "$(DESTDIR)$(gcjversionedlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -522,7 +525,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+clean-am: clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
@@ -541,9 +544,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-gcjversionedlibLTLIBRARIES
-install-exec-am: install-libLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -569,23 +572,24 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+uninstall-am: uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am \
- install-libLTLIBRARIES install-man install-strip installcheck \
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-gcjversionedlibLTLIBRARIES clean-generic clean-libtool \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am \
+ install-gcjversionedlibLTLIBRARIES install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-info-am \
- uninstall-libLTLIBRARIES
+ tags uninstall uninstall-am \
+ uninstall-gcjversionedlibLTLIBRARIES uninstall-info-am
-install-plugin: $(lib_LTLIBRARIES)
+install-plugin: $(gcjversionedlib_LTLIBRARIES)
$(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR)
$(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR)
diff --git a/libjava/classpath/native/plugin/gcjwebplugin.cc b/libjava/classpath/native/plugin/gcjwebplugin.cc
index deae8109772..1202c4719aa 100644
--- a/libjava/classpath/native/plugin/gcjwebplugin.cc
+++ b/libjava/classpath/native/plugin/gcjwebplugin.cc
@@ -79,6 +79,10 @@ exception statement from your version. */
g_printerr ("%s:%d: thread %p: Error: %s: %s\n", __FILE__, __LINE__, \
g_thread_self (), first, second)
+#define PLUGIN_ERROR_THREE(first, second, third) \
+ g_printerr ("%s:%d: thread %p: Error: %s: %s: %s\n", __FILE__, \
+ __LINE__, g_thread_self (), first, second, third)
+
// Plugin information passed to about:plugins.
#define PLUGIN_NAME "GCJ Web Browser Plugin"
#define PLUGIN_DESC "The " PLUGIN_NAME " executes Java applets."
@@ -120,7 +124,6 @@ exception statement from your version. */
// Security dialog messages.
#define RESPONSE_TRUST_APPLET "Trust Applet"
#define RESPONSE_TRUST_APPLET_ADD_TO_LIST "Trust Applet and Add to Whitelist"
-#define WHITELIST_FILENAME PLUGIN_DATA_DIRECTORY "/whitelist.txt"
#define SECURITY_WARNING \
"%s wants to load an applet.\n" \
"GNU Classpath's security implementation is not complete.\n" \
@@ -132,7 +135,7 @@ exception statement from your version. */
" and run this applet from now on, without asking.\n" \
"The whitelist is a list of the URLs from which you trust" \
" applets.\n" \
- "Your whitelist file is \"" WHITELIST_FILENAME "\"."
+ "Your whitelist file is \" %s \"."
#define FAILURE_MESSAGE \
"This page wants to load an applet.\n" \
"The appletviewer is missing or not installed properly in \"" \
@@ -144,9 +147,15 @@ static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
// Browser function table.
static NPNetscapeFuncs browserFunctions;
+// Data directory for plugin.
+static gchar* data_directory;
+
+// Whitelist filename
+static gchar* whitelist_filename;
+
// Keeps track of initialization. NP_Initialize should only be
// called once.
-bool initialized = false;
+gboolean initialized = false;
// GCJPluginData stores all the data associated with a single plugin
// instance. A separate plugin instance is created for each <APPLET>
@@ -314,21 +323,40 @@ GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
" Browser not Mozilla-based?");
goto cleanup_appletviewer_mutex;
}
+
+ // Open the user's documentbase whitelist.
+ whitelist_file = g_io_channel_new_file (whitelist_filename,
+ "a+", &channel_error);
+ if (!whitelist_file)
+ {
+ if (channel_error)
+ {
+ PLUGIN_ERROR_THREE ("Failed to open whitelist file",
+ whitelist_filename,
+ channel_error->message);
+ g_error_free (channel_error);
+ channel_error = NULL;
+ }
+ else
+ PLUGIN_ERROR_TWO ("Failed to open whitelist file",
+ whitelist_filename);
+ return NPERR_GENERIC_ERROR;
+ }
+
if (!plugin_user_trusts_documentbase (documentbase))
{
PLUGIN_ERROR ("User does not trust applet.");
np_error = NPERR_GENERIC_ERROR;
goto cleanup_appletviewer_mutex;
}
-
+
// Create appletviewer-to-plugin pipe which we refer to as the input
// pipe.
// data->in_pipe_name
- data->in_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY
- "/gcj-%s-appletviewer-to-plugin",
- data->instance_string);
+ data->in_pipe_name = g_strdup_printf ("%s/gcj-%s-appletviewer-to-plugin",
+ data_directory, data->instance_string);
if (!data->in_pipe_name)
{
PLUGIN_ERROR ("Failed to create input pipe name.");
@@ -349,9 +377,8 @@ GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
// output pipe.
// data->out_pipe_name
- data->out_pipe_name = g_strdup_printf (PLUGIN_DATA_DIRECTORY
- "/gcj-%s-plugin-to-appletviewer",
- data->instance_string);
+ data->out_pipe_name = g_strdup_printf ("%s/gcj-%s-plugin-to-appletviewer",
+ data_directory, data->instance_string);
if (!data->out_pipe_name)
{
@@ -952,7 +979,7 @@ plugin_user_trusts_documentbase (char* documentbase)
channel_error = NULL;
}
else
- PLUGIN_ERROR ("Failed to open whitelist file.");
+ PLUGIN_ERROR ("Failed to read line from whitelist file.");
g_free (whitelist_entry);
whitelist_entry = NULL;
break;
@@ -1061,7 +1088,7 @@ plugin_ask_user_about_documentbase (char* documentbase)
SECURITY_WARNING,
documentbase);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- SECURITY_DESCRIPTION);
+ SECURITY_DESCRIPTION, whitelist_filename);
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
@@ -1577,7 +1604,7 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
return NPERR_INVALID_FUNCTABLE_ERROR;
}
-
+
// Ensure that the major version of the plugin API that the browser
// expects is not more recent than the major version of the API that
// we've implemented.
@@ -1606,43 +1633,25 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
return NPERR_INVALID_FUNCTABLE_ERROR;
}
+ data_directory = g_strconcat(getenv("HOME"), "/.gcjwebplugin", NULL);
+ whitelist_filename = g_strconcat (data_directory, "/whitelist.txt", NULL);
// Make sure the plugin data directory exists, creating it if
// necessary.
- if (!g_file_test (PLUGIN_DATA_DIRECTORY,
+ if (!g_file_test (data_directory,
(GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
{
int file_error = 0;
- file_error = g_mkdir (PLUGIN_DATA_DIRECTORY, 0700);
+ file_error = g_mkdir (data_directory, 0700);
if (file_error != 0)
{
- PLUGIN_ERROR_TWO ("Failed to create data directory "
- PLUGIN_DATA_DIRECTORY " ",
- strerror (errno));
+ PLUGIN_ERROR_THREE ("Failed to create data directory",
+ data_directory,
+ strerror (errno));
return NPERR_GENERIC_ERROR;
}
}
- // Open the user's documentbase whitelist.
- whitelist_file = g_io_channel_new_file (WHITELIST_FILENAME,
- "a+", &channel_error);
- if (!whitelist_file)
- {
- if (channel_error)
- {
- PLUGIN_ERROR_TWO ("Failed to open whitelist file "
- WHITELIST_FILENAME " ",
- channel_error->message);
- g_error_free (channel_error);
- channel_error = NULL;
- }
- else
- PLUGIN_ERROR ("Failed to open whitelist file "
- WHITELIST_FILENAME);
-
- return NPERR_GENERIC_ERROR;
- }
-
// Store in a local table the browser functions that we may use.
browserFunctions.version = browserTable->version;
browserFunctions.size = browserTable->size;
@@ -1750,6 +1759,18 @@ NP_Shutdown (void)
g_io_channel_close (whitelist_file);
whitelist_file = NULL;
}
+
+ if (data_directory)
+ {
+ g_free (data_directory);
+ data_directory = NULL;
+ }
+
+ if (whitelist_filename)
+ {
+ g_free (whitelist_filename);
+ whitelist_filename = NULL;
+ }
initialized = false;
diff --git a/libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties b/libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties
new file mode 100644
index 00000000000..bbd7618a6b5
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties
@@ -0,0 +1,70 @@
+# MessagesBundle.properties -- English language messages
+# Copyright (C) 2004, 2006 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.
+
+gcjwebplugin.code_description=specify the code attribute
+gcjwebplugin.codebase_description=specify the codebase attribute
+gcjwebplugin.archive_description=specify the archive attribute
+gcjwebplugin.width_description=specify the width attribute
+gcjwebplugin.height_description=specify the height attribute
+gcjwebplugin.param_description=specify the parameter arguments
+gcjwebplugin.plugin_description=enable plugin mode
+gcjwebplugin.verbose_description=enable verbose mode
+gcjwebplugin.debug_description=enable debugging mode (not implemented)
+gcjwebplugin.encoding_description=specify the HTML character encoding
+
+gcjwebplugin.no_input_files=appletviewer: no input files
+
+gcjwebplugin.menu_title=Applet
+gcjwebplugin.menu_reload=Reload
+gcjwebplugin.menu_restart=Restart
+gcjwebplugin.menu_start=Start
+gcjwebplugin.menu_stop=Stop
+gcjwebplugin.menu_clone=Clone ...
+gcjwebplugin.menu_quit=Quit
+gcjwebplugin.menu_close=Close
+gcjwebplugin.menu_tag=Tag ...
+gcjwebplugin.menu_info=Info ...
+gcjwebplugin.menu_edit=Edit
+gcjwebplugin.menu_encoding=Character Encoding
+gcjwebplugin.menu_print=Print ...
+gcjwebplugin.menu_properties=Properties ...
+gcjwebplugin.menu_cancel=Cancel
+gcjwebplugin.menu_save=Save ...
+
+gcjwebplugin.console_title=GCJ web plugin console
+gcjwebplugin.console_clear=Clear
+gcjwebplugin.console_hide=Hide
diff --git a/libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties b/libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties
new file mode 100644
index 00000000000..036b86f30cd
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties
@@ -0,0 +1,75 @@
+# MessagesBundle_de.properties -- German language messages
+# Copyright (C) 2004, 2006 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.
+
+# FIXME: rewrite this:
+gcjwebplugin.help.0=Syntax: appletviewer [Optionen] <Dateiname>.class | <Dateiname>.html... | URL...
+gcjwebplugin.help.1=Optionen:
+gcjwebplugin.help.2= --help Diese Hilfe anzeigen and beenden
+gcjwebplugin.help.3= --version Version anzeigen und beenden
+gcjwebplugin.help.4= --code=<Klassenname>[.class] Applet mit Klassen- oder Dateiname ausführen
+gcjwebplugin.help.5= --codebase=<Verzeichnis> Applet-Codebasis setzen
+gcjwebplugin.help.6= --archive=<Dateiname>.jar[,...] Archive zum Klassenlader hinzufügen
+gcjwebplugin.help.7= --param=<Name>,<Wert> Parameter an Applet übergeben
+gcjwebplugin.help.8= --width=<Breite> Setze Breite des Appletfensters
+gcjwebplugin.help.9= --height=<Höhe> Setze Höhe des Appletfensters
+gcjwebplugin.help.10= --plugin=<Eingabepipe>,<Ausgabepipe> Pluginmodus einschalten
+gcjwebplugin.help.11= -debug Starten des Applet-Viewers im Java-Debugger (nicht implementiert)
+gcjwebplugin.help.12= -encoding <Codierung> Angabe der von HTML-Dateien verwendeten Zeichencodierung
+gcjwebplugin.help.13= -J<Laufzeit-Flag> Übergeben des Arguments an den Java-Interpreter
+
+gcjwebplugin.no_input_files=appletviewer: keine Dateien angegeben
+
+gcjwebplugin.menu_title=Applet
+gcjwebplugin.menu_reload=Neu laden
+gcjwebplugin.menu_restart=Neu starten
+gcjwebplugin.menu_start=Start
+gcjwebplugin.menu_stop=Stop
+gcjwebplugin.menu_clone=Klonen ...
+gcjwebplugin.menu_quit=Beenden
+gcjwebplugin.menu_tag=Tag ...
+gcjwebplugin.menu_info=Informationen ...
+gcjwebplugin.menu_edit=Bearbeiten
+gcjwebplugin.menu_encoding=Zeichenkodierung
+gcjwebplugin.menu_print=Drucken ...
+gcjwebplugin.menu_properties=Eigenschaften ...
+gcjwebplugin.menu_close=Schließen
+gcjwebplugin.menu_cancel=Abbrechen
+gcjwebplugin.menu_save=Speichern unter ...
+
+gcjwebplugin.console_title=GCJ web plugin Konsole
+gcjwebplugin.console_clear=Löschen
+gcjwebplugin.console_hide=Schließen
diff --git a/libjava/classpath/resource/gnu/classpath/tools/getopt/Messages.properties b/libjava/classpath/resource/gnu/classpath/tools/getopt/Messages.properties
new file mode 100644
index 00000000000..42827e6e33b
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/getopt/Messages.properties
@@ -0,0 +1,49 @@
+# MessagesBundle.properties -- English language messages
+# Copyright (C) 2006 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.
+
+Parser.StdOptions=Standard options
+Parser.PrintHelp=print this help, then exit
+Parser.PrintVersion=print version number, then exit
+Parser.JArgument=pass argument to the Java runtime
+Parser.JName=OPTION
+Parser.ArgReqd=option ''{0}'' requires an argument
+Parser.Unrecognized=unrecognized option ''{0}''
+Parser.NoArg=option ''{0}'' doesn''t allow an argument
+Parser.UnrecDash=unrecognized option ''-{0}''
+Parser.TryHelpShort=Try ''{0} -help'' for more information
+Parser.TryHelpLong=Try ''{0} --help'' for more information
+ClasspathToolParser.VersionFormat={0} (GNU Classpath) {1}\n\nCopyright 2006 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/libjava/classpath/resource/gnu/classpath/tools/jar/messages.properties b/libjava/classpath/resource/gnu/classpath/tools/jar/messages.properties
new file mode 100644
index 00000000000..e589a210ffc
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/jar/messages.properties
@@ -0,0 +1,71 @@
+# messages.properties -- English language messages
+# Copyright (C) 2006 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.
+
+Creator.Ignoring=ignoring entry {0}
+Creator.Adding=adding: {0} (in={1,number,integer}) (out={2,number,integer}) (stored {3,number,integer}%)
+Extractor.Created=\ \ created: {0}
+Extractor.Extracted=\ extracted: {0}
+Extractor.Inflated=\ \ inflated: {0}
+Indexer.Indexing=indexing: {0}
+Main.ArchiveAlreadySet=archive file name already set to {0}
+Main.ModeAlreaySet=operation mode already specified
+Main.MustSpecify=must specify one of -t, -c, -u, -x, or -i
+Main.TwoArgsReqd=-C argument requires both directory and filename
+Main.CantHaveBoth=can't specify both -m and -M
+Main.NoFilesWithi=can't specify file arguments when using -i
+Main.NoMAndi=can't specify -M with -i
+Main.AnotherNomAndi=can't specify -m with -i
+Main.Usage=Usage: jar -ctxui [OPTIONS] jar-file [-C DIR FILE] FILE...
+Main.OpMode=Operation mode
+Main.Create=create a new archive
+Main.Extract=extract from archive
+Main.List=list archive contents
+Main.Update=update archive
+Main.Index=compute archive index
+Main.FileArg=FILE
+Main.OpMods=Operation modifiers
+Main.ArchiveName=specify archive file name
+Main.FileArg2=FILE
+Main.NoZip=store only; no ZIP compression
+Main.Verbose=verbose operation
+Main.NoManifest=do not create a manifest file
+Main.ManifestName=specify manifest file
+Main.ManifestArgName=FILE
+Main.FileNameGroup=File name selection
+Main.ChangeDir=change to directory before the next file
+Main.ChangeDirArg=DIR FILE
+Main.InternalError=jar: internal error:
diff --git a/libjava/classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties b/libjava/classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties
deleted file mode 100644
index 902166d5fdb..00000000000
--- a/libjava/classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties
+++ /dev/null
@@ -1,33 +0,0 @@
-# default locale messages for gnu.classpath.tools.jarsigner package
-
-Main.7=jarsigner:
-Main.9=jarsigner error:
-Main.70=JAR file [{0}] is NOT a file object
-Main.72=JAR file [{0}] is NOT readable
-#Main.85=Option '-keystore' is not defined or is an empty string, and 'user.home' is unknown
-Main.85=Unable to locate a valid key store
-Main.92=Enter key store password:
-Main.6=Designated alias [{0}] MUST be known to the key store in use
-Main.95=Designated alias [{0}] MUST be an Alias of a Key Entry
-Main.97=Enter key password for <{0}>:
-Main.99=Key associated with [{0}] MUST be a private key
-
-JarSigner.1=\ \ signing:
-JarSigner.2=\ updating:
-JarSigner.8=\ \ \ adding:
-JarSigner.11=\ \ \ adding:
-JarSigner.14=jar signed.
-
-JarVerifier.2=jar is not signed.--no signature files found.
-JarVerifier.3=jar verification failed.
-JarVerifier.4=jar partially verified --{0,numer} of {1,number} signers.
-JarVerifier.7=jar verified --{0,number} signer(s).
-JarVerifier.13=Signature Block missing for {0}
-JarVerifier.14=At least one SignerInfo element MUST be present in a Signature Block (.DSA file)
-JarVerifier.16=Missing EncryptedDigest in Signature Block (.DSA file) first SignerInfo element
-
-SFHelper.1=Helper is NOT finished
-SFHelper.4=.SF file has NOT been generated
-SFHelper.6=Unknown or unsupported private key algorithm
-SFHelper.9=Helper is NOT ready
-SFHelper.10=Helper is NOT started
diff --git a/libjava/classpath/resource/gnu/classpath/tools/jarsigner/messages.properties b/libjava/classpath/resource/gnu/classpath/tools/jarsigner/messages.properties
new file mode 100644
index 00000000000..4383256debb
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/jarsigner/messages.properties
@@ -0,0 +1,122 @@
+# messages.properties -- English language messages and message formats
+# Copyright (C) 2006 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.
+#
+# for gnu.classpath.tools.jarsigner package
+#
+
+Main.7=jarsigner:
+Main.9=jarsigner error:
+Main.70=JAR file [{0}] is NOT a file object
+Main.72=JAR file [{0}] is NOT readable
+#Main.85=Option '-keystore' is not defined or is an empty string, and 'user.home' is unknown
+Main.85=Unable to locate a valid key store
+Main.92=Enter key store password:
+Main.6=Designated alias [{0}] MUST be known to the key store in use
+Main.2=\
+Usage: jarsigner [OPTION]... FILE ALIAS\n\
+\ \ \ \ \ \ \ \ jarsigner -verify [OPTION]... FILE\n\
+Java ARchive (JAR) file signing and verification tool.\n\
+\n\
+FILE is the .JAR file to sign or to verify.\n\
+\n\
+ALIAS must be a known Alias of a Key Entry in the designated key store. The \
+private key material associated with this Alias is used for signing FILE. if \
+ALIAS is required, but was omitted, "mykey" will be used instead.
+Main.1=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+Main.0=Signing options
+Main.95=Designated alias [{0}] MUST be an Alias of a Key Entry
+Main.97=Enter key password for <{0}>:
+Main.99=Key associated with [{0}] MUST be a private key
+Main.101=Location of the key store to use. The default value is a file-based \
+scheme whose path is the file named ".keystore" in your home directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+Main.102=URL
+Main.104=Type of the key store to use. If omitted, the default value is that \
+of the property "keystore.type" in the security properties file.
+Main.105=STORE_TYPE
+Main.107=Password to unlock the key store. If omitted, you will be prompted \
+to provide a password.
+Main.108=PASSWORD
+Main.110=Password to unlock the Key Entry associated with ALIAS. If omitted, \
+the tool will use the same password protecting the key store. If this fails, \
+you will be prompted to provide a password.
+Main.111=PASSWORD
+Main.113=A literal to construct file names for both the .SF and .DSA signature \
+files --which will be placed in the META-INF directory of the signed JAR. \
+Permissible characters are in the range [a-zA-Z0-9_-].\n\
+If omitted, the first 8 characters of ALIAS will be used. Characters outside \
+that range will be replaced by underscores.
+Main.114=NAME
+Main.116=Name of the signed JAR file. If omitted, the signed JAR will be \
+named the same as FILE; i.e. the input file will be replaced with its signed \
+copy.
+Main.117=FILE
+Main.118=Verification options
+Main.120=Verify an already signed FILE.
+Main.122=Use with -verbose to see more detailed information about the \
+certificates of ALIAS.
+Main.123=Common options
+Main.125=Output more verbose messages during processing.
+Main.127=Include --otherwise do not-- the .SF file in the .DSA generated file.
+Main.129=Include in the .SF generated file --otherwise do not-- a header \
+containing a hash of the whole manifest file.
+Main.131=Fully qualified class name of a Security Provider to add to the JVM \
+in-use.
+Main.132=PROVIDER_CLASS_NAME
+Main.133=Missing FILE argument.
+
+JarSigner.1=\ \ signing:
+JarSigner.2=\ updating:
+JarSigner.8=\ \ \ adding:
+JarSigner.14=Jar signed.
+
+JarVerifier.2=Jar is not signed --no signature files found.
+JarVerifier.3=Jar verification failed.
+JarVerifier.4=Jar partially verified --{0,numer} of {1,number} signers.
+JarVerifier.7=Jar verified --{0,number} signer(s).
+JarVerifier.13=Signature Block missing for {0}
+JarVerifier.14=At least one SignerInfo element MUST be present in a Signature \
+Block (.DSA file)
+JarVerifier.16=Missing EncryptedDigest in Signature Block (.DSA file) first \
+SignerInfo element
+
+SFHelper.1=Helper is NOT finished
+SFHelper.4=.SF file has NOT been generated
+SFHelper.6=Unknown or unsupported private key algorithm
+SFHelper.9=Helper is NOT ready
+SFHelper.10=Helper is NOT started
diff --git a/libjava/classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties b/libjava/classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties
deleted file mode 100644
index 2dd3ce2fc67..00000000000
--- a/libjava/classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties
+++ /dev/null
@@ -1,95 +0,0 @@
-# default locale messages for gnu.classpath.tools.keytool package
-
-Main.6=keytool:
-Main.8=keytool error:
-
-Command.19=Failed creating new file at {0}
-Command.20=Unable to find a suitable signature algorithm named {0}, although we found a key-pair generation algorithm named {1}
-Command.21=Enter key password for <{0}>:
-Command.23=A correct key password MUST be provided
-Command.24=Enter key store password:
-#Command.36=Option '-keystore' is undefined, or is an empty string, and 'user.home' is unknown
-Command.36=Unable to locate a valid key store
-Command.40=Provider fully qualified class name:
-Command.42=File object [{0}] exists but is NOT a file
-Command.44=File [{0}] exists but is NOT writable
-Command.46=File object [{0}] MUST be an existing readable file
-Command.48=Signature algorithm is missing and private key is of unknown or unsupported type
-Command.51=Validity period MUST be greater than zero
-Command.52=Unable to get signature algorithm name
-Command.60=Unknown or unsupported signature algorithm: {0}
-Command.63=Saving key store at {0}
-Command.66=Owner: {0}
-Command.67=Issuer: {0}
-Command.68=Serial number: {0,number}
-Command.69=Valid from: {0,date,full} - {0,time,full}
-Command.70=\ \ \ \ \ until: {0,date,full} - {0,time,full}
-Command.71=Certificate fingerprints
-Command.72=\ \ \ \ \ \ MD5: {0}
-Command.73=\ \ SHA-160: {0}
-Command.75=Alias [{0}] MUST be knwon to the key store
-Command.77=Alias [{0}] MUST be associated with a Key Entry
-
-CertReqCmd.27=Certification request stored in {0}
-CertReqCmd.28=Submit this to your CA
-
-DeleteCmd.19=Enter the Alias to delete:
-DeleteCmd.20=Alias MUST NOT be null or an empty string
-
-GenKeyCmd.0=\nYou are about to enter information that will be incorporated into\n\
-your certificate request. This information is what is called a\n\
-Distinguished Name or DN. There are quite a few fields but you\n\
-can use supplied default values, displayed between brackets, by just\n\
-hitting <Enter>, or blank the field by entering the <.> character\n\
-before hitting <Enter>.\n\n
-GenKeyCmd.6=The Sample Company
-GenKeyCmd.7=Sydney
-GenKeyCmd.8=NSW
-GenKeyCmd.9=AU
-GenKeyCmd.10=Common Name (hostname, IP, or your name):
-GenKeyCmd.11=Organization Name (company) [{0}]:
-GenKeyCmd.13=Organizational Unit Name (department, division):
-GenKeyCmd.14=Locality Name (city, district) [{0}]:
-GenKeyCmd.16=State or Province Name (full name) [{0}]:
-GenKeyCmd.18=Country Name (2 letter code) [{0}]:
-GenKeyCmd.54=Key size MUST be greater than zero
-
-StorePasswdCmd.19=Too many failed attempts
-StorePasswdCmd.20=Enter new key store password:
-StorePasswdCmd.21=Password MUST be at least 6 characters.
-StorePasswdCmd.22=New password MUST be different than the old one.
-StorePasswdCmd.23=Re-enter new key store password:
-StorePasswdCmd.24=Passwords MUST be the same in both attempts.
-
-KeyPasswdCmd.24=Enter new key password for <{0}>:
-KeyPasswdCmd.28=Re-enter new key password for <{0}>:
-
-KeyCloneCmd.23=Destination Alias MUST NOT exist in key store
-KeyCloneCmd.26=Enter destination alias:
-KeyCloneCmd.27=Destination alias MUST NOT be null nor empty
-KeyCloneCmd.28=Enter new key password for <{0}> [{1}]:
-
-ListCmd.21=Key store type: {0}
-ListCmd.22=Key store provider: {0}
-ListCmd.24=Key store contains {0,number} entry(ies)
-ListCmd.30=Alias name: {0}
-ListCmd.31=Creation timestamp: {0,date,full} - {0,time,full}
-ListCmd.32=Entry type: trusted-certificate
-ListCmd.33=Entry type: key-entry
-ListCmd.34=Alias [{0}] is unknown to the key store
-ListCmd.38=Certificate chain length: {0,number}
-ListCmd.39=Certificate[1]:
-ListCmd.40=Certificate[{0,number}]:
-ListCmd.42=*******************************************
-ListCmd.43=-----BEGIN CERTIFICATE-----
-ListCmd.44=-----END CERTIFICATE-----
-ListCmd.45=Certificate fingerprint (MD5): {0}
-
-ImportCmd.34=Failed to establish chain-of-trust from reply
-ImportCmd.37=Unable to find anchor certificate for {0}
-ImportCmd.38=Public keys, in key store and certificate, MUST be of the same type
-ImportCmd.32=Can this certificate be trusted?
-ImportCmd.40=Key entry associated with {0} has an unknown or unsupported public key type {1}
-ImportCmd.41=Public keys, in key store and certificate, MUST be the same
-ImportCmd.29=Certificate was added to the key store
-ImportCmd.28=Certificate was not added to the key store
diff --git a/libjava/classpath/resource/gnu/classpath/tools/keytool/messages.properties b/libjava/classpath/resource/gnu/classpath/tools/keytool/messages.properties
new file mode 100644
index 00000000000..71b70a76694
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/keytool/messages.properties
@@ -0,0 +1,542 @@
+# messages.properties -- English language messages and message formats
+# Copyright (C) 2006 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.
+#
+# for gnu.classpath.tools.keytool package
+#
+
+Main.6=keytool: {0}
+Main.8=keytool error: {0}
+Main.18=Unrecognized command: {0}
+Main.19=Usage: keytool [COMMAND] [-- COMMAND]...\n\
+Manage private keys and public certificates.
+Main.20=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+Main.21=Available commands
+Main.22=Generate a Key Entry, eventually creating a key store.\n\
+[-alias ALIAS] [-keyalg ALGORITHM] [-keysize KEY_SIZE]\n\
+[-sigalg ALGORITHM] [-dname NAME] [-keypass PASSWORD]\n\
+[-validity DAY_COUNT] [-storetype STORE_TYPE]\n\
+[-keystore URL] [-storepass PASSWORD]\n\
+[-provider PROVIDER_CLASS_NAME] [-v].
+Main.23=Add Key Entries and Trusted Certificates.\n\
+[-alias ALIAS] [-file FILE] [-keypass PASSWORD]\n\
+[-noprompt] [-trustcacerts] [-storetype STORE_TYPE]\n\
+[-keystore URL] [-storepass PASSWORD]\n\
+[-provider PROVIDER_CLASS_NAME] [-v].
+Main.24=Generate a self-signed Trusted Certificate.\n\
+[-alias ALIAS] [-sigalg ALGORITHM] [-dname NAME]\n\
+[-validity DAY_COUNT] [-keypass PASSWORD]\n\
+[-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
+Main.25=NOT IMPLEMENTED YET. Import JDK1.1 Identity Database.\n\
+[-file FILE] [-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
+Main.26=Issue a Certificate Signing Request (CSR).\n\
+[-alias ALIAS] [-sigalg ALGORITHM] [-file FILE]\n\
+[-keypass PASSWORD] [-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v]\n\
+[-attributes].
+Main.27=Export a Certificate from a key store.\n\
+[-alias ALIAS] [-file FILE] [-storetype STORE_TYPE]\n\
+[-keystore URL] [-storepass PASSWORD]\n\
+[-provider PROVIDER_CLASS_NAME] [-rfc] [-v].
+Main.28=Print one or all Certificates in a key store to STDOUT.\n\
+[-alias ALIAS] [-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-rfc] [-v].
+Main.29=Print a human-readable form of a Certificate in a FILE.\n\
+[-file FILE] [-v].
+Main.30=Clone a Key Entry in a key store.\n\
+[-alias ALIAS] [-dest ALIAS] [-keypass PASSWORD]\n\
+[-new PASSWORD] [-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
+Main.31=Change the password protecting a key store.\n\
+[-new PASSWORD] [-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
+Main.32=Change the password protecting a Key Entry in a key store.\n\
+[-alias ALIAS] [-keypass PASSWORD] [-new PASSWORD]\n\
+[-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
+Main.33=Delete a Key Entry or a Trusted Certificate from a key store.\n\
+[-alias ALIAS] [-storetype STORE_TYPE] [-keystore URL]\n\
+[-storepass PASSWORD] [-provider PROVIDER_CLASS_NAME] [-v].
+
+Command.19=Failed creating new file at {0}
+Command.20=Unable to find a suitable signature algorithm named {0}, although we found a key-pair generation algorithm named {1}
+Command.21=Enter key password for <{0}>:
+Command.23=A correct key password MUST be provided
+Command.24=Enter key store password:
+#Command.36=Option '-keystore' is undefined, or is an empty string, and 'user.home' is unknown
+Command.36=Unable to locate a valid key store
+Command.40=Provider fully qualified class name:
+Command.42=File object [{0}] exists but is NOT a file
+Command.44=File [{0}] exists but is NOT writable
+Command.46=File object [{0}] MUST be an existing readable file
+Command.48=Signature algorithm is missing and private key is of unknown or unsupported type
+Command.51=Validity period MUST be greater than zero
+Command.52=Unable to get signature algorithm name
+Command.60=Unknown or unsupported signature algorithm: {0}
+Command.63=Saving key store at {0}
+Command.66=Owner: {0}
+Command.67=Issuer: {0}
+Command.68=Serial number: {0,number}
+Command.69=Valid from: {0,date,full} - {0,time,full}
+Command.70=\ \ \ \ \ until: {0,date,full} - {0,time,full}
+Command.71=Certificate fingerprints
+Command.72=\ \ \ \ \ \ MD5: {0}
+Command.73=\ \ SHA-160: {0}
+Command.75=Alias [{0}] MUST be knwon to the key store
+Command.77=Alias [{0}] MUST be associated with a Key Entry
+
+CertReqCmd.27=Certification request stored in {0}
+CertReqCmd.28=Submit this to your CA
+CertReqCmd.25=Usage: keytool -certreq [OPTION]...\n\
+Generate a PKCS#10 Certificate Signing Request (CSR) and write it to a \
+designated output destination.\n\n\
+IMPORTANT: Some documentation claims that the Attributes field, in the CSR is \
+OPTIONAL while RFC-2986 implies the opposite. This implementation considers \
+this field, by default, as OPTIONAL, unless option -attributes is specified.
+CertReqCmd.24=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+CertReqCmd.23=Command options
+CertReqCmd.22=Alias of an entry in the key store on whose behalf the CSR is \
+generated. The value "mykey" (all lower case, without the enclosing quotes) \
+is used when this option is omitted.
+CertReqCmd.21=ALIAS
+CertReqCmd.20=Name of the digital signature algorithm to use for signing the \
+certificate. If omitted, a default value is chosen based on the type of the \
+private key associated with ALIAS. If the key is a "DSA" one, the value for \
+signature algorithm will be "SHA1withDSA". If on the other hand the key is \
+an "RSA" one, then "MD5withRSA" will be the signature algorithm.
+CertReqCmd.19=ALGORITHM
+CertReqCmd.18=Destination of the generated CSR. STDOUT is used if this \
+option is omitted.
+CertReqCmd.17=FILE
+CertReqCmd.16=Password to unlock the Key Entry associated with ALIAS. If \
+omitted, the tool will attempt to unlock the Key Entry using the same password \
+protecting the key store. If this fails, you will be prompted for a password.
+CertReqCmd.14=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+CertReqCmd.13=STORE_TYPE
+CertReqCmd.12=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+CertReqCmd.11=URL
+CertReqCmd.10=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+CertReqCmd.9=PASSWORD
+CertReqCmd.8=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+CertReqCmd.7=PROVIDER_CLASS_NAME
+CertReqCmd.6=Emit more verbose messages.
+CertReqCmd.5=Force the tool to encode a NULL DER value in the CSR as the value \
+of the Attributes field.
+
+DeleteCmd.19=Enter the Alias to delete:
+DeleteCmd.18=Usage: keytool -delete [OPTION]...\n\
+Delete a designated key store entry.
+DeleteCmd.17=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+DeleteCmd.16=Command options
+DeleteCmd.15=Alias of an entry to delete. The value "mykey" (all lower case, \
+without the enclosing quotes) is used when this option is omitted.
+DeleteCmd.14=ALIAS
+DeleteCmd.13=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+DeleteCmd.12=STORE_TYPE
+DeleteCmd.11=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+DeleteCmd.10=URL
+DeleteCmd.20=Alias MUST NOT be null or an empty string
+DeleteCmd.9=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+DeleteCmd.8=PASSWORD
+DeleteCmd.7=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+DeleteCmd.6=PROVIDER_CLASS_NAME
+DeleteCmd.5=Emit more verbose messages.
+
+GenKeyCmd.0=\nYou are about to enter information that will be incorporated into\n\
+your certificate request. This information is what is called a\n\
+Distinguished Name or DN. There are quite a few fields but you\n\
+can use supplied default values, displayed between brackets, by just\n\
+hitting <Enter>, or blank the field by entering the <.> character\n\
+before hitting <Enter>.\n\n
+GenKeyCmd.6=The Sample Company
+GenKeyCmd.7=Sydney
+GenKeyCmd.8=NSW
+GenKeyCmd.9=AU
+GenKeyCmd.10=Common Name (hostname, IP, or your name):
+GenKeyCmd.11=Organization Name (company) [{0}]:
+GenKeyCmd.13=Organizational Unit Name (department, division):
+GenKeyCmd.14=Locality Name (city, district) [{0}]:
+GenKeyCmd.16=State or Province Name (full name) [{0}]:
+GenKeyCmd.18=Country Name (2 letter code) [{0}]:
+GenKeyCmd.54=Key size MUST be greater than zero
+GenKeyCmd.57=Usage: keytool -genkey [OPTION]...\n\
+Generate a new key-pair and save these credentials in the key store as a Key \
+Entry, associated with a designated Alias.
+GenKeyCmd.58=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+GenKeyCmd.59=Command options
+GenKeyCmd.60=Alias of the Key Entry to generate. The value "mykey" (all lower \
+case, without the enclosing quotes) is used when this option is omitted.
+GenKeyCmd.61=ALIAS
+GenKeyCmd.62=Name of the key-pair generation algorithm. The default value is \
+"DSS" (a synonym for the Digital Signature Algorithm also known as DSA).
+GenKeyCmd.63=ALGORITHM
+GenKeyCmd.64=Number of bits of the shared modulus, for both the public and \
+private keys, to use for the new keys. If omitted, 1024 is used.
+GenKeyCmd.65=SIZE
+GenKeyCmd.66=Name of the digital signature algorithm to use for signing the \
+certificate. If omitted, a default value is chosen based on the type of the \
+private key associated with ALIAS. If the key is a "DSA" one, the value for \
+signature algorithm will be "SHA1withDSA". If on the other hand the key is \
+an "RSA" one, then "MD5withRSA" will be the signature algorithm.
+GenKeyCmd.68=The X.500 Distinguished Name of the Subject of the generated \
+certificate. If omitted you will be prompted for one.
+GenKeyCmd.69=NAME
+GenKeyCmd.70=Password to protect the newly created Key Entry. If omitted, \
+you will be prompted to provide a password.
+GenKeyCmd.71=PASSWORD
+GenKeyCmd.72=Number of days the generated certificate is valid for. If \
+omitted, 90 is used.
+GenKeyCmd.73=DAY_COUNT
+GenKeyCmd.74=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+GenKeyCmd.75=STORE_TYPE
+GenKeyCmd.76=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+GenKeyCmd.77=URL
+GenKeyCmd.78=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+GenKeyCmd.80=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+GenKeyCmd.81=PROVIDER_CLASS_NAME
+GenKeyCmd.82=Emit more verbose messages.
+
+StorePasswdCmd.19=Too many failed attempts
+StorePasswdCmd.18=Usage: keytool -storepasswd [OPTION]...\n\
+Change the password protecting a key store.
+StorePasswdCmd.17=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+StorePasswdCmd.16=Command options
+StorePasswdCmd.15=The new, and different, password to protect the key store. \
+If omitted, you will be prompted for one.
+StorePasswdCmd.13=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+StorePasswdCmd.12=STORE_TYPE
+StorePasswdCmd.11=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+StorePasswdCmd.10=URL
+StorePasswdCmd.20=Enter new key store password:
+StorePasswdCmd.21=Password MUST be at least 6 characters.
+StorePasswdCmd.22=New password MUST be different than the old one.
+StorePasswdCmd.23=Re-enter new key store password:
+StorePasswdCmd.24=Passwords MUST be the same in both attempts.
+StorePasswdCmd.9=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+StorePasswdCmd.8=PASSWORD
+StorePasswdCmd.7=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+StorePasswdCmd.6=PROVIDER_CLASS_NAME
+StorePasswdCmd.5=Emit more verbose messages.
+
+KeyPasswdCmd.24=Enter new key password for <{0}>:
+KeyPasswdCmd.28=Re-enter new key password for <{0}>:
+KeyPasswdCmd.23=Usage: keytool -keypasswd [OPTION]...\n\
+Change the password protecting a Key Entry.
+KeyPasswdCmd.22=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+KeyPasswdCmd.21=Command options
+KeyPasswdCmd.20=The Alias which password is to be changed.
+KeyPasswdCmd.19=ALIAS
+KeyPasswdCmd.18=Password to unlock ALIAS. If omitted, the tool will attempt \
+to unlock the Key Entry using the same password protecting the key store. If \
+this fails, you will be prompted for a password.
+KeyPasswdCmd.16=The new, and different, password to protect ALIAS.
+KeyPasswdCmd.14=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+KeyPasswdCmd.13=STORE_TYPE
+KeyPasswdCmd.12=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+KeyPasswdCmd.11=URL
+KeyPasswdCmd.10=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+KeyPasswdCmd.9=PASSWORD
+KeyPasswdCmd.8=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+KeyPasswdCmd.7=PROVIDER_CLASS_NAME
+KeyPasswdCmd.6=Emit more verbose messages.
+
+KeyCloneCmd.23=Destination Alias MUST NOT exist in key store
+KeyCloneCmd.26=Enter destination alias:
+KeyCloneCmd.27=Destination alias MUST NOT be null nor empty
+KeyCloneCmd.28=Enter new key password for <{0}> [{1}]:
+KeyCloneCmd.22=Usage: keytool -keyclone [OPTION]...\n\
+Clone an existing Key Entry and store it under a new (different) Alias \
+protecting its private key material with possibly a new password.
+KeyCloneCmd.21=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+KeyCloneCmd.20=Command options
+KeyCloneCmd.19=Alias of an entry to clone. The value "mykey" (all lower case, \
+without the enclosing quotes) is used when this option is omitted.
+KeyCloneCmd.17=Alias to identify the cloned copy of the Key Entry.
+KeyCloneCmd.16=ALIAS
+KeyCloneCmd.15=Password to unlock the Key Entry associated with the Alias to \
+clone. If omitted, the tool will attempt to unlock the Key Entry using the \
+same password protecting the key store. If this fails, you will be prompted \
+for a password.
+KeyCloneCmd.13=Password to protect the cloned copy of the Key Entry. If \
+omitted, you will be prompted to provide one.
+KeyCloneCmd.11=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+KeyCloneCmd.10=STORE_TYPE
+KeyCloneCmd.9=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+KeyCloneCmd.8=URL
+KeyCloneCmd.7=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+KeyCloneCmd.6=PASSWORD
+KeyCloneCmd.5=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+KeyCloneCmd.4=PROVIDER_CLASS_NAME
+KeyCloneCmd.3=Emit more verbose messages.
+
+ListCmd.21=Key store type: {0}
+ListCmd.22=Key store provider: {0}
+ListCmd.24=Key store contains {0,number} entry(ies)
+ListCmd.20=Usage: keytool -list [OPTION]...\n\
+Print one or all of the key store entries to STDOUT. Usually this command \
+will only print a fingerprint of the certificate, unless either -rfc or -v \
+is specified.
+ListCmd.30=Alias name: {0}
+ListCmd.31=Creation timestamp: {0,date,full} - {0,time,full}
+ListCmd.32=Entry type: trusted-certificate
+ListCmd.33=Entry type: key-entry
+ListCmd.34=Alias [{0}] is unknown to the key store
+ListCmd.38=Certificate chain length: {0,number}
+ListCmd.39=Certificate[1]:
+ListCmd.40=Certificate[{0,number}]:
+ListCmd.42=*******************************************
+ListCmd.43=-----BEGIN CERTIFICATE-----
+ListCmd.44=-----END CERTIFICATE-----
+ListCmd.45=Certificate fingerprint (MD5): {0}
+ListCmd.19=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+ListCmd.18=Command options
+ListCmd.17=Alias of an entry to list. If omitted, all entries are listed.
+ListCmd.16=ALIAS
+ListCmd.15=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+ListCmd.14=STORE_TYPE
+ListCmd.13=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+ListCmd.12=URL
+ListCmd.11=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+ListCmd.10=PASSWORD
+ListCmd.9=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+ListCmd.8=PROVIDER_CLASS_NAME
+ListCmd.7=Output the certificate in human-readable format, even if -rfc is \
+also specified.
+ListCmd.6=Use RFC-1421 specifications when encoding the output.
+
+ImportCmd.34=Failed to establish chain-of-trust from reply
+ImportCmd.37=Unable to find anchor certificate for {0}
+ImportCmd.38=Public keys, in key store and certificate, MUST be of the same type
+ImportCmd.32=Can this certificate be trusted?
+ImportCmd.40=Key entry associated with {0} has an unknown or unsupported public key type {1}
+ImportCmd.41=Public keys, in key store and certificate, MUST be the same
+ImportCmd.29=Certificate was added to the key store
+ImportCmd.28=Certificate was not added to the key store
+ImportCmd.27=Usage: keytool -import [OPTION]...\n\
+Read an X.509 certificate, or a PKCS#7 Certificate Reply from a designated \
+input source and incorporate the certificates into the key store.
+ImportCmd.26=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+ImportCmd.25=Command options
+ImportCmd.24=If ALIAS does not already exist in the key store, the tool treats \
+the certificate in FILE as a new Trusted Certificate.\n\
+If ALIAS exists in the key store, the tool will treat the certificate(s) in \
+FILE as a Certificate Reply (which can be a chain of certificates).
+ImportCmd.23=ALIAS
+ImportCmd.22=Location of the Certificate or Certificate Reply to import.
+ImportCmd.21=FILE
+ImportCmd.20=Password to protect the Key Entry associated with ALIAS. If \
+this option is omitted, and the chain-of-trust for the Certificate Reply has \
+been established, the tool will first attempt to unlock the Key Entry using \
+the same password protecting the key store. If this fails, you will be \
+prompted to provide a password.
+ImportCmd.19=PASSWORD
+ImportCmd.18=Prevent the tool from prompting the user.
+ImportCmd.17=Additionally use a key store, of type "JKS", named "cacerts", \
+and located in lib/security in an installed Java Runtime Environment, when \
+trying to establish chains-of-trust.
+ImportCmd.16=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+ImportCmd.15=STORE_TYPE
+ImportCmd.14=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+ImportCmd.13=URL
+ImportCmd.12=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+ImportCmd.11=PASSWORD
+ImportCmd.10=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+ImportCmd.9=PROVIDER_CLASS_NAME
+ImportCmd.8=Emit more verbose messages.
+ImportCmd.7=Was unable to build a certificate-chain. Only {0,number} out of {1,number} certificates were processed
+
+ExportCmd.17=Usage: keytool -export [OPTION]...\n\
+Export a certificate stored in the key store to a designated output \
+destination, either in binary format or in RFC-1421 compliant encoding.
+ExportCmd.18=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+ExportCmd.19=Command options
+ExportCmd.20=Alias of an entry to export. The value "mykey" (all lower case, \
+without the enclosing quotes) is used when this option is omitted.
+ExportCmd.21=ALIAS
+ExportCmd.22=Destination of the exported certificate. STDOUT is used if this \
+option is omitted.
+ExportCmd.23=FILE
+ExportCmd.24=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+ExportCmd.25=STORE_TYPE
+ExportCmd.26=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+ExportCmd.27=URL
+ExportCmd.28=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+ExportCmd.29=PASSWORD
+ExportCmd.30=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+ExportCmd.31=PROVIDER_CLASS_NAME
+ExportCmd.32=Use RFC-1421 specifications when encoding the output.
+ExportCmd.33=Output the certificate in binary DER encoding, which is the \
+default format. If -rfc is also present, this option is ignored.
+
+IdentityDBCmd.7=Usage: keytool -identitydb [OPTION]...\n\
+NOT IMPLEMENTED YET. Import a JDK 1.1 style Identity Database.
+IdentityDBCmd.8=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+IdentityDBCmd.9=Command options
+IdentityDBCmd.10=Location of the Identity Database to import. If omitted, \
+STDIN is used.
+IdentityDBCmd.11=FILE
+IdentityDBCmd.12=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+IdentityDBCmd.13=STORE_TYPE
+IdentityDBCmd.14=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+IdentityDBCmd.15=URL
+IdentityDBCmd.16=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+IdentityDBCmd.17=PASSWORD
+IdentityDBCmd.18=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+IdentityDBCmd.19=PROVIDER_CLASS_NAME
+IdentityDBCmd.20=Emit more verbose messages.
+
+PrintCertCmd.5=Usage: keytool -printcert [OPTION]...\n\
+Read a certificate from FILE and print it to STDOUT in a human-readable form.
+PrintCertCmd.6=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+PrintCertCmd.7=Command options
+PrintCertCmd.8=Location of the certificate to print. If omitted, STDIN is used.
+PrintCertCmd.9=FILE
+PrintCertCmd.10=Emit more verbose messages.
+
+SelfCertCmd.14=Usage: keytool -selfcert [OPTION]...\n\
+Generate a self-signed X.509 version 1 certificate.\n\n\
+The newly generated certificate will form a chain of one element which will \
+replace the previous chain associated with ALIAS.
+SelfCertCmd.15=Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+SelfCertCmd.16=Command options
+SelfCertCmd.17=Alias of the Key Entry to select. The value "mykey" (all lower \
+case, without the enclosing quotes) is used when this option is omitted.
+SelfCertCmd.18=ALIAS
+SelfCertCmd.19=Name of the digital signature algorithm to use for signing the \
+certificate. If omitted, a default value is chosen based on the type of the \
+private key associated with ALIAS. If the key is a "DSA" one, the value for \
+signature algorithm will be "SHA1withDSA". If on the other hand the key is \
+an "RSA" one, then "MD5withRSA" will be the signature algorithm.
+SelfCertCmd.20=ALGORITHM
+SelfCertCmd.21=The X.500 Distinguished Name of the Subject of the generated \
+certificate. If omitted the Distinguished Name of the base certificate in \
+the chain associated with ALIAS is used instead.
+SelfCertCmd.22=NAME
+SelfCertCmd.23=Password to unlock the Key Entry associated with ALIAS. If \
+omitted, the tool will attempt to unlock the Key Entry using the same password \
+protecting the key store. If this fails, you will be prompted for a password.
+SelfCertCmd.24=PASSWORD
+SelfCertCmd.25=Number of days the generated certificate is valid for. If \
+omitted, 90 is used.
+SelfCertCmd.26=DAY_COUNT
+SelfCertCmd.27=Type of the key store to use. If omitted, the default value is \
+that of the property "keystore.type" in the security properties file.
+SelfCertCmd.28=STORE_TYPE
+SelfCertCmd.29=Location of the key store to use. The default value is a \
+file-based scheme whose path is the file named ".keystore" in your home \
+directory.\n\
+If URL is malformed, the tool will use URL as a file-name of a key store; \
+i.e. as if the protocol was "file:".
+SelfCertCmd.30=URL
+SelfCertCmd.31=Password to unlock the key store. If omitted, you will be \
+prompted for one.
+SelfCertCmd.32=PASSWORD
+SelfCertCmd.33=Fully qualified class name of a Security Provider to add to the \
+JVM in-use.
+SelfCertCmd.34=PROVIDER_CLASS_NAME
+SelfCertCmd.35=Emit more verbose messages.
diff --git a/libjava/classpath/resource/gnu/classpath/tools/native2ascii/messages.properties b/libjava/classpath/resource/gnu/classpath/tools/native2ascii/messages.properties
new file mode 100644
index 00000000000..ab860c8d292
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/native2ascii/messages.properties
@@ -0,0 +1,43 @@
+# messages.properties -- English language messages
+# Copyright (C) 2006 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.
+
+Native2ASCII.TooManyFiles=too many files specified
+Native2ASCII.Usage=Usage: native2ascii [OPTIONS]... [INPUTFILE [OUTPUTFILE]]
+Native2ASCII.EncodingHelp=encoding to use
+Native2ASCII.EncodingArgName=NAME
+Native2ASCII.EncodingSpecified=encoding already specified
+Native2ASCII.ReversedHelp=convert from encoding to native
diff --git a/libjava/classpath/resource/gnu/classpath/tools/serialver/messages.properties b/libjava/classpath/resource/gnu/classpath/tools/serialver/messages.properties
new file mode 100644
index 00000000000..8900795d4fb
--- /dev/null
+++ b/libjava/classpath/resource/gnu/classpath/tools/serialver/messages.properties
@@ -0,0 +1,44 @@
+# messages.properties -- English language messages
+# Copyright (C) 2006 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.
+
+SerialVer.NoClassesSpecd=no classes specified
+SerialVer.HelpHeader=serialver [OPTIONS]... CLASS...\n\nPrint the serialVersionUID of the specified classes
+SerialVer.5=classpath
+SerialVer.ClasspathHelp=class path to use to find classes
+SerialVer.ClassNotSerial=serialver: class {0} is not serializable
+SerialVer.ClassNotFound=serialver: class {0} not found
+SerialVer.DupClasspath=classpath already specified
diff --git a/libjava/classpath/tools/Makefile.am b/libjava/classpath/tools/Makefile.am
index 201939832f0..87ee030cd03 100755
--- a/libjava/classpath/tools/Makefile.am
+++ b/libjava/classpath/tools/Makefile.am
@@ -23,7 +23,7 @@ endif
if CREATE_WRAPPERS
bin_SCRIPTS =
-bin_PROGRAMS = appletviewer jarsigner keytool
+bin_PROGRAMS = gappletviewer gjarsigner gkeytool
if FOUND_GCJ
LIBJVM = -lgcj
@@ -35,26 +35,40 @@ LIBJVM =
endif
endif
-appletviewer_SOURCES = toolwrapper.c
-appletviewer_CFLAGS = -Wall \
- -DDATA_DIR="\"$(datadir)\"" \
- -DPACKAGE="\"$(PACKAGE)\"" \
- -DTOOLNAME="\"appletviewer\""
-appletviewer_LDFLAGS = -L$(libdir) $(LIBJVM)
-
-jarsigner_SOURCES = toolwrapper.c
-jarsigner_CFLAGS = -Wall \
- -DDATA_DIR="\"$(datadir)\"" \
- -DPACKAGE="\"$(PACKAGE)\"" \
- -DTOOLNAME="\"jarsigner\""
-jarsigner_LDFLAGS = -L$(libdir) $(LIBJVM)
-
-keytool_SOURCES = toolwrapper.c
-keytool_CFLAGS = -Wall \
- -DDATA_DIR="\"$(datadir)\"" \
- -DPACKAGE="\"$(PACKAGE)\"" \
- -DTOOLNAME="\"keytool\""
-keytool_LDFLAGS = -L$(libdir) $(LIBJVM)
+# Some architecture independent data to be installed.
+TOOLS_DATA = $(TOOLS_ZIP)
+
+# Where we want these data files installed.
+## GCJ LOCAL: install libgcj-tools.jar alongside libgcj.jar.
+TOOLSdir = $(datadir)/java
+
+# The zip files with classes we want to produce.
+## GCJ LOCAL: rename tools.zip libgcj-tools-$(gcc_version).jar
+TOOLS_ZIP = libgcj-tools-$(gcc_version).jar
+
+## GCJ LOCAL: calculate GCC version
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+
+gappletviewer_SOURCES = toolwrapper.c
+gappletviewer_CFLAGS = -Wall \
+ -DTOOLS_ZIP="\"$(TOOLSdir)/$(TOOLS_ZIP)\"" \
+ -DTOOLPACKAGE="\"appletviewer\"" \
+ -DTOOLNAME="\"gappletviewer\""
+gappletviewer_LDFLAGS = -L$(libdir) $(LIBJVM)
+
+gjarsigner_SOURCES = toolwrapper.c
+gjarsigner_CFLAGS = -Wall \
+ -DTOOLS_ZIP="\"$(TOOLSdir)/$(TOOLS_ZIP)\"" \
+ -DTOOLPACKAGE="\"jarsigner\"" \
+ -DTOOLNAME="\"gjarsigner\""
+gjarsigner_LDFLAGS = -L$(libdir) $(LIBJVM)
+
+gkeytool_SOURCES = toolwrapper.c
+gkeytool_CFLAGS = -Wall \
+ -DTOOLS_ZIP="\"$(TOOLSdir)/$(TOOLS_ZIP)\"" \
+ -DTOOLPACKAGE="\"keytool\"" \
+ -DTOOLNAME="\"gkeytool\""
+gkeytool_LDFLAGS = -L$(libdir) $(LIBJVM)
else
bin_SCRIPTS = appletviewer jarsigner keytool
@@ -65,10 +79,6 @@ EXTRA_DIST = toolwrapper.c appletviewer.in jarsigner.in keytool.in
# All our example java source files
TOOLS_JAVA_FILES = $(srcdir)/gnu/classpath/tools/*.java $(srcdir)/gnu/classpath/tools/*/*.java $(srcdir)/gnu/classpath/tools/*/*/*.java
-
-# The zip files with classes we want to produce.
-TOOLS_ZIP = tools.zip
-
# Extra objects that will not exist until configure-time
BUILT_SOURCES = $(TOOLS_ZIP)
@@ -88,13 +98,7 @@ TOOLS_HELPS = $(GIOP_HELPS) $(RMI_HELPS)
READMES = $(srcdir)/gnu/classpath/tools/giop/README
# All the files we find "interesting"
-ALL_TOOLS_FILES = $(TOOLS_JAVA_FILES) $(TOOLS_TEMPLATES) $(TOOLS_HELPS) $(READMES)
-
-# Some architecture independent data to be installed.
-TOOLS_DATA = $(TOOLS_ZIP) README
-
-# Where we want these data files installed.
-TOOLSdir = $(pkgdatadir)
+ALL_TOOLS_FILES = $(TOOLS_JAVA_FILES) $(TOOLS_TEMPLATES) $(TOOLS_HELPS)
# Make sure everything is included in the distribution.
dist-hook:
@@ -126,8 +130,7 @@ $(TOOLS_ZIP): $(TOOLS_JAVA_FILES)
cp $(GIOP_HELPS) classes/gnu/classpath/tools/giop/
$(JCOMPILER) -d classes $(TOOLS_JAVA_FILES)
(cd classes; \
- if test "$(ZIP)" != ""; then $(ZIP) -r ../$(TOOLS_ZIP) .; fi; \
- if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(TOOLS_ZIP) .; fi; \
+ $(FASTJAR) cf ../$(TOOLS_ZIP) .; \
cd ..)
rm -rf classes
diff --git a/libjava/classpath/tools/Makefile.in b/libjava/classpath/tools/Makefile.in
index d43c1b5ce33..6a356374449 100644
--- a/libjava/classpath/tools/Makefile.in
+++ b/libjava/classpath/tools/Makefile.in
@@ -39,8 +39,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@CREATE_WRAPPERS_TRUE@bin_PROGRAMS = appletviewer$(EXEEXT) \
-@CREATE_WRAPPERS_TRUE@ jarsigner$(EXEEXT) keytool$(EXEEXT)
+@CREATE_WRAPPERS_TRUE@bin_PROGRAMS = gappletviewer$(EXEEXT) \
+@CREATE_WRAPPERS_TRUE@ gjarsigner$(EXEEXT) gkeytool$(EXEEXT)
subdir = tools
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/appletviewer.in $(srcdir)/jarsigner.in \
@@ -62,21 +62,21 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(TOOLSdir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
-am__appletviewer_SOURCES_DIST = toolwrapper.c
-@CREATE_WRAPPERS_TRUE@am_appletviewer_OBJECTS = \
-@CREATE_WRAPPERS_TRUE@ appletviewer-toolwrapper.$(OBJEXT)
-appletviewer_OBJECTS = $(am_appletviewer_OBJECTS)
-appletviewer_LDADD = $(LDADD)
-am__jarsigner_SOURCES_DIST = toolwrapper.c
-@CREATE_WRAPPERS_TRUE@am_jarsigner_OBJECTS = \
-@CREATE_WRAPPERS_TRUE@ jarsigner-toolwrapper.$(OBJEXT)
-jarsigner_OBJECTS = $(am_jarsigner_OBJECTS)
-jarsigner_LDADD = $(LDADD)
-am__keytool_SOURCES_DIST = toolwrapper.c
-@CREATE_WRAPPERS_TRUE@am_keytool_OBJECTS = \
-@CREATE_WRAPPERS_TRUE@ keytool-toolwrapper.$(OBJEXT)
-keytool_OBJECTS = $(am_keytool_OBJECTS)
-keytool_LDADD = $(LDADD)
+am__gappletviewer_SOURCES_DIST = toolwrapper.c
+@CREATE_WRAPPERS_TRUE@am_gappletviewer_OBJECTS = \
+@CREATE_WRAPPERS_TRUE@ gappletviewer-toolwrapper.$(OBJEXT)
+gappletviewer_OBJECTS = $(am_gappletviewer_OBJECTS)
+gappletviewer_LDADD = $(LDADD)
+am__gjarsigner_SOURCES_DIST = toolwrapper.c
+@CREATE_WRAPPERS_TRUE@am_gjarsigner_OBJECTS = \
+@CREATE_WRAPPERS_TRUE@ gjarsigner-toolwrapper.$(OBJEXT)
+gjarsigner_OBJECTS = $(am_gjarsigner_OBJECTS)
+gjarsigner_LDADD = $(LDADD)
+am__gkeytool_SOURCES_DIST = toolwrapper.c
+@CREATE_WRAPPERS_TRUE@am_gkeytool_OBJECTS = \
+@CREATE_WRAPPERS_TRUE@ gkeytool-toolwrapper.$(OBJEXT)
+gkeytool_OBJECTS = $(am_gkeytool_OBJECTS)
+gkeytool_LDADD = $(LDADD)
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
@@ -90,10 +90,10 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(appletviewer_SOURCES) $(jarsigner_SOURCES) \
- $(keytool_SOURCES)
-DIST_SOURCES = $(am__appletviewer_SOURCES_DIST) \
- $(am__jarsigner_SOURCES_DIST) $(am__keytool_SOURCES_DIST)
+SOURCES = $(gappletviewer_SOURCES) $(gjarsigner_SOURCES) \
+ $(gkeytool_SOURCES)
+DIST_SOURCES = $(am__gappletviewer_SOURCES_DIST) \
+ $(am__gjarsigner_SOURCES_DIST) $(am__gkeytool_SOURCES_DIST)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -331,35 +331,42 @@ GLIBJ_CLASSPATH = '$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip'
@CREATE_WRAPPERS_TRUE@@FOUND_CACAO_FALSE@@FOUND_GCJ_FALSE@LIBJVM =
@CREATE_WRAPPERS_TRUE@@FOUND_CACAO_TRUE@@FOUND_GCJ_FALSE@LIBJVM = -ljvm
@CREATE_WRAPPERS_TRUE@@FOUND_GCJ_TRUE@LIBJVM = -lgcj
-@CREATE_WRAPPERS_TRUE@appletviewer_SOURCES = toolwrapper.c
-@CREATE_WRAPPERS_TRUE@appletviewer_CFLAGS = -Wall \
-@CREATE_WRAPPERS_TRUE@ -DDATA_DIR="\"$(datadir)\"" \
-@CREATE_WRAPPERS_TRUE@ -DPACKAGE="\"$(PACKAGE)\"" \
-@CREATE_WRAPPERS_TRUE@ -DTOOLNAME="\"appletviewer\""
-
-@CREATE_WRAPPERS_TRUE@appletviewer_LDFLAGS = -L$(libdir) $(LIBJVM)
-@CREATE_WRAPPERS_TRUE@jarsigner_SOURCES = toolwrapper.c
-@CREATE_WRAPPERS_TRUE@jarsigner_CFLAGS = -Wall \
-@CREATE_WRAPPERS_TRUE@ -DDATA_DIR="\"$(datadir)\"" \
-@CREATE_WRAPPERS_TRUE@ -DPACKAGE="\"$(PACKAGE)\"" \
-@CREATE_WRAPPERS_TRUE@ -DTOOLNAME="\"jarsigner\""
-
-@CREATE_WRAPPERS_TRUE@jarsigner_LDFLAGS = -L$(libdir) $(LIBJVM)
-@CREATE_WRAPPERS_TRUE@keytool_SOURCES = toolwrapper.c
-@CREATE_WRAPPERS_TRUE@keytool_CFLAGS = -Wall \
-@CREATE_WRAPPERS_TRUE@ -DDATA_DIR="\"$(datadir)\"" \
-@CREATE_WRAPPERS_TRUE@ -DPACKAGE="\"$(PACKAGE)\"" \
-@CREATE_WRAPPERS_TRUE@ -DTOOLNAME="\"keytool\""
-
-@CREATE_WRAPPERS_TRUE@keytool_LDFLAGS = -L$(libdir) $(LIBJVM)
+
+# Some architecture independent data to be installed.
+@CREATE_WRAPPERS_TRUE@TOOLS_DATA = $(TOOLS_ZIP)
+
+# Where we want these data files installed.
+@CREATE_WRAPPERS_TRUE@TOOLSdir = $(datadir)/java
+
+# The zip files with classes we want to produce.
+@CREATE_WRAPPERS_TRUE@TOOLS_ZIP = libgcj-tools-$(gcc_version).jar
+@CREATE_WRAPPERS_TRUE@gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+@CREATE_WRAPPERS_TRUE@gappletviewer_SOURCES = toolwrapper.c
+@CREATE_WRAPPERS_TRUE@gappletviewer_CFLAGS = -Wall \
+@CREATE_WRAPPERS_TRUE@ -DTOOLS_ZIP="\"$(TOOLSdir)/$(TOOLS_ZIP)\"" \
+@CREATE_WRAPPERS_TRUE@ -DTOOLPACKAGE="\"appletviewer\"" \
+@CREATE_WRAPPERS_TRUE@ -DTOOLNAME="\"gappletviewer\""
+
+@CREATE_WRAPPERS_TRUE@gappletviewer_LDFLAGS = -L$(libdir) $(LIBJVM)
+@CREATE_WRAPPERS_TRUE@gjarsigner_SOURCES = toolwrapper.c
+@CREATE_WRAPPERS_TRUE@gjarsigner_CFLAGS = -Wall \
+@CREATE_WRAPPERS_TRUE@ -DTOOLS_ZIP="\"$(TOOLSdir)/$(TOOLS_ZIP)\"" \
+@CREATE_WRAPPERS_TRUE@ -DTOOLPACKAGE="\"jarsigner\"" \
+@CREATE_WRAPPERS_TRUE@ -DTOOLNAME="\"gjarsigner\""
+
+@CREATE_WRAPPERS_TRUE@gjarsigner_LDFLAGS = -L$(libdir) $(LIBJVM)
+@CREATE_WRAPPERS_TRUE@gkeytool_SOURCES = toolwrapper.c
+@CREATE_WRAPPERS_TRUE@gkeytool_CFLAGS = -Wall \
+@CREATE_WRAPPERS_TRUE@ -DTOOLS_ZIP="\"$(TOOLSdir)/$(TOOLS_ZIP)\"" \
+@CREATE_WRAPPERS_TRUE@ -DTOOLPACKAGE="\"keytool\"" \
+@CREATE_WRAPPERS_TRUE@ -DTOOLNAME="\"gkeytool\""
+
+@CREATE_WRAPPERS_TRUE@gkeytool_LDFLAGS = -L$(libdir) $(LIBJVM)
EXTRA_DIST = toolwrapper.c appletviewer.in jarsigner.in keytool.in
# All our example java source files
TOOLS_JAVA_FILES = $(srcdir)/gnu/classpath/tools/*.java $(srcdir)/gnu/classpath/tools/*/*.java $(srcdir)/gnu/classpath/tools/*/*/*.java
-# The zip files with classes we want to produce.
-TOOLS_ZIP = tools.zip
-
# Extra objects that will not exist until configure-time
BUILT_SOURCES = $(TOOLS_ZIP)
@@ -377,13 +384,7 @@ TOOLS_HELPS = $(GIOP_HELPS) $(RMI_HELPS)
READMES = $(srcdir)/gnu/classpath/tools/giop/README
# All the files we find "interesting"
-ALL_TOOLS_FILES = $(TOOLS_JAVA_FILES) $(TOOLS_TEMPLATES) $(TOOLS_HELPS) $(READMES)
-
-# Some architecture independent data to be installed.
-TOOLS_DATA = $(TOOLS_ZIP) README
-
-# Where we want these data files installed.
-TOOLSdir = $(pkgdatadir)
+ALL_TOOLS_FILES = $(TOOLS_JAVA_FILES) $(TOOLS_TEMPLATES) $(TOOLS_HELPS)
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -468,15 +469,15 @@ installcheck-binPROGRAMS: $(bin_PROGRAMS)
else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
done; \
done; rm -f c$${pid}_.???; exit $$bad
-appletviewer$(EXEEXT): $(appletviewer_OBJECTS) $(appletviewer_DEPENDENCIES)
- @rm -f appletviewer$(EXEEXT)
- $(LINK) $(appletviewer_LDFLAGS) $(appletviewer_OBJECTS) $(appletviewer_LDADD) $(LIBS)
-jarsigner$(EXEEXT): $(jarsigner_OBJECTS) $(jarsigner_DEPENDENCIES)
- @rm -f jarsigner$(EXEEXT)
- $(LINK) $(jarsigner_LDFLAGS) $(jarsigner_OBJECTS) $(jarsigner_LDADD) $(LIBS)
-keytool$(EXEEXT): $(keytool_OBJECTS) $(keytool_DEPENDENCIES)
- @rm -f keytool$(EXEEXT)
- $(LINK) $(keytool_LDFLAGS) $(keytool_OBJECTS) $(keytool_LDADD) $(LIBS)
+gappletviewer$(EXEEXT): $(gappletviewer_OBJECTS) $(gappletviewer_DEPENDENCIES)
+ @rm -f gappletviewer$(EXEEXT)
+ $(LINK) $(gappletviewer_LDFLAGS) $(gappletviewer_OBJECTS) $(gappletviewer_LDADD) $(LIBS)
+gjarsigner$(EXEEXT): $(gjarsigner_OBJECTS) $(gjarsigner_DEPENDENCIES)
+ @rm -f gjarsigner$(EXEEXT)
+ $(LINK) $(gjarsigner_LDFLAGS) $(gjarsigner_OBJECTS) $(gjarsigner_LDADD) $(LIBS)
+gkeytool$(EXEEXT): $(gkeytool_OBJECTS) $(gkeytool_DEPENDENCIES)
+ @rm -f gkeytool$(EXEEXT)
+ $(LINK) $(gkeytool_LDFLAGS) $(gkeytool_OBJECTS) $(gkeytool_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@@ -503,9 +504,9 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/appletviewer-toolwrapper.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jarsigner-toolwrapper.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keytool-toolwrapper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gappletviewer-toolwrapper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gjarsigner-toolwrapper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gkeytool-toolwrapper.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -528,47 +529,47 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-appletviewer-toolwrapper.o: toolwrapper.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(appletviewer_CFLAGS) $(CFLAGS) -MT appletviewer-toolwrapper.o -MD -MP -MF "$(DEPDIR)/appletviewer-toolwrapper.Tpo" -c -o appletviewer-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/appletviewer-toolwrapper.Tpo" "$(DEPDIR)/appletviewer-toolwrapper.Po"; else rm -f "$(DEPDIR)/appletviewer-toolwrapper.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='appletviewer-toolwrapper.o' libtool=no @AMDEPBACKSLASH@
+gappletviewer-toolwrapper.o: toolwrapper.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gappletviewer_CFLAGS) $(CFLAGS) -MT gappletviewer-toolwrapper.o -MD -MP -MF "$(DEPDIR)/gappletviewer-toolwrapper.Tpo" -c -o gappletviewer-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gappletviewer-toolwrapper.Tpo" "$(DEPDIR)/gappletviewer-toolwrapper.Po"; else rm -f "$(DEPDIR)/gappletviewer-toolwrapper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='gappletviewer-toolwrapper.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(appletviewer_CFLAGS) $(CFLAGS) -c -o appletviewer-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gappletviewer_CFLAGS) $(CFLAGS) -c -o gappletviewer-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c
-appletviewer-toolwrapper.obj: toolwrapper.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(appletviewer_CFLAGS) $(CFLAGS) -MT appletviewer-toolwrapper.obj -MD -MP -MF "$(DEPDIR)/appletviewer-toolwrapper.Tpo" -c -o appletviewer-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/appletviewer-toolwrapper.Tpo" "$(DEPDIR)/appletviewer-toolwrapper.Po"; else rm -f "$(DEPDIR)/appletviewer-toolwrapper.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='appletviewer-toolwrapper.obj' libtool=no @AMDEPBACKSLASH@
+gappletviewer-toolwrapper.obj: toolwrapper.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gappletviewer_CFLAGS) $(CFLAGS) -MT gappletviewer-toolwrapper.obj -MD -MP -MF "$(DEPDIR)/gappletviewer-toolwrapper.Tpo" -c -o gappletviewer-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gappletviewer-toolwrapper.Tpo" "$(DEPDIR)/gappletviewer-toolwrapper.Po"; else rm -f "$(DEPDIR)/gappletviewer-toolwrapper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='gappletviewer-toolwrapper.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(appletviewer_CFLAGS) $(CFLAGS) -c -o appletviewer-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gappletviewer_CFLAGS) $(CFLAGS) -c -o gappletviewer-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`
-jarsigner-toolwrapper.o: toolwrapper.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jarsigner_CFLAGS) $(CFLAGS) -MT jarsigner-toolwrapper.o -MD -MP -MF "$(DEPDIR)/jarsigner-toolwrapper.Tpo" -c -o jarsigner-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jarsigner-toolwrapper.Tpo" "$(DEPDIR)/jarsigner-toolwrapper.Po"; else rm -f "$(DEPDIR)/jarsigner-toolwrapper.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='jarsigner-toolwrapper.o' libtool=no @AMDEPBACKSLASH@
+gjarsigner-toolwrapper.o: toolwrapper.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gjarsigner_CFLAGS) $(CFLAGS) -MT gjarsigner-toolwrapper.o -MD -MP -MF "$(DEPDIR)/gjarsigner-toolwrapper.Tpo" -c -o gjarsigner-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gjarsigner-toolwrapper.Tpo" "$(DEPDIR)/gjarsigner-toolwrapper.Po"; else rm -f "$(DEPDIR)/gjarsigner-toolwrapper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='gjarsigner-toolwrapper.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jarsigner_CFLAGS) $(CFLAGS) -c -o jarsigner-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gjarsigner_CFLAGS) $(CFLAGS) -c -o gjarsigner-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c
-jarsigner-toolwrapper.obj: toolwrapper.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jarsigner_CFLAGS) $(CFLAGS) -MT jarsigner-toolwrapper.obj -MD -MP -MF "$(DEPDIR)/jarsigner-toolwrapper.Tpo" -c -o jarsigner-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/jarsigner-toolwrapper.Tpo" "$(DEPDIR)/jarsigner-toolwrapper.Po"; else rm -f "$(DEPDIR)/jarsigner-toolwrapper.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='jarsigner-toolwrapper.obj' libtool=no @AMDEPBACKSLASH@
+gjarsigner-toolwrapper.obj: toolwrapper.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gjarsigner_CFLAGS) $(CFLAGS) -MT gjarsigner-toolwrapper.obj -MD -MP -MF "$(DEPDIR)/gjarsigner-toolwrapper.Tpo" -c -o gjarsigner-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gjarsigner-toolwrapper.Tpo" "$(DEPDIR)/gjarsigner-toolwrapper.Po"; else rm -f "$(DEPDIR)/gjarsigner-toolwrapper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='gjarsigner-toolwrapper.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(jarsigner_CFLAGS) $(CFLAGS) -c -o jarsigner-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gjarsigner_CFLAGS) $(CFLAGS) -c -o gjarsigner-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`
-keytool-toolwrapper.o: toolwrapper.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(keytool_CFLAGS) $(CFLAGS) -MT keytool-toolwrapper.o -MD -MP -MF "$(DEPDIR)/keytool-toolwrapper.Tpo" -c -o keytool-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/keytool-toolwrapper.Tpo" "$(DEPDIR)/keytool-toolwrapper.Po"; else rm -f "$(DEPDIR)/keytool-toolwrapper.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='keytool-toolwrapper.o' libtool=no @AMDEPBACKSLASH@
+gkeytool-toolwrapper.o: toolwrapper.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gkeytool_CFLAGS) $(CFLAGS) -MT gkeytool-toolwrapper.o -MD -MP -MF "$(DEPDIR)/gkeytool-toolwrapper.Tpo" -c -o gkeytool-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gkeytool-toolwrapper.Tpo" "$(DEPDIR)/gkeytool-toolwrapper.Po"; else rm -f "$(DEPDIR)/gkeytool-toolwrapper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='gkeytool-toolwrapper.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(keytool_CFLAGS) $(CFLAGS) -c -o keytool-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gkeytool_CFLAGS) $(CFLAGS) -c -o gkeytool-toolwrapper.o `test -f 'toolwrapper.c' || echo '$(srcdir)/'`toolwrapper.c
-keytool-toolwrapper.obj: toolwrapper.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(keytool_CFLAGS) $(CFLAGS) -MT keytool-toolwrapper.obj -MD -MP -MF "$(DEPDIR)/keytool-toolwrapper.Tpo" -c -o keytool-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/keytool-toolwrapper.Tpo" "$(DEPDIR)/keytool-toolwrapper.Po"; else rm -f "$(DEPDIR)/keytool-toolwrapper.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='keytool-toolwrapper.obj' libtool=no @AMDEPBACKSLASH@
+gkeytool-toolwrapper.obj: toolwrapper.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gkeytool_CFLAGS) $(CFLAGS) -MT gkeytool-toolwrapper.obj -MD -MP -MF "$(DEPDIR)/gkeytool-toolwrapper.Tpo" -c -o gkeytool-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gkeytool-toolwrapper.Tpo" "$(DEPDIR)/gkeytool-toolwrapper.Po"; else rm -f "$(DEPDIR)/gkeytool-toolwrapper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='toolwrapper.c' object='gkeytool-toolwrapper.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(keytool_CFLAGS) $(CFLAGS) -c -o keytool-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gkeytool_CFLAGS) $(CFLAGS) -c -o gkeytool-toolwrapper.obj `if test -f 'toolwrapper.c'; then $(CYGPATH_W) 'toolwrapper.c'; else $(CYGPATH_W) '$(srcdir)/toolwrapper.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
@@ -808,8 +809,7 @@ $(TOOLS_ZIP): $(TOOLS_JAVA_FILES)
cp $(GIOP_HELPS) classes/gnu/classpath/tools/giop/
$(JCOMPILER) -d classes $(TOOLS_JAVA_FILES)
(cd classes; \
- if test "$(ZIP)" != ""; then $(ZIP) -r ../$(TOOLS_ZIP) .; fi; \
- if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(TOOLS_ZIP) .; fi; \
+ $(FASTJAR) cf ../$(TOOLS_ZIP) .; \
cd ..)
rm -rf classes
diff --git a/libjava/classpath/tools/toolwrapper.c b/libjava/classpath/tools/toolwrapper.c
index de6556c63ea..9ad14ac6d1b 100644
--- a/libjava/classpath/tools/toolwrapper.c
+++ b/libjava/classpath/tools/toolwrapper.c
@@ -128,7 +128,7 @@ main (int argc, const char** argv)
goto destroy;
}
- vm_args.options[vm_args.nOptions++].optionString = "-Djava.class.path=" DATA_DIR "/" PACKAGE "/tools.zip";
+ vm_args.options[vm_args.nOptions++].optionString = "-Djava.class.path=" TOOLS_ZIP;
}
/* Terminate vm_args.options with a NULL element. */
@@ -188,7 +188,7 @@ main (int argc, const char** argv)
(*env)->SetObjectArrayElement (env, args_array, i, str);
}
- class_id = (*env)->FindClass (env, "gnu/classpath/tools/" TOOLNAME "/Main");
+ class_id = (*env)->FindClass (env, "gnu/classpath/tools/" TOOLPACKAGE "/Main");
if (class_id == NULL)
{
fprintf (stderr, TOOLNAME ": FindClass failed.\n");