Re: [cp-patches] FYI: X peers
hello Roman, On Friday 30 June 2006 01:27, Roman Kennke wrote: > I checked in the Escher-based X peers and added some configury for > enabling it. To build the X peers you need the most recent Escher > library, to be found here: > > http://kennke.org/~roman/escher-0.3.0.jar > > Configure with: --with-escher=/path/to/escher-0.3.0.jar > --enable-local-sockets would it make sense to create a new folder, say "external-jars" and include the latest escher (and other java-only external dependencies) jar(s) there. --with-escher can use that jar/location by default, otherwise the full path to a distro's/user's location of that jar can be fed to configure. cheers; rsn pgpC0POInV7yH.pgp Description: PGP signature
[cp-patches] FYI: AbstractGraphics2D fix
This provides a default impl for getDestinationRaster() in AbstractGraphics2D. I hope that this fixes the build for the X peers. 2006-07-01 Roman Kennke <[EMAIL PROTECTED]> * gnu/java/awt/java2d/AbstractGraphics2D.java (transform): Make field protected. (getDestinationRaster): Provide default implementation for previously abstract method. /Roman -- “Improvement makes straight roads, but the crooked roads, without Improvement, are roads of Genius.” - William Blake Index: gnu/java/awt/java2d/AbstractGraphics2D.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v retrieving revision 1.10 diff -u -1 -2 -r1.10 AbstractGraphics2D.java --- gnu/java/awt/java2d/AbstractGraphics2D.java 21 Jun 2006 08:06:29 - 1.10 +++ gnu/java/awt/java2d/AbstractGraphics2D.java 30 Jun 2006 23:16:47 - @@ -64,24 +64,25 @@ import java.awt.geom.Arc2D; import java.awt.geom.Area; import java.awt.geom.Ellipse2D; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.NoninvertibleTransformException; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ColorModel; +import java.awt.image.DataBuffer; import java.awt.image.ImageObserver; import java.awt.image.Raster; import java.awt.image.RenderedImage; import java.awt.image.WritableRaster; import java.awt.image.renderable.RenderableImage; import java.text.AttributedCharacterIterator; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** @@ -136,25 +137,25 @@ { /** * Accuracy of the sampling in the anti-aliasing shape filler. * Lower values give more speed, while higher values give more quality. * It is advisable to choose powers of two. */ private static final int AA_SAMPLING = 8; /** * The transformation for this Graphics2D instance */ - private AffineTransform transform; + protected AffineTransform transform; /** * The foreground. */ private Paint paint; /** * The background. */ private Color background; /** @@ -2055,25 +2056,52 @@ destinationRaster = getDestinationRaster(); clip = getDeviceBounds(); } /** * Returns a WritableRaster that is used by this class to perform the * rendering in. It is not necessary that the target surface immediately * reflects changes in the raster. Updates to the raster are notified via * [EMAIL PROTECTED] #updateRaster}. * * @return the destination raster */ - protected abstract WritableRaster getDestinationRaster(); + protected WritableRaster getDestinationRaster() + { +// TODO: Ideally we would fetch the xdrawable's surface pixels for +// initialization of the raster. +Rectangle db = getDeviceBounds(); +if (destinationRaster == null) + { +int[] bandMasks = new int[]{ 0xFF, 0xFF00, 0xFF }; +destinationRaster = Raster.createPackedRaster(DataBuffer.TYPE_INT, + db.width, db.height, + bandMasks, null); +// Initialize raster with white. +int x0 = destinationRaster.getMinX(); +int x1 = destinationRaster.getWidth() + x0; +int y0 = destinationRaster.getMinY(); +int y1 = destinationRaster.getHeight() + y0; +int numBands = destinationRaster.getNumBands(); +for (int y = y0; y < y1; y++) + { +for (int x = x0; x < x1; x++) + { +for (int b = 0; b < numBands; b++) + destinationRaster.setSample(x, y, b, 255); + } + } + } +return destinationRaster; + } /** * Notifies the backend that the raster has changed in the specified * rectangular area. The raster that is provided in this method is always * the same as the one returned in [EMAIL PROTECTED] #getDestinationRaster}. * Backends that reflect changes to this raster directly don't need to do * anything here. * * @param raster the updated raster, identical to the raster returned *by [EMAIL PROTECTED] #getDestinationRaster()} * @param x the upper left corner of the updated region, X coordinate * @param y the upper lef corner of the updated region, Y coordinate signature.asc Description: Dies ist ein digital signierter Nachrichtenteil
Re: [cp-patches]: RFA: TextArea and TextComponent fixes
Tania Bento wrote: Hey, Based on David Gilbert's comments and suggestions, I have made these modifcations. I have also committed mauve tests for these changes. If someone could please approve/comment on this patch, that would be great. Looks good, please commit. Thanks, Tom Thanks, Tania 2006-06-30 Tania Bento <[EMAIL PROTECTED]> * java/awt/TextArea.java: (TextArea(String, int, int, int)): No longer throws IllegalArgumentException if rows, columns, or scrollbarVisibility values are invalid. (TextArea(String, int, int, int)): If rows or columns are < 0, they get set to 0. If scrollbarVisibility is < 0 or > 4, it gets set to the default value of 0 (SCROLLBARS_BOTH). (appendText): Added case when peer = null. (insertText): Added case when peer == null. (replaceText): Added case when peer == null. * java/awt/TextComponent.java: (TextComponent(String)): If text == null, set it to "". Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.127 diff -u -r1.127 Component.java --- java/awt/Component.java 27 Jun 2006 19:59:14 - 1.127 +++ java/awt/Component.java 30 Jun 2006 18:29:57 - @@ -4697,7 +4697,7 @@ Object newValue) { if (changeSupport != null) - changeSupport.firePropertyChange(propertyName, oldValue, newValue); + changeSupport.firePropertyChange(propertyName, oldValue, newValue); } /** Index: java/awt/TextArea.java === RCS file: /cvsroot/classpath/classpath/java/awt/TextArea.java,v retrieving revision 1.20 diff -u -r1.20 TextArea.java --- java/awt/TextArea.java 20 Sep 2005 01:05:28 - 1.20 +++ java/awt/TextArea.java 30 Jun 2006 18:29:57 - @@ -125,9 +125,11 @@ * the specified text. Conceptually the TextArea has 0 * rows and 0 columns but its initial bounds are defined by its peer * or by the container in which it is packed. Both horizontal and - * veritcal scrollbars will be displayed. + * veritcal scrollbars will be displayed. The TextArea initially contains + * the specified text. If text specified as null, it will + * be set to "". * - * @param text The text to display in this text area. + * @param text The text to display in this text area (null permitted). * * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true */ @@ -156,9 +158,10 @@ * Initialize a new instance of TextArea that can * display the specified number of rows and columns of text, without * the need to scroll. The TextArea initially contains the - * specified text. + * specified text. If text specified as null, it will + * be set to "". * - * @param text The text to display in this text area. + * @param text The text to display in this text area (null permitted). * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. * @@ -174,9 +177,10 @@ * contains the specified text. The TextArea can display the * specified number of rows and columns of text, without the need to * scroll. This constructor allows specification of the scroll bar - * display policy. + * display policy. The TextArea initially contains the specified text. + * If text specified as null, it will be set to "". * - * @param text The text to display in this text area. + * @param text The text to display in this text area (null permitted). * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. * @param scrollbarVisibility The scroll bar display policy. One of @@ -192,18 +196,20 @@ if (GraphicsEnvironment.isHeadless ()) throw new HeadlessException (); -if (rows < 0 || columns < 0) - throw new IllegalArgumentException ("Bad row or column value"); - -if (scrollbarVisibility != SCROLLBARS_BOTH -&& scrollbarVisibility != SCROLLBARS_VERTICAL_ONLY -&& scrollbarVisibility != SCROLLBARS_HORIZONTAL_ONLY -&& scrollbarVisibility != SCROLLBARS_NONE) - throw new IllegalArgumentException ("Bad scrollbar visibility value"); - -this.rows = rows; -this.columns = columns; -this.scrollbarVisibility = scrollbarVisibility; +if (rows < 0) + this.rows = 0; +else + this.rows = rows; + +if (columns < 0) + this.columns = 0; +else + this.columns = columns; + +if (scrollbarVisibility < 0 || scrollbarVisibility > 4) + this.scrollbarVisibility = SCROLLBARS_BOTH; +else + this.scrollbarVisibility = scrollbarVisibility; // TextAreas need to receive tab key events so we override th
Re: [cp-patches] FYI: Checkbox group fix
Added synchronized blocks around groupMap.get calls. 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java (create): Added synchronized block around groupMap.get calls. (setCheckboxGroup): Likewise. On Fri, 2006-06-30 at 15:57 -0400, Lillian Angel wrote: > fitzsim suggested that not all functions be synchronized, but there be a > synchronized block around the code that adds the new pointer to the > groupMap. > > Fixed. > > > 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> > > * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java > (create): Changed to be non-synchronized. > (setLabel): Likewise. > (setCheckboxGroup): Likewise. > (addToGroupMap): Likewise. Added synchronized block around > code. > (dispose): Changed to be non-synchronized. > > > On Fri, 2006-06-30 at 15:31 -0400, Lillian Angel wrote: > > Hi, > > > > I fixed the issues Tom stated below. > > > > On Fri, 2006-06-30 at 13:03 -0400, Thomas Fitzsimmons wrote: > > > Hi, > > > > > > Lillian Angel wrote: > > > > This patch fixes the long standing problem of not being able to > > > > dynamically switch between a checkbox and a radio button. I.e. moving a > > > > checkbox to a checkbox group changes the checkbox to a radio button. > > > > > > > > Tom helped a lot with this patch. He removed the CheckboxGroupPeer and > > > > we fixed it so everything is handled in GtkCheckboxPeer. > > > > > > > > There is a mauve test for this. The harmony test > > > > (test.java.awt.CheckboxTest) now passes. > > > > [...] > > > > + if (groupPointer != 0) > > > > + { > > > > +native_group = JLONG_TO_PTR (GSList, groupPointer); > > > > +if(! GTK_IS_RADIO_BUTTON (native_group->data)) > > > > + native_group = NULL; > > > > > > When does it happen that the data field is not a GtkRadioButton? I > > > suspect only > > > after removing a Checkbox from a CheckboxGroup? This is likely a memory > > > leak -- > > > if the native_group's data field is no longer valid then we should > > > probably free > > > the GSList. > > > > Gtk actually frees the list when needed. I changed these checks to > > asserts and set the native_group to null in *_removeFromGroup (when > > needed). > > > > [...] > > > > > > + gdk_threads_leave (); > > > > + > > > > + return PTR_TO_JLONG (native_group); > > > > > > I realized that there is a race condition here. Instead of returning the > > > pointer value, we should use JNI to set the groupPointer field with the > > > GDK lock > > > held. > > > > I changed all functions in GtkCheckboxPeer to be syncronized, and added > > a new function to put the new group in the groupMap. This function is > > called from the native peer. > > > > [...] > > > > + NSA_DEL_PTR (env, obj); > > > > + NSA_SET_PTR (env, obj, container); > > > > > > The NSA table points to the containing event box, so I don't think these > > > two > > > lines are necessary. > > > > Removed > > > > > 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> > > > > * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: > > Changed all return values of native functions to void. > > (create): Changed function to be syncronized. Removed > > call to put value in groupMap, this is now done from > > the native code. > > (setState): Changed function to be syncronized. > > (setLabel): Changed function to be syncronized. > > (setCheckboxGroup): Changed function to be syncronized. Removed > > call to put value in groupMap, this is now done from > > the native code. > > (postItemEvent): Changed function to be syncronized. > > (addToGroupMap): New function. Called by native code to add > > new value to the group. > > (dispose): Changed function to be syncronized. > > * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Updated > > all functions. > > * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c > > (cp_gtk_checkbox_init_jni): Added code to link to > > java function. > > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): > > Changed return value to void. Added call > > to java function to set pointer in groupMap. > > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addtoGroup): > > Likewise. Also, changed check to an assert. Also, removed call > > to set/del pointer. > > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): > > Likewise. Also, added check to determine if native_group should > > be set to NULL. > > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): > > Likewise. > > > > Committed, > > Lillian Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPe
Re: [cp-patches] FYI: Checkbox group fix
fitzsim suggested that not all functions be synchronized, but there be a synchronized block around the code that adds the new pointer to the groupMap. Fixed. 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java (create): Changed to be non-synchronized. (setLabel): Likewise. (setCheckboxGroup): Likewise. (addToGroupMap): Likewise. Added synchronized block around code. (dispose): Changed to be non-synchronized. On Fri, 2006-06-30 at 15:31 -0400, Lillian Angel wrote: > Hi, > > I fixed the issues Tom stated below. > > On Fri, 2006-06-30 at 13:03 -0400, Thomas Fitzsimmons wrote: > > Hi, > > > > Lillian Angel wrote: > > > This patch fixes the long standing problem of not being able to > > > dynamically switch between a checkbox and a radio button. I.e. moving a > > > checkbox to a checkbox group changes the checkbox to a radio button. > > > > > > Tom helped a lot with this patch. He removed the CheckboxGroupPeer and > > > we fixed it so everything is handled in GtkCheckboxPeer. > > > > > > There is a mauve test for this. The harmony test > > > (test.java.awt.CheckboxTest) now passes. > > [...] > > > + if (groupPointer != 0) > > > + { > > > +native_group = JLONG_TO_PTR (GSList, groupPointer); > > > +if(! GTK_IS_RADIO_BUTTON (native_group->data)) > > > + native_group = NULL; > > > > When does it happen that the data field is not a GtkRadioButton? I suspect > > only > > after removing a Checkbox from a CheckboxGroup? This is likely a memory > > leak -- > > if the native_group's data field is no longer valid then we should probably > > free > > the GSList. > > Gtk actually frees the list when needed. I changed these checks to > asserts and set the native_group to null in *_removeFromGroup (when > needed). > > [...] > > > > + gdk_threads_leave (); > > > + > > > + return PTR_TO_JLONG (native_group); > > > > I realized that there is a race condition here. Instead of returning the > > pointer value, we should use JNI to set the groupPointer field with the GDK > > lock > > held. > > I changed all functions in GtkCheckboxPeer to be syncronized, and added > a new function to put the new group in the groupMap. This function is > called from the native peer. > > [...] > > > + NSA_DEL_PTR (env, obj); > > > + NSA_SET_PTR (env, obj, container); > > > > The NSA table points to the containing event box, so I don't think these > > two > > lines are necessary. > > Removed > > > 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> > > * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: > Changed all return values of native functions to void. > (create): Changed function to be syncronized. Removed > call to put value in groupMap, this is now done from > the native code. > (setState): Changed function to be syncronized. > (setLabel): Changed function to be syncronized. > (setCheckboxGroup): Changed function to be syncronized. Removed > call to put value in groupMap, this is now done from > the native code. > (postItemEvent): Changed function to be syncronized. > (addToGroupMap): New function. Called by native code to add > new value to the group. > (dispose): Changed function to be syncronized. > * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Updated > all functions. > * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c > (cp_gtk_checkbox_init_jni): Added code to link to > java function. > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): > Changed return value to void. Added call > to java function to set pointer in groupMap. > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addtoGroup): > Likewise. Also, changed check to an assert. Also, removed call > to set/del pointer. > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): > Likewise. Also, added check to determine if native_group should > be set to NULL. > (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): > Likewise. > > Committed, > Lillian Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,v retrieving revision 1.27 diff -u -r1.27 GtkCheckboxPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 19:28:21 - 1.27 +++ gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 19:52:25 - @@ -80,7 +80,7 @@ super (c); } - public synchronized void create () + public void create () { Checkbox checkbox = (Checkbox) awtComponent; current_group = checkbox.getCheckboxGroup (); @@ -133,12 +133,12 @@ } } - public synchronized void setLabel (String label) + public void setLabe
[cp-patches] RFC: Crypto: SecretKeySpec equals method does not check the object type
Hi, I have attached a small patch that fixes PR28212: SecretKeySpec equals method does not check the object type (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28212) The equal method now checks the object type passed to the equals method to make sure it is an instance of SecretKeySpec. Thanks, Matt Wringe Changelog: 2006-06-30 Matt Wringe <[EMAIL PROTECTED]> * javax/crypto/spec/SecretKeySpec.java (equals): Check object type Index: SecretKeySpec.java === RCS file: /sources/classpath/classpath/javax/crypto/spec/SecretKeySpec.java,v retrieving revision 1.3 diff -u -r1.3 SecretKeySpec.java --- SecretKeySpec.java 2 Jul 2005 20:32:45 - 1.3 +++ SecretKeySpec.java 30 Jun 2006 19:11:01 - @@ -133,14 +133,22 @@ public boolean equals(Object o) { -byte[] okey = ((SecretKeySpec) o).getEncoded(); -if (key.length != okey.length) return false; -for (int i = 0; i < key.length; i++) +if (o instanceof SecretKeySpec) { -if (key[i] != okey[i]) +byte[] okey = ((SecretKeySpec) o).getEncoded(); +if (key.length != okey.length) return false; +for (int i = 0; i < key.length; i++) + { +if (key[i] != okey[i]) + return false; + } +return algorithm.equals(((SecretKeySpec) o).getAlgorithm()); + } +else + { +return false; } -return algorithm.equals(((SecretKeySpec) o).getAlgorithm()); } public int hashCode()
Re: [cp-patches] Patch: Checkbox group fix
Hi, I fixed the issues Tom stated below. On Fri, 2006-06-30 at 13:03 -0400, Thomas Fitzsimmons wrote: > Hi, > > Lillian Angel wrote: > > This patch fixes the long standing problem of not being able to > > dynamically switch between a checkbox and a radio button. I.e. moving a > > checkbox to a checkbox group changes the checkbox to a radio button. > > > > Tom helped a lot with this patch. He removed the CheckboxGroupPeer and > > we fixed it so everything is handled in GtkCheckboxPeer. > > > > There is a mauve test for this. The harmony test > > (test.java.awt.CheckboxTest) now passes. [...] > > + if (groupPointer != 0) > > + { > > +native_group = JLONG_TO_PTR (GSList, groupPointer); > > +if(! GTK_IS_RADIO_BUTTON (native_group->data)) > > + native_group = NULL; > > When does it happen that the data field is not a GtkRadioButton? I suspect > only > after removing a Checkbox from a CheckboxGroup? This is likely a memory leak > -- > if the native_group's data field is no longer valid then we should probably > free > the GSList. Gtk actually frees the list when needed. I changed these checks to asserts and set the native_group to null in *_removeFromGroup (when needed). [...] > > + gdk_threads_leave (); > > + > > + return PTR_TO_JLONG (native_group); > > I realized that there is a race condition here. Instead of returning the > pointer value, we should use JNI to set the groupPointer field with the GDK > lock > held. I changed all functions in GtkCheckboxPeer to be syncronized, and added a new function to put the new group in the groupMap. This function is called from the native peer. [...] > > + NSA_DEL_PTR (env, obj); > > + NSA_SET_PTR (env, obj, container); > > The NSA table points to the containing event box, so I don't think these two > lines are necessary. Removed > 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: Changed all return values of native functions to void. (create): Changed function to be syncronized. Removed call to put value in groupMap, this is now done from the native code. (setState): Changed function to be syncronized. (setLabel): Changed function to be syncronized. (setCheckboxGroup): Changed function to be syncronized. Removed call to put value in groupMap, this is now done from the native code. (postItemEvent): Changed function to be syncronized. (addToGroupMap): New function. Called by native code to add new value to the group. (dispose): Changed function to be syncronized. * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Updated all functions. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (cp_gtk_checkbox_init_jni): Added code to link to java function. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): Changed return value to void. Added call to java function to set pointer in groupMap. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addtoGroup): Likewise. Also, changed check to an assert. Also, removed call to set/del pointer. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): Likewise. Also, added check to determine if native_group should be set to NULL. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): Likewise. Committed, Lillian Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,v retrieving revision 1.26 diff -u -r1.26 GtkCheckboxPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 14:47:17 - 1.26 +++ gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 30 Jun 2006 19:19:55 - @@ -60,11 +60,11 @@ private static WeakHashMap groupMap = new WeakHashMap(); public native void createCheckButton (); - public native long createRadioButton (long groupPointer); + public native void createRadioButton (long groupPointer); - public native long addToGroup (long groupPointer); - public native long removeFromGroup (); - public native long switchToGroup (long groupPointer); + public native void addToGroup (long groupPointer); + public native void removeFromGroup (); + public native void switchToGroup (long groupPointer); public native void connectSignals (); @@ -80,7 +80,7 @@ super (c); } - public void create () + public synchronized void create () { Checkbox checkbox = (Checkbox) awtComponent; current_group = checkbox.getCheckboxGroup (); @@ -100,15 +100,14 @@ { // We don't know about this group. Create a new native // group pointer for this group and store it in our map. -groupMap.put(current_group, new Long (createRadioButton(0))); + createR
[cp-patches] RFA: Native cairo benchmarking
Hi, As Tom Fitzsimmons suggested, I've created a native cairo benchmark using GTK to compare our Java implementation with (I'll post the results to the classpath list in a minute). Using a GTK widget, the benchmark tests some of the basic java2d operations (draws/fills on arcs, curves, lines, and rectangles) - the implementation itself is identical to the java implementation, using code modified from the java2d peers, so this is essentially a test of JNI overhead. As this patch modifies the make files, I'd appreciate it if someone could look it over and approve it for commit. Thanks, Francis 2006-06-30 Francis Kung <[EMAIL PROTECTED]> * configure.ac (AC_CONFIG_FILES): Add examples/Makefile.java2d. * examples/.cvsignore: Add Makefile.java2d. * examples/Makefile.am: Add EXAMPLE_CH_FILES for C headers. (ALL_EXAMPLE_FILES): Add C headers. (install-data-local): Add Makefile.java2d. (uninstall-local): Likewise. (EXTRA_DIST): Add Makefile.java2d.in. * examples/Makefile.java2d.in: New file. * examples/README: Add java2d instructions. * examples/gnu/classpath/examples/java2d/bench.c: New file. * examples/gnu/classpath/examples/java2d/bench.h: New file. Index: configure.ac === RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.168 diff -u -r1.168 configure.ac --- configure.ac 30 Jun 2006 11:39:15 - 1.168 +++ configure.ac 30 Jun 2006 18:58:46 - @@ -787,7 +787,8 @@ lib/copy-vmresources.sh tools/Makefile examples/Makefile -examples/Makefile.jawt]) +examples/Makefile.jawt +examples/Makefile.java2d]) if test "x${COMPILE_WRAPPERS}" = xno then Index: examples/.cvsignore === RCS file: /cvsroot/classpath/classpath/examples/.cvsignore,v retrieving revision 1.3 diff -u -r1.3 .cvsignore --- examples/.cvsignore 5 Sep 2005 08:31:03 - 1.3 +++ examples/.cvsignore 30 Jun 2006 18:58:46 - @@ -2,3 +2,5 @@ Makefile.in examples.zip Makefile.jawt +Makefile.java2d + Index: examples/Makefile.am === RCS file: /cvsroot/classpath/classpath/examples/Makefile.am,v retrieving revision 1.12 diff -u -r1.12 Makefile.am --- examples/Makefile.am 2 Apr 2006 20:55:33 - 1.12 +++ examples/Makefile.am 30 Jun 2006 18:58:46 - @@ -23,8 +23,9 @@ # All our example java source files EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*/*.java -# The example C source files +# The example C source & header files EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c +EXAMPLE_CH_FILES = $(srcdir)/gnu/classpath/examples/*/*.h # The zip files with classes we want to produce. EXAMPLE_ZIP = examples.zip @@ -39,7 +40,7 @@ READMES = $(srcdir)/gnu/classpath/examples/CORBA/swing/README.html # All the files we find "interesting" -ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS) $(READMES) +ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_CH_FILES) $(EXAMPLE_ICONS) $(READMES) # Some architecture independent data to be installed. example_DATA = $(EXAMPLE_ZIP) README @@ -62,7 +63,9 @@ $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/examples/$$f; \ done echo "$(INSTALL_DATA) Makefile.jawt $(DESTDIR)$(pkgdatadir)/examples/" + echo "$(INSTALL_DATA) Makefile.java2d $(DESTDIR)$(pkgdatadir)/examples/" $(INSTALL_DATA) Makefile.jawt $(DESTDIR)$(pkgdatadir)/examples/ + $(INSTALL_DATA) Makefile.java2d $(DESTDIR)$(pkgdatadir)/examples/ uninstall-local: srcdir_cnt=`echo $(srcdir) | wc -c`; \ @@ -72,10 +75,12 @@ rm -f $(DESTDIR)$(pkgdatadir)/examples/$$f; \ done echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.jawt" + echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.java2d" rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.jawt + rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.java2d # Make sure everything is included in the distribution. -EXTRA_DIST = README Makefile.jawt.in +EXTRA_DIST = README Makefile.jawt.in Makefile.java2d.in dist-hook: srcdir_cnt=`echo $(srcdir) | wc -c`; \ for file in $(ALL_EXAMPLE_FILES); do \ Index: examples/README === RCS file: /cvsroot/classpath/classpath/examples/README,v retrieving revision 1.5 diff -u -r1.5 README --- examples/README 5 Sep 2005 08:31:03 - 1.5 +++ examples/README 30 Jun 2006 18:58:46 - @@ -46,6 +46,23 @@ export LD_LIBRARY_PATH=.:/usr/local/classpath/lib/classpath jamvm gnu.classpath.examples.jawt.DemoJAWT +The java2d benchmarking demos include a GTK widget to measure the native +speed of some basic java2d options, without the JNI overhead. + +You can invoke it with: + + make -f Makefile.java2d + +Or you can compile by hand
[cp-patches]: RFA: TextArea and TextComponent fixes
Hey, Based on David Gilbert's comments and suggestions, I have made these modifcations. I have also committed mauve tests for these changes. If someone could please approve/comment on this patch, that would be great. Thanks, Tania 2006-06-30 Tania Bento <[EMAIL PROTECTED]> * java/awt/TextArea.java: (TextArea(String, int, int, int)): No longer throws IllegalArgumentException if rows, columns, or scrollbarVisibility values are invalid. (TextArea(String, int, int, int)): If rows or columns are < 0, they get set to 0. If scrollbarVisibility is < 0 or > 4, it gets set to the default value of 0 (SCROLLBARS_BOTH). (appendText): Added case when peer = null. (insertText): Added case when peer == null. (replaceText): Added case when peer == null. * java/awt/TextComponent.java: (TextComponent(String)): If text == null, set it to "". Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.127 diff -u -r1.127 Component.java --- java/awt/Component.java 27 Jun 2006 19:59:14 - 1.127 +++ java/awt/Component.java 30 Jun 2006 18:29:57 - @@ -4697,7 +4697,7 @@ Object newValue) { if (changeSupport != null) - changeSupport.firePropertyChange(propertyName, oldValue, newValue); + changeSupport.firePropertyChange(propertyName, oldValue, newValue); } /** Index: java/awt/TextArea.java === RCS file: /cvsroot/classpath/classpath/java/awt/TextArea.java,v retrieving revision 1.20 diff -u -r1.20 TextArea.java --- java/awt/TextArea.java 20 Sep 2005 01:05:28 - 1.20 +++ java/awt/TextArea.java 30 Jun 2006 18:29:57 - @@ -125,9 +125,11 @@ * the specified text. Conceptually the TextArea has 0 * rows and 0 columns but its initial bounds are defined by its peer * or by the container in which it is packed. Both horizontal and - * veritcal scrollbars will be displayed. + * veritcal scrollbars will be displayed. The TextArea initially contains + * the specified text. If text specified as null, it will + * be set to "". * - * @param text The text to display in this text area. + * @param text The text to display in this text area (null permitted). * * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true */ @@ -156,9 +158,10 @@ * Initialize a new instance of TextArea that can * display the specified number of rows and columns of text, without * the need to scroll. The TextArea initially contains the - * specified text. + * specified text. If text specified as null, it will + * be set to "". * - * @param text The text to display in this text area. + * @param text The text to display in this text area (null permitted). * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. * @@ -174,9 +177,10 @@ * contains the specified text. The TextArea can display the * specified number of rows and columns of text, without the need to * scroll. This constructor allows specification of the scroll bar - * display policy. + * display policy. The TextArea initially contains the specified text. + * If text specified as null, it will be set to "". * - * @param text The text to display in this text area. + * @param text The text to display in this text area (null permitted). * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. * @param scrollbarVisibility The scroll bar display policy. One of @@ -192,18 +196,20 @@ if (GraphicsEnvironment.isHeadless ()) throw new HeadlessException (); -if (rows < 0 || columns < 0) - throw new IllegalArgumentException ("Bad row or column value"); - -if (scrollbarVisibility != SCROLLBARS_BOTH -&& scrollbarVisibility != SCROLLBARS_VERTICAL_ONLY -&& scrollbarVisibility != SCROLLBARS_HORIZONTAL_ONLY -&& scrollbarVisibility != SCROLLBARS_NONE) - throw new IllegalArgumentException ("Bad scrollbar visibility value"); - -this.rows = rows; -this.columns = columns; -this.scrollbarVisibility = scrollbarVisibility; +if (rows < 0) + this.rows = 0; +else + this.rows = rows; + +if (columns < 0) + this.columns = 0; +else + this.columns = columns; + +if (scrollbarVisibility < 0 || scrollbarVisibility > 4) + this.scrollbarVisibility = SCROLLBARS_BOTH; +else + this.scrollbarVisibility = scrollbarVisibility; // TextAreas need to receive tab key events so we override the // default forward and backward traversal key sets. @@ -478,6 +484,8 @@ if (peer != null) peer.insert (str, peer.getText().length ()); +else +
[cp-patches] FYI: Remove ClasspathTextLayoutPeer
2006-06-30 Sven de Marothy <[EMAIL PROTECTED]> * gnu/java/awt/ClasspathToolkit.java, * gnu/java/awt/peer/x/XToolkit.java, * gnu/java/awt/peer/qt/QtToolkit.java, * gnu/java/awt/peer/gtk/GtkToolkit.java, Remove ClasspathTextLayoutPeer. * gnu/java/awt/peer/gtk/GdkTextLayout.java, * gnu/java/awt/peer/ClasspathTextLayoutPeer, Files removed. Index: gnu/java/awt/ClasspathToolkit.java === RCS file: /sources/classpath/classpath/gnu/java/awt/ClasspathToolkit.java,v retrieving revision 1.19 diff -U3 -r1.19 ClasspathToolkit.java --- gnu/java/awt/ClasspathToolkit.java 2 Sep 2005 09:15:22 - 1.19 +++ gnu/java/awt/ClasspathToolkit.java 30 Jun 2006 18:14:36 - @@ -41,7 +41,6 @@ import gnu.java.awt.EmbeddedWindow; import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.peer.EmbeddedWindowPeer; -import gnu.java.awt.peer.ClasspathTextLayoutPeer; import gnu.java.security.action.SetAccessibleAction; import java.awt.AWTException; @@ -120,10 +119,6 @@ */ public abstract ClasspathFontPeer getClasspathFontPeer (String name, Map attrs); - public abstract ClasspathTextLayoutPeer - getClasspathTextLayoutPeer (AttributedString str, FontRenderContext frc); - - /** * Creates a [EMAIL PROTECTED] Font}, in a platform-specific manner. * Index: gnu/java/awt/peer/gtk/GtkToolkit.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.88 diff -U3 -r1.88 GtkToolkit.java --- gnu/java/awt/peer/gtk/GtkToolkit.java 20 Jun 2006 11:36:23 - 1.88 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 30 Jun 2006 18:14:36 - @@ -42,7 +42,6 @@ import gnu.classpath.Configuration; import gnu.java.awt.EmbeddedWindow; import gnu.java.awt.peer.ClasspathFontPeer; -import gnu.java.awt.peer.ClasspathTextLayoutPeer; import gnu.java.awt.peer.EmbeddedWindowPeer; import java.awt.*; @@ -533,12 +532,6 @@ } } - public ClasspathTextLayoutPeer getClasspathTextLayoutPeer (AttributedString str, - FontRenderContext frc) - { -return new GdkTextLayout(str, frc); - } - protected EventQueue getSystemEventQueueImpl() { synchronized (GtkToolkit.class) Index: gnu/java/awt/peer/qt/QtToolkit.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/qt/QtToolkit.java,v retrieving revision 1.7 diff -U3 -r1.7 QtToolkit.java --- gnu/java/awt/peer/qt/QtToolkit.java 20 Jun 2006 11:36:23 - 1.7 +++ gnu/java/awt/peer/qt/QtToolkit.java 30 Jun 2006 18:14:36 - @@ -41,7 +41,6 @@ import gnu.java.awt.EmbeddedWindow; import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.peer.EmbeddedWindowPeer; -import gnu.java.awt.peer.ClasspathTextLayoutPeer; import java.awt.AWTEvent; import java.awt.AWTException; import java.awt.Button; @@ -450,12 +449,6 @@ return new QtFontPeer (name, attrs); } - public ClasspathTextLayoutPeer getClasspathTextLayoutPeer(AttributedString str, - FontRenderContext frc) - { -return null; - } - // FIXME public Font createFont(int format, InputStream stream) { Index: gnu/java/awt/peer/x/XToolkit.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XToolkit.java,v retrieving revision 1.1 diff -U3 -r1.1 XToolkit.java --- gnu/java/awt/peer/x/XToolkit.java 29 Jun 2006 15:15:56 - 1.1 +++ gnu/java/awt/peer/x/XToolkit.java 30 Jun 2006 18:14:36 - @@ -117,7 +117,6 @@ import gnu.java.awt.ClasspathToolkit; import gnu.java.awt.EmbeddedWindow; import gnu.java.awt.peer.ClasspathFontPeer; -import gnu.java.awt.peer.ClasspathTextLayoutPeer; import gnu.java.awt.peer.EmbeddedWindowPeer; import gnu.java.awt.peer.swing.SwingCanvasPeer; import gnu.java.awt.peer.swing.SwingLabelPeer; @@ -190,12 +189,6 @@ return font; } - public ClasspathTextLayoutPeer getClasspathTextLayoutPeer(AttributedString str, FontRenderContext frc) - { -// TODO: Implement this. -throw new UnsupportedOperationException("Not yet implemented."); - } - public Font createFont(int format, InputStream stream) { return null;
[cp-patches] FYI: Minor drawGlyphVector fix
2006-06-30 Sven de Marothy <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/CairoGraphics2D.java: (drawGlyphVector): Don't draw empty vectors. Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java === RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.28 diff -U3 -r1.28 CairoGraphics2D.java --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 21 Jun 2006 08:06:28 - 1.28 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 30 Jun 2006 17:37:03 - @@ -1392,6 +1392,10 @@ public void drawGlyphVector(GlyphVector gv, float x, float y) { double alpha = 1.0; + +if( gv.getNumGlyphs() <= 0 ) + return; + if (comp instanceof AlphaComposite) alpha = ((AlphaComposite) comp).getAlpha(); if (gv instanceof FreetypeGlyphVector && alpha == 1.0)
Re: [cp-patches] Patch: Checkbox group fix
Hi, Lillian Angel wrote: This patch fixes the long standing problem of not being able to dynamically switch between a checkbox and a radio button. I.e. moving a checkbox to a checkbox group changes the checkbox to a radio button. Tom helped a lot with this patch. He removed the CheckboxGroupPeer and we fixed it so everything is handled in GtkCheckboxPeer. There is a mauve test for this. The harmony test (test.java.awt.CheckboxTest) now passes. This looks good, but I have a few comments: +/* A radio button is created if we are part of a group. + groupPointer points to the corresponding group. If 0, + a new group is created. + This function is called when initially creating the + button, so an eventbox is created. + */ +JNIEXPORT jlong JNICALL +Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton + (JNIEnv *env, jobject obj, jlong groupPointer) +{ + GtkWidget *button; + GtkWidget *eventbox; + GSList *native_group = NULL; + + gdk_threads_enter (); + + NSA_SET_GLOBAL_REF (env, obj); + eventbox = gtk_event_box_new (); + + if (groupPointer != 0) + { +native_group = JLONG_TO_PTR (GSList, groupPointer); +if(! GTK_IS_RADIO_BUTTON (native_group->data)) + native_group = NULL; When does it happen that the data field is not a GtkRadioButton? I suspect only after removing a Checkbox from a CheckboxGroup? This is likely a memory leak -- if the native_group's data field is no longer valid then we should probably free the GSList. + } + button = gtk_radio_button_new_with_label (native_group, ""); + + if (native_group == NULL) +native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); + if (g_slist_index (native_group, GTK_RADIO_BUTTON (button)) == -1) + { +native_group = g_slist_prepend (native_group, GTK_RADIO_BUTTON (button)); +GTK_RADIO_BUTTON(button)->group = native_group; + } + + gtk_container_add (GTK_CONTAINER (eventbox), button); + gtk_widget_show (button); + + NSA_SET_PTR (env, obj, eventbox); + + gdk_threads_leave (); + + return PTR_TO_JLONG (native_group); I realized that there is a race condition here. Instead of returning the pointer value, we should use JNI to set the groupPointer field with the GDK lock held. +} + +/* Add the object to the group pointed to by groupPointer. + If groupPointer is 0, create a new group and create + a radio button. Otherwise, creating a radio button in an + existing group. + */ +JNIEXPORT jlong JNICALL +Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addToGroup + (JNIEnv *env, jobject obj, jlong groupPointer) +{ + void *ptr; + GtkWidget *container; + GtkWidget *check_button; + GtkWidget *radio_button; + const gchar *label; + GSList *native_group = NULL; + + gdk_threads_enter (); + + ptr = NSA_GET_PTR (env, obj); + container = GTK_WIDGET (ptr); + check_button = checkbox_get_widget (container); + label = gtk_label_get_text (GTK_LABEL (gtk_bin_get_child +(GTK_BIN (check_button; + + /* Need to remove the check_button, and replace it with + a radio button in a group. + */ + if (groupPointer != 0) +{ + native_group = JLONG_TO_PTR (GSList, groupPointer); + if(! GTK_IS_RADIO_BUTTON (native_group->data)) +native_group = NULL; +} + + radio_button = gtk_radio_button_new_with_label (native_group, label); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_button))); + + if (native_group == NULL) +native_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button)); + if (g_slist_index (native_group, GTK_RADIO_BUTTON (radio_button)) == -1) + { +native_group = g_slist_prepend (native_group, GTK_RADIO_BUTTON (radio_button)); +GTK_RADIO_BUTTON(radio_button)->group = native_group; + } + + gtk_container_remove (GTK_CONTAINER (container), check_button); + + NSA_DEL_PTR (env, obj); + NSA_SET_PTR (env, obj, container); The NSA table points to the containing event box, so I don't think these two lines are necessary. Tom
[cp-patches] Patch: Checkbox group fix
This patch fixes the long standing problem of not being able to dynamically switch between a checkbox and a radio button. I.e. moving a checkbox to a checkbox group changes the checkbox to a radio button. Tom helped a lot with this patch. He removed the CheckboxGroupPeer and we fixed it so everything is handled in GtkCheckboxPeer. There is a mauve test for this. The harmony test (test.java.awt.CheckboxTest) now passes. 2006-06-30 Lillian Angel <[EMAIL PROTECTED]> Tom Fitzsimmons <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java: Removed class. * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java: Added current_group, groupMap fields. Added definitions for new native functions. (create): Removed FIXME. Added code to create the check button or radio button when appropriate. Updated groupMap to contain pointer to the newly created group. (setCheckboxGroup): Added code to handle all cases. Removing a button from a group, adding a button to a group, or changing the group of a button. (dispose): Changed to call super. * include/Makefile.am: Removed reference to gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h. * include/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h: Removed file. * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Added definitions for new functions. * native/jni/gtk-peer/Makefile.am: Removed reference to gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c: Removed file. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_combobox_get_widget): Renamed to checkbox_get_widget. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectSignals): Changed to use checkbox_get_widget. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup): Removed. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont): Changed to use checkbox_get_widget. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel): Likewise. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createCheckButton): New function. Creates checkbutton without a group. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_createRadioButton): Creates a radio button in a group, using groupPointer. If groupPointer is 0, then a new group is created. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_addToGroup): Adds the check button to a group, using groupPointer. A radio button is created in its place. If groupPointer is 0, then a new group is created. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_removeFromGroup): The radio button is removed from the group. A check button is created in its place. (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_switchToGroup): The radio button is moved to a new group. Index: gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java === RCS file: gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java diff -N gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java 2 Jul 2005 20:32:12 - 1.3 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,86 +0,0 @@ -/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup - Copyright (C) 2002 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 mo
[cp-patches] FYI: Fix build != srcdir and distcheck
Hi, When using builddir != srcdir (as on the autobuilder) things didn't build successfully. This fixes that. 2006-06-30 Mark Wielaard <[EMAIL PROTECTED]> * configure.ac: Move standard.omit creation after dirs are created. Cat standard.omit.in from srcdir. Make exclude regex more explicit. * lib/Makefile.am (EXTRA_DIST): Add standard.omit.in. (clean-local): Remove standard.omit. * lib/gen-classlist.sh.in: Use omit file in build dir. * lib/standard.omit.in: Make exclude regex more explicit. Committed, Mark Index: configure.ac === RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.167 diff -u -r1.167 configure.ac --- configure.ac 30 Jun 2006 10:27:32 - 1.167 +++ configure.ac 30 Jun 2006 11:31:49 - @@ -746,12 +746,6 @@ AM_CONDITIONAL(ENABLE_LOCAL_SOCKETS, test "x$ENABLE_LOCAL_SOCKETS" = "xyes") -# Create standard.omit based on decisions we just made. -cp lib/standard.omit.in lib/standard.omit -if test x$use_escher != xtrue; then - echo gnu/java/awt/peer/x >> lib/standard.omit -fi - dnl --- dnl output files dnl --- @@ -814,3 +808,10 @@ AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh]) AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh]) AC_OUTPUT + +# Create standard.omit based on decisions we just made. +cat ${srcdir}/lib/standard.omit.in > lib/standard.omit +if test x$use_escher != xtrue; then + echo gnu/java/awt/peer/x/.*java$ >> lib/standard.omit +fi + Index: lib/Makefile.am === RCS file: /cvsroot/classpath/classpath/lib/Makefile.am,v retrieving revision 1.121 diff -u -r1.121 Makefile.am --- lib/Makefile.am 30 Jun 2006 10:27:33 - 1.121 +++ lib/Makefile.am 30 Jun 2006 11:31:51 - @@ -165,7 +165,7 @@ touch compile-classes endif -EXTRA_DIST = standard.omit mkcollections.pl.in Makefile.gcj split-for-gcj.sh +EXTRA_DIST = standard.omit.in mkcollections.pl.in Makefile.gcj split-for-gcj.sh CLEANFILES = compile-classes resources classes \ glibj.zip classes.1 classes.2 \ $(top_builddir)/gnu/java/locale/LocaleData.java \ @@ -181,6 +181,7 @@ -rm -rf META-INF -rm -rf lists -rm -f Makefile.deps + -rm -f standard.omit dist-hook: mkdir -p $(distdir) Index: lib/gen-classlist.sh.in === RCS file: /cvsroot/classpath/classpath/lib/gen-classlist.sh.in,v retrieving revision 1.37 diff -u -r1.37 gen-classlist.sh.in --- lib/gen-classlist.sh.in 9 Jun 2006 21:30:44 - 1.37 +++ lib/gen-classlist.sh.in 30 Jun 2006 11:31:51 - @@ -66,7 +66,7 @@ fi -cat @top_srcdir@/lib/$1.omit vm.omit > tmp.omit +cat $1.omit vm.omit > tmp.omit for dir in $vm_dirlist; do if test -f $dir/$1.omit; then cat $dir/$1.omit >> tmp.omit Index: lib/standard.omit.in === RCS file: /cvsroot/classpath/classpath/lib/standard.omit.in,v retrieving revision 1.1 diff -u -r1.1 standard.omit.in --- lib/standard.omit.in 29 Jun 2006 15:15:55 - 1.1 +++ lib/standard.omit.in 30 Jun 2006 11:31:51 - @@ -1 +1 @@ -../gnu/test/.*$ +gnu/test/.*java$
Re: [cp-patches] X/Escher peers
On Thu, Jun 29, 2006 at 11:28:52PM +0100, Andrew John Hughes wrote: > I second that. Putting it in external/ would be best, at least until > the distributions pick up on it and start including it in a uniform way. I second that too. But please do it in a way where distros can decide the use the one in external/ or the system installed escher. Michael -- http://www.worldforge.org/
[cp-patches] FYI: Build fix
It seems like I broke the build yesterday. This should fix it. However, it seems that building with Escher lets jikes crash: jikes: symbol.h:1110: bool TypeSymbol::IsInner() const: Assertion `(! IsLocal() && ! Anonymous()) || (IsNested() && ! ACC_STATIC())' failed. It seems to work with ecj, so I blame jikes for this. 2006-06-30 Roman Kennke <[EMAIL PROTECTED]> * lib/Makefile.am: Added Escher dir/jar to classpath when requested. * configure.ac: Moved handling of standard.omit to a place where it actually gets executed. /Roman -- “Improvement makes straight roads, but the crooked roads, without Improvement, are roads of Genius.” - William Blake Index: configure.ac === RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.166 diff -u -1 -2 -r1.166 configure.ac --- configure.ac 29 Jun 2006 15:15:54 - 1.166 +++ configure.ac 30 Jun 2006 10:26:42 - @@ -737,24 +737,30 @@ esac], []) if test "x$ENABLE_LOCAL_SOCKETS" = "xyes" then AC_CHECK_HEADER([sys/un.h]) AC_CHECK_FUNCS([read write bind listen accept shutdown], [], AC_MSG_ERROR([networking support not available])) AC_DEFINE(ENABLE_LOCAL_SOCKETS, [1], [Define to enable support for local sockets.]) fi AM_CONDITIONAL(ENABLE_LOCAL_SOCKETS, test "x$ENABLE_LOCAL_SOCKETS" = "xyes") +# Create standard.omit based on decisions we just made. +cp lib/standard.omit.in lib/standard.omit +if test x$use_escher != xtrue; then + echo gnu/java/awt/peer/x >> lib/standard.omit +fi + dnl --- dnl output files dnl --- AC_CONFIG_FILES([Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile external/relaxngDatatype/Makefile gnu/classpath/Configuration.java gnu/java/security/Configuration.java @@ -799,18 +805,12 @@ tools/gserialver]) AC_CONFIG_COMMANDS([gappletviewer],[chmod 755 tools/gappletviewer]) AC_CONFIG_COMMANDS([gjarsigner],[chmod 755 tools/gjarsigner]) AC_CONFIG_COMMANDS([gkeytool],[chmod 755 tools/gkeytool]) AC_CONFIG_COMMANDS([gjar],[chmod 755 tools/gjar]) AC_CONFIG_COMMANDS([gnative2ascii],[chmod 755 tools/gnative2ascii]) AC_CONFIG_COMMANDS([gserialver],[chmod 755 tools/gserialver]) fi AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh]) AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh]) AC_OUTPUT - -# Create standard.omit based on decisions we just made. -cp lib/standard.omit.in lib/standard.omit -if test x$use_escher != xtrue; then - echo gnu/java/awt/peer/x >> lib/standard.omit -fi Index: lib/Makefile.am === RCS file: /cvsroot/classpath/classpath/lib/Makefile.am,v retrieving revision 1.120 diff -u -1 -2 -r1.120 Makefile.am --- lib/Makefile.am 25 Jun 2006 22:45:27 - 1.120 +++ lib/Makefile.am 30 Jun 2006 10:26:42 - @@ -1,25 +1,25 @@ JAVA_DEPEND = java.dep ## silently try to include these, if it fails gnu make ## will remake these 'makefiles' with the rules given in ## this file and restart the make process again sinclude $(JAVA_DEPEND) propertydirs := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java javax org META-INF -type d ! -name CVS -print) propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java javax org -name \*\.properties -print) metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -type f -print) iconfiles := $(shell cd $(top_srcdir) && $(FIND) gnu/javax/swing/plaf/gtk/icons -name *.png -type f -print) -compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:$(top_srcdir)/external/relaxngDatatype:.:$(USER_CLASSLIB) +compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:$(top_srcdir)/external/relaxngDatatype:.:$(USER_CLASSLIB):$(PATH_TO_ESCHER) # handling source to bytecode compiler programs like gcj, jikes and kjc if FOUND_GCJ ## This should never be used when gcj is the compiler. ## See the compile-classes target. JAVAC = exit 1 else if FOUND_JIKES JAVAC = $(JIKES) $(JIKESWARNINGS) +F $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(compile_classpath) -d . @classes else if FOUND_KJC ## FIXME: from what I can tell, kjc does not support a -encoding option. signature.asc Description: Dies ist ein digital signierter Nachrichtenteil
[cp-patches] FYI: JComponent - more fixes
This patch (committed) adds some more fixes to the JComponent class (I wrote some Mauve tests for these). 2006-06-30 David Gilbert <[EMAIL PROTECTED]> * javax/swing/JComponent.java (registerKeyboardAction(ActionListener, KeyStroke, int): Added API docs, (registerKeyboardAction(ActionListener, String, KeyStroke, int): Add proxy to ActionMap, (setInputMap): Added API docs, (getActionForKeyStroke): Look in all three input maps. By mistake, I've committed the above along with some formatting changes to the TextComponent and TextField classes: 2006-06-30 David Gilbert <[EMAIL PROTECTED]> * java/awt/TextComponent.java: Reformatted source code, * java/awt/TextField.java: Likewise. Regards, Dave Index: java/awt/TextComponent.java === RCS file: /sources/classpath/classpath/java/awt/TextComponent.java,v retrieving revision 1.23 diff -u -r1.23 TextComponent.java --- java/awt/TextComponent.java 14 Jun 2006 19:09:40 - 1.23 +++ java/awt/TextComponent.java 30 Jun 2006 09:29:19 - @@ -1,5 +1,5 @@ /* TextComponent.java -- Widgets for entering text - Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,54 +54,45 @@ import javax.swing.text.AttributeSet; /** - * This class provides common functionality for widgets than - * contain text. - * - * @author Aaron M. Renn ([EMAIL PROTECTED]) - */ + * This class provides common functionality for widgets than + * contain text. + * + * @author Aaron M. Renn ([EMAIL PROTECTED]) + */ public class TextComponent extends Component implements Serializable, Accessible { -/* - * Static Variables - */ - -// Constant for serialization -private static final long serialVersionUID = -2214773872412987419L; + private static final long serialVersionUID = -2214773872412987419L; -/* - * Instance Variables - */ - -/** - * @serial Indicates whether or not this component is editable. - * This is package-private to avoid an accessor method. - */ -boolean editable; + /** + * @serial Indicates whether or not this component is editable. + * This is package-private to avoid an accessor method. + */ + boolean editable; -/** - * @serial The starting position of the selected text region. - * This is package-private to avoid an accessor method. - */ -int selectionStart; + /** + * @serial The starting position of the selected text region. + * This is package-private to avoid an accessor method. + */ + int selectionStart; -/** - * @serial The ending position of the selected text region. - * This is package-private to avoid an accessor method. - */ -int selectionEnd; + /** + * @serial The ending position of the selected text region. + * This is package-private to avoid an accessor method. + */ + int selectionEnd; -/** - * @serial The text in the component - * This is package-private to avoid an accessor method. - */ -String text; + /** + * @serial The text in the component + * This is package-private to avoid an accessor method. + */ + String text; -/** - * A list of listeners that will receive events from this object. - */ -protected transient TextListener textListener; + /** + * A list of listeners that will receive events from this object. + */ + protected transient TextListener textListener; protected class AccessibleAWTTextComponent extends AccessibleAWTComponent @@ -318,360 +309,294 @@ } -/*/ - -/* - * Constructors - */ - -TextComponent(String text) -{ - this.text = text; - this.editable = true; -} - -/*/ - -/* - * Instance Methods - */ -/** - * Returns the text in this component - * - * @return The text in this component. - */ -public synchronized String -getText() -{ - TextComponentPeer tcp = (TextComponentPeer)getPeer(); - if (tcp != null) -text = tcp.getText(); + TextComponent(String text) + { +this.text = text; +this.editable = true; + } - return(text); -} -/*/ + /** + * Returns the text in this component + * + * @return The text in this component. + */ + public synchronized String getText() + { +TextComponentPeer tcp = (TextComponentPeer) getPeer(); +if (tcp != null) + text = tcp.getText(); -/** - * Sets the text in this component to the specified string. - * - * @param text The new text for this component. - */ -public synchronized void -setText(String text) -{ - if (text == null) -text = ""; +return(text); + } - this.text = text; + /** + * Sets the text in this component to the specified string. + * + * @param text The new
Re: [cp-patches] RFA: more TextArea.java fixes
Hi Tania, Tania Bento wrote: Hey, This patch fixes a couple of Harmony's Tests that were failing on Classpath: - In the InsertText and AppendTextMethod, I added the case where peer == null. - In the constructor, if the text specified by the user is null, it should be changed to "". Could someone please approve/comment on this patch so that I can commit it. Thanks, Tania 2006-06-29 Tania Bento <[EMAIL PROTECTED]> *java/awt/TextArea.java (TextArea): If text == null, change it to "". Your ChangeLog entry should identify the actual constructor: (TextArea(String, int, int, int)): If text == null... and I think you left out some of the changes (removed IllegalArgumentException and added new handling for negative rows and columns). (InsertText): Added the case when peer == null. (AppendText): Added the case when peer == null. The case is wrong for these method names in the ChangeLog entry. Index: java/awt/TextArea.java === RCS file: /cvsroot/classpath/classpath/java/awt/TextArea.java,v retrieving revision 1.20 diff -u -r1.20 TextArea.java --- java/awt/TextArea.java 20 Sep 2005 01:05:28 - 1.20 +++ java/awt/TextArea.java 29 Jun 2006 14:34:04 - @@ -187,23 +187,25 @@ */ public TextArea (String text, int rows, int columns, int scrollbarVisibility) { -super (text); +super ((text == null) ? "" : text); My guess is that this can and should be handled by the superclass (TextComponent) since the same problem occurs for the TextField class (which is also a subclass of TextComponent) - I added Mauve tests for the constructors for both classes. You should also update the API docs for all the constructors that accept a String argument to note how a null value is handled. I didn't look at the other part of your patch (insertText, appendText). If you have any doubts, write some Mauve tests... Regards, Dave