Re: [cp-patches] Patch: FYI: implement guessContentTypeFromStream

2006-05-25 Thread Sven de Marothy
On Thu, 2006-05-25 at 11:39 -0600, Tom Tromey wrote:
> I'm submitting this for comment before checking it in.
> 
> This implements URLConnection.guessContentTypeFromStream.  It adds a
> new VMURLConnection class to which the method defers.  The reference
> implementation of this VM class uses 'libmagic' to guess the content
> type; libmagic is part of the 'file' package on Linux systems and
> presents a nice, simple API to this functionality.
> 

Looks good to me. I don't really have any concerns about libmagic. It's
included with all Linux distos I know of (even if isn't in LSB), all BSD
distros I know of and even OS X. 

So short of having no external dependency at all, this is probably as
good as it can get.

/Sven




[cp-patches] FYI: Gtk+ 2.8 patch

2006-05-25 Thread Andrew John Hughes
I'm committing the attached patch to make pkg-config
check for Gtk+ 2.8 rather than 2.4.

Changelog:

2006-05-25  Andrew John Hughes  <[EMAIL PROTECTED]>

* configure.ac:
Make pkg-config check for GTK+ >= 2.8.

-- 
Andrew :-)

Please avoid sending me Microsoft Office (e.g. Word, PowerPoint) attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

If you use Microsoft Office, support movement towards the end of vendor lock-in:
http://opendocumentfellowship.org/petition/

"Value your freedom, or you will lose it, teaches history. 
`Don't bother us with politics' respond those who don't want to learn." 
-- Richard Stallman

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: configure.ac
===
RCS file: /cvsroot/classpath/classpath/configure.ac,v
retrieving revision 1.150
diff -u -3 -p -u -r1.150 configure.ac
--- configure.ac25 May 2006 15:29:35 -  1.150
+++ configure.ac25 May 2006 22:20:18 -
@@ -383,7 +383,7 @@ if test "x${COMPILE_JNI}" = xyes; then
 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
  [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
  [${X_LIBS}])
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
+PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
 PKG_CHECK_MODULES(FREETYPE2, freetype2)
 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
 


signature.asc
Description: Digital signature


Re: [cp-patches] Patch: FYI: implement guessContentTypeFromStream

2006-05-25 Thread Tom Tromey
> "David" == David Daney <[EMAIL PROTECTED]> writes:

David> I don't know if I like the idea of having a dependency on
David> libmagic.  I know that I can still build without it, but how
David> crippled will my system be?  Probably no more than it is now as
David> I don't currently use these methods anyhow.

Yes, one method will not work -- a method which currently does not
work.  (By "not work" I mean it always returns the fallback value.)

David> That probably sounds kind of negative, but it is not meant to.  I
David> think I would prefer a java implementation, but don't really have
David> strong feelings one way or the other.

I'd prefer a java implementation too, I suppose.  However that seemed
like a lot of effort for a single method.

There's also the freedesktop standard in this area.  The existence of
this particular implementation doesn't preclude someone else from
writing another -- either in java, or using xdgmime, or anything else.
In fact, I'd welcome that.

Tom



Re: [cp-patches] Patch: FYI: implement guessContentTypeFromStream

2006-05-25 Thread David Daney

Tom Tromey wrote:

I'm submitting this for comment before checking it in.

This implements URLConnection.guessContentTypeFromStream.  It adds a
new VMURLConnection class to which the method defers.  The reference
implementation of this VM class uses 'libmagic' to guess the content
type; libmagic is part of the 'file' package on Linux systems and
presents a nice, simple API to this functionality.

Please comment.



I don't know if I like the idea of having a dependency on libmagic.  I 
know that I can still build without it, but how crippled will my system 
be?  Probably no more than it is now as I don't currently use these 
methods anyhow.


I can't find libmagic listed in the LSB 3.1 standard, so it may not even 
work on a 'typical' desktop system.


That probably sounds kind of negative, but it is not meant to.  I think 
I would prefer a java implementation, but don't really have strong 
feelings one way or the other.


David Daney



[cp-patches] Re: FYI: GdkGraphics2D rate-limited flushing

2006-05-25 Thread Thomas Fitzsimmons

Hi,

This patch removes the debugging printfs.

Tom

2006-05-25  Thomas Fitzsimmons  <[EMAIL PROTECTED]>

(flush): Remove debugging printfs.
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===
RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.40
diff -u -r1.40 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	25 May 2006 21:13:01 -	1.40
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	25 May 2006 21:19:33 -
@@ -71,9 +71,6 @@
 {
   gdk_threads_enter ();
 
-  cp_gtk_print_current_thread ();
-  g_print ("flush\n");
-
   XFlush (GDK_DISPLAY ());
   flush_scheduled = 0;
 


[cp-patches] FYI: GdkGraphics2D rate-limited flushing

2006-05-25 Thread Thomas Fitzsimmons

Hi,

I ported my rate-limited flushing patch to GdkGraphics2D.  For an 
explanation, see my original post:


http://developer.classpath.org/pipermail/classpath-patches/2006-March/001051.html

The patch makes animations less choppy and painting more efficient.

Tom

2006-05-25  Thomas Fitzsimmons  <[EMAIL PROTECTED]>

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
(schedule_flush): New function.
(end_drawing_operation): Call schedule_flush.
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===
RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.39
diff -u -r1.39 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	25 May 2006 15:29:36 -	1.39
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	25 May 2006 20:59:05 -
@@ -54,6 +54,49 @@
 
 struct state_table *cp_gtk_native_graphics2d_state_table;
 
+/*
+ * 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 ();
+
+  cp_gtk_print_current_thread ();
+  g_print ("flush\n");
+
+  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;
+}
+}
+
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState 
   (JNIEnv *env, jclass clazz)
@@ -331,6 +374,8 @@
 	memcpy (gr->javabuf, gr->javabuf_copy, gr->width * gr->height * 4);
   (*env)->ReleasePrimitiveArrayCritical (env, gr->jarray, gr->javabuf, JNI_COMMIT);
 }
+
+  schedule_flush ();
 }
 
 
@@ -567,8 +612,6 @@
   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);


Re: [cp-patches] FYI: BeanContextSupport child addition

2006-05-25 Thread Andrew John Hughes
On Thu, 2006-05-25 at 21:04 +0100, Paul Jenner wrote:
> Hi Andrew.
> 
> You left the NotImplementedException on avoidingGui(). Shouldn't this be
> removed as it is implemented now?
> 
> Paul
> 
> On Sun, 2006-05-21 at 18:44 +0100, Andrew John Hughes wrote:
> > This also implements some trivial methods regarding the implementation
> > of java.beans.Visibility for the class.
> > 
> > Changelog:
> > 
> > 2006-05-21  Andrew John Hughes  <[EMAIL PROTECTED]>
> > 
> > * java/beans/beancontext/BeanContextSupport.java:
> > (add(Object)): Implement support for the child being
> > a BeanContextChild.
> > (avoidingGui()): Implemented.
> > (dontUseGui()): Likewise.
> > (needsGui()): Likewise.
> > (okToUseGui()): Likewise.
> > 

Yeah, I noticed that the day after :) I just haven't had chance
to remove it.  needsGui() also needs some revision; it's not as
simple as I thought (as the children need to be taken into account).

Thanks,
-- 
Andrew :-)

Please avoid sending me Microsoft Office (e.g. Word, PowerPoint)
attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

If you use Microsoft Office, support movement towards the end of vendor
lock-in:
http://opendocumentfellowship.org/petition/

"Value your freedom, or you will lose it, teaches history.
`Don't bother us with politics' respond those who don't want to learn."
-- Richard Stallman

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }



signature.asc
Description: This is a digitally signed message part


[cp-patches] FYI: FillRect performance demo

2006-05-25 Thread Thomas Fitzsimmons

Hi,

Now that Norman's paperwork has been filed I can commit his FillRect 
paint performance patch.  Let's run this demo before every release so 
that we can track AWT painting performance.


Tom

2006-05-25  Thomas Fitzsimmons  <[EMAIL PROTECTED]>

* examples/gnu/classpath/examples/swing/Demo.java: Add FillRect
paint performance demo.
* examples/gnu/classpath/examples/swing/FillRect.java: New file.
Index: examples/gnu/classpath/examples/swing/Demo.java
===
RCS file: /sources/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v
retrieving revision 1.45
diff -u -r1.45 Demo.java
--- examples/gnu/classpath/examples/swing/Demo.java	18 Apr 2006 20:53:34 -	1.45
+++ examples/gnu/classpath/examples/swing/Demo.java	25 May 2006 20:36:57 -
@@ -156,7 +156,10 @@
 
 examples.add(new JMenuItem(new PopupAction("NavigationFilter",
NavigationFilterDemo.createDemoFactory(;
-
+examples.add(new JMenuItem(new PopupAction("Paint Performance",
+   FillRect.createDemoFactory(;
+
+
 final JMenuItem vmMenu;
 
 help.add(new JMenuItem("just play with the widgets"));
@@ -543,7 +546,10 @@
 panel.add(new JButton(new PopupAction("Tree",
   TreeDemo.createDemoFactory(;
 panel.add(new JButton(new PopupAction("Theme Editor",
-   MetalThemeEditor.createDemoFactory(;
+  MetalThemeEditor.createDemoFactory(;
+panel.add(new JButton(new PopupAction("Paint Performance",
+  FillRect.createDemoFactory(;
+
 JButton exitDisposer = mkDisposerButton(frame);
 panel.add(exitDisposer);
 
Index: examples/gnu/classpath/examples/swing/FillRect.java
===
RCS file: examples/gnu/classpath/examples/swing/FillRect.java
diff -N examples/gnu/classpath/examples/swing/FillRect.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ examples/gnu/classpath/examples/swing/FillRect.java	25 May 2006 20:36:57 -
@@ -0,0 +1,301 @@
+/* FillRect.java - demonstrator for classpath/gcj fillrect performance issue
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+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. */
+
+package gnu.classpath.examples.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/** 
+ * @author Norman Hendrich
+ */
+public class FillRect
+  extends JPanel
+  implements ActionListener 
+{
+
+  static FillRect fillRectDemo;
+
+  LCDCanvas lcd;
+  Worker worker;
+  JLabel label;
+
+  int nx = 64;
+  int ny = 64;
+  int matrix[][], future[][];
+  int generation = 0;
+
+  // 20 msec, or 50 repaints per sec (theoretically)
+  int sleepMillis = 20;
+  longlastMillis = System.currentTimeMillis();
+
+  boolean enableRepaints = true;
+
+  public void actionPerformed(ActionEvent e) 
+  {
+if (e.getActionCommand().equals("CLOSE"))
+{
+  System.exit(0);
+}
+  }
+
+  public FillRect()
+  {
+setSize(64, 64);
+createContent();
+  }
+
+  public void createContent()
+  {
+setLayout(new BorderLayout());
+
+JPanel p = new JPanel(new BorderLayout());
+lcd   = new LCDCanvas();
+label = new JLabel();
+label.setText("paintComponent took 00 msec. (0 fillRect calls)");
+p.add(lcd, BorderLayout.CENTER);
+p.add(label, BorderLayout.SOUTH);
+add(p);
+  }
+
+  public void setSize(int _nx,int _ny )
+  {
+nx = _nx;
+ny = _ny;
+matrix = new int[nx][ny];
+future = new int[nx][ny];
+  }
+
+  public void initFrameContent()
+  {
+JPanel closePanel = new JPanel();
+JButton closeButton = new JButton("Close");
+closeButton.setActionCommand("CLOSE");
+closeButton.addActionListener(this);
+closePanel.add(closeButton);
+add(closePanel, BorderLayout.SOUTH);
+  }
+
+  public void setSleepMillis(int millis)
+  {
+sleepMillis = millis;
+  }
+
+  public class LCDCanvas extends JPanel
+  {
+private int   sx, sy;
+private Color activePixel  = new Color(30, 30, 40);
+priv

[cp-patches] Patch: FYI: implement guessContentTypeFromStream

2006-05-25 Thread Tom Tromey
I'm submitting this for comment before checking it in.

This implements URLConnection.guessContentTypeFromStream.  It adds a
new VMURLConnection class to which the method defers.  The reference
implementation of this VM class uses 'libmagic' to guess the content
type; libmagic is part of the 'file' package on Linux systems and
presents a nice, simple API to this functionality.

Please comment.

Tom

2006-05-25  Tom Tromey  <[EMAIL PROTECTED]>

* configure.ac: Check for magic.h and -lmagic.
* vm/reference/java/net/VMURLConnection.java: New file.
* include/java_net_VMURLConnection.h: New file.
* include/Makefile.am (H_FILES): Add VMURLConnection.h.
($(top_srcdir)/include/java_net_VMURLConnection.h): New target.
* native/jni/java-net/Makefile.am (libjavanet_la_SOURCES):
Mention new file.
(libjavanet_la_LIBADD): Add $(LIBMAGIC).
* native/jni/java-net/java_net_VMURLConnection.c: New file.

Index: configure.ac
===
RCS file: /cvsroot/classpath/classpath/configure.ac,v
retrieving revision 1.149
diff -u -r1.149 configure.ac
--- configure.ac9 May 2006 18:11:13 -   1.149
+++ configure.ac25 May 2006 17:40:12 -
@@ -306,7 +306,8 @@
sys/select.h \
crt_externs.h \
 fcntl.h \
-   sys/mman.h])
+   sys/mman.h \
+   magic.h])
 
   AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define 
to 1 if you have uint32_t]))
   AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, 
[Define to 1 if you have uint32_t]))
@@ -324,6 +325,10 @@
  mmap munmap mincore msync madvise getpagesize sysconf \
  ])
 
+  LIBMAGIC=
+  AC_CHECK_LIB(magic, magic_open, LIBMAGIC=-lmagic)
+  AC_SUBST(LIBMAGIC)
+
   AC_HEADER_TIME
   AC_STRUCT_TM
   AC_STRUCT_TIMEZONE
Index: include/Makefile.am
===
RCS file: /cvsroot/classpath/classpath/include/Makefile.am,v
retrieving revision 1.56
diff -u -r1.56 Makefile.am
--- include/Makefile.am 3 May 2006 20:22:55 -   1.56
+++ include/Makefile.am 25 May 2006 17:40:13 -
@@ -136,6 +136,7 @@
 $(top_srcdir)/include/java_lang_reflect_VMArray.h \
 $(top_srcdir)/include/java_net_VMInetAddress.h \
 $(top_srcdir)/include/java_net_VMNetworkInterface.h \
+$(top_srcdir)/include/java_net_VMURLConnection.h \
 $(top_srcdir)/include/java_nio_VMDirectByteBuffer.h \
 $(top_srcdir)/include/java_nio_MappedByteBufferImpl.h \
 $(top_srcdir)/include/java_util_VMTimeZone.h
@@ -197,6 +198,8 @@
$(JAVAH) -o $@ java.net.VMInetAddress
 $(top_srcdir)/include/java_net_VMNetworkInterface.h: 
$(top_srcdir)/vm/reference/java/net/VMNetworkInterface.java
$(JAVAH) -o $@ java.net.VMNetworkInterface
+$(top_srcdir)/include/java_net_VMURLConnection.h: 
$(top_srcdir)/vm/reference/java/net/VMURLConnection.java
+   $(JAVAH) -o $@ java.net.VMURLConnection
 $(top_srcdir)/include/java_nio_VMDirectByteBuffer.h: 
$(top_srcdir)/vm/reference/java/nio/VMDirectByteBuffer.java
$(JAVAH) -o $@ java.nio.VMDirectByteBuffer
 $(top_srcdir)/include/java_nio_MappedByteBufferImpl.h: 
$(top_srcdir)/java/nio/MappedByteBufferImpl.java
Index: java/net/URLConnection.java
===
RCS file: /cvsroot/classpath/classpath/java/net/URLConnection.java,v
retrieving revision 1.42
diff -u -r1.42 URLConnection.java
--- java/net/URLConnection.java 12 May 2006 20:59:30 -  1.42
+++ java/net/URLConnection.java 25 May 2006 17:40:13 -
@@ -38,7 +38,6 @@
 
 package java.net;
 
-import gnu.classpath.NotImplementedException;
 import gnu.classpath.SystemProperties;
 
 import java.io.IOException;
@@ -971,11 +970,12 @@
* @exception IOException If an error occurs
*/
   public static String guessContentTypeFromStream(InputStream is)
-throws IOException, NotImplementedException
+throws IOException
   {
-// See /etc/gnome-vfs-mime-magic or /etc/mime-magic for a reasonable
-// idea of how to handle this.
-return "application/octet-stream";
+String result = VMURLConnection.guessContentTypeFromStream(is);
+if (result == null)
+  return "application/octet-stream";
+return result;
   }
 
   /**
Index: native/jni/java-net/Makefile.am
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/Makefile.am,v
retrieving revision 1.16
diff -u -r1.16 Makefile.am
--- native/jni/java-net/Makefile.am 17 Apr 2006 00:45:59 -  1.16
+++ native/jni/java-net/Makefile.am 25 May 2006 17:40:14 -
@@ -12,11 +12,12 @@
javanet.h \
java_net_VMInetAddress.c \
java_net_VMNetworkInterface.c \
+   java_net_VMURLConnect

[cp-patches] [generics] Patch: RFC: import jsr166

2006-05-25 Thread Tom Tromey
I'm not checking this in yet.  I wanted comments first.

I haven't yet written a ChangeLog entry.

This patch imports the jsr166 reference implementation.  This is
implements java.util.concurrency.

It consists of several related changes:

* A sanitize-jsr166 script which is run on a pristine download in
  order to remove copyrighted code and to change sun.* references to
  the appropriate gnu.* references.

* A small addition to VMStackWalker to support the above.  The new
  method is written in java so should not cause a big problem.

* Import of the RI code (after running the sanitize script).
  There are a couple minor hand-written changes as well, one to work
  around an apparent ecj bug.
  The upstream code goes in external/jsr166/

* Removal of our versions of some classes provided with the RI:
  AbstractQueue and Queue.

* Addition of a replacement class removed by sanitization,
  CopyOnWriteArrayList.

I'm not including the jsr166 code itself in the appended.  The
resulting patch is simply too big, compressed it is still > 200k.
However, I'm happy to send it if people really want that.

I have not tested the result at all.  Until some VM supports the
Unsafe API, I don't think there is a way to.  I think getting this on
the generics branch is probably the best way to enable VM implementors
to do this.

When this goes in I intend to check in the VMStackWalker to cvs trunk
as well, to keep the VM APIs aligned.

Tom

Index: vm/reference/gnu/classpath/VMStackWalker.java
===
RCS file: 
/cvsroot/classpath/classpath/vm/reference/gnu/classpath/VMStackWalker.java,v
retrieving revision 1.3.2.4
diff -u -r1.3.2.4 VMStackWalker.java
--- vm/reference/gnu/classpath/VMStackWalker.java   27 Nov 2005 21:00:42 
-  1.3.2.4
+++ vm/reference/gnu/classpath/VMStackWalker.java   25 May 2006 15:39:58 
-
@@ -37,6 +37,8 @@
 
 package gnu.classpath;
 
+import java.lang.reflect.Modifier;
+
 /**
  * This class provides access to the classes on the Java stack
  * for reflection and security purposes.
@@ -112,5 +114,39 @@
* is here to work around access permissions.
*/
   public static native ClassLoader getClassLoader(Class cl);
-}
 
+  /**
+   * Perform access checks on a member of a class.  This API is
+   * derived from the public domain code in the JSR 166 reference
+   * implementation.
+   * @param caller the class requesting access to the member
+   * @param declarer the declaring class of the member
+   * @param ignored unknown parameter; always null
+   * @param modifiers the modifiers on the member
+   * @return true if access is granted, false otherwise
+   */
+  public static boolean verifyMemberAccess(Class caller,
+   Class declarer,
+   Object ignored,
+   int modifiers)
+  {
+// Same class, always ok.
+if (caller == declarer)
+  return true;
+// Public access is ok.
+if ((modifiers & Modifier.PUBLIC) != 0)
+  return true;
+// Protected access and request comes from
+// a subclass of the declarer -- ok.
+if ((modifiers & Modifier.PROTECTED) != 0
+&& declarer.isAssignableFrom(caller))
+  return true;
+// Package-private access, or protected access,
+// and the packages are the same --ok.
+if ((modifiers & Modifier.PRIVATE) == 0
+&& caller.getPackage() == declarer.getPackage())
+  return true;
+// Otherwise, no.
+return false;
+  }
+}
Index: external/jsr166/IMPORTING
===
RCS file: external/jsr166/IMPORTING
diff -N external/jsr166/IMPORTING
--- /dev/null   1 Jan 1970 00:00:00 -
+++ external/jsr166/IMPORTING   1 Jan 1970 00:00:00 -
@@ -0,0 +1,28 @@
+The code in this directory comes from the JSR 166
+reference implementation.  The RI consists of a public
+domain part and a part that is copyright Sun.  We remove
+the copyrighted code prior to import so as not to taint
+our source repository.  Also, we slightly modify the
+resulting untainted code so that it does not refer to
+APIs in the sun.* namespace.
+
+To do a new import:
+
+* Download the RI from the source repository.
+  http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java
+  I clicked on the "download tarball" link.
+
+* Unpack the tarball in a fresh directory.
+  mkdir tmp; cd tmp; tar zxvvf .../java.tar.gz
+
+* Clean up the results.
+  .../classpath/scripts/sanitize-jsr166
+
+* Copy the result into this directory and perform the
+  appropriate cvs rm and cvs add operations
+
+* Build the result.
+
+In general we try to avoid divergence from upstream as much
+as possible.  You may need to write new classes or methods in
+order for the build to succeed.
Index: external/jsr166/readme
===
RCS file: external/jsr166/readme
diff -N ext

Re: [cp-patches] RFA: make GdkGraphics2D the default

2006-05-25 Thread Thomas Fitzsimmons

Hi,

Mark Wielaard wrote:

Hi Tom,

On Wed, 2006-05-24 at 18:07 -0400, Thomas Fitzsimmons wrote:
This patch removes GdkGraphics and enables GdkGraphics2D unconditionally 
to provide a Graphics2D implementation on the GTK peers.


I didn't actually read the patch yet, but I quickly tried it out.
Exciting, lots of things now work out if the box!

- I need to port my rate-limited flushing patch from GdkGraphics to 
GdkGraphics2D, for smooth animations.


I noticed a slowdown indeed. For example the Free Swing Demo for the
ProgressBar are terribly slow now and eat up all CPU.


OK, I'll retest before committing my rate-limited flushing patch.



In general things feel slower with this patch, but that might be
subjective. I didn't do any real measurements.


I'll also commit Norman's performance demos today so that we can gauge raw 
drawing speed.





- We need to implement GdkGraphics2D.setXORMode.


Is this what makes the AWT roundrect Demo fail at the moment?


Yes.




- No more fiddling with -Dgnu.java.awt.peer.gtk.Graphics=GdkGraphics2D.

- No more fiddling with --enable-gtk-cairo.

This patch bumps the GTK requirement to 2.8 or greater, which implicitly 
requires Cairo.  This allows us to eliminate the annoying 
-Dgnu.java.awt.peer.gtk.Graphics=GdkGraphics2D and --enable-gtk-cairo 
altogether -- with this patch, if you build the GTK peers, you 
implicitly also build and enable GdkGraphics2D.


Yeah, that seems a very good thing. It warrants a gtk+ version bump
imho.


OK, thanks.  Patch committed.

Tom




Re: [cp-patches] RFA: make GdkGraphics2D the default

2006-05-25 Thread Mark Wielaard
Hi Tom,

On Wed, 2006-05-24 at 18:07 -0400, Thomas Fitzsimmons wrote:
> This patch removes GdkGraphics and enables GdkGraphics2D unconditionally 
> to provide a Graphics2D implementation on the GTK peers.

I didn't actually read the patch yet, but I quickly tried it out.
Exciting, lots of things now work out if the box!

> - I need to port my rate-limited flushing patch from GdkGraphics to 
> GdkGraphics2D, for smooth animations.

I noticed a slowdown indeed. For example the Free Swing Demo for the
ProgressBar are terribly slow now and eat up all CPU.

In general things feel slower with this patch, but that might be
subjective. I didn't do any real measurements.

> - We need to implement GdkGraphics2D.setXORMode.

Is this what makes the AWT roundrect Demo fail at the moment?

> - No more fiddling with -Dgnu.java.awt.peer.gtk.Graphics=GdkGraphics2D.
> 
> - No more fiddling with --enable-gtk-cairo.
> 
> This patch bumps the GTK requirement to 2.8 or greater, which implicitly 
> requires Cairo.  This allows us to eliminate the annoying 
> -Dgnu.java.awt.peer.gtk.Graphics=GdkGraphics2D and --enable-gtk-cairo 
> altogether -- with this patch, if you build the GTK peers, you 
> implicitly also build and enable GdkGraphics2D.

Yeah, that seems a very good thing. It warrants a gtk+ version bump
imho.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part


[cp-patches] Patch: gnu_java_awt_peer_gtk_GtkComponentPeer fix

2006-05-25 Thread Lillian Angel
An exception was being thrown from the awt demo in the RandomTests test.
This is now fixed

2006-05-25  Lillian Angel  <[EMAIL PROTECTED]>

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
(Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked):
Added check to prevent assertion error. If widget->window is 
null, then use the parent widget's window to set the cursor on.

Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,v
retrieving revision 1.62
diff -u -r1.62 gnu_java_awt_peer_gtk_GtkComponentPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c	29 Mar 2006 10:18:27 -	1.62
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c	25 May 2006 14:24:54 -
@@ -204,6 +204,7 @@
 {
   void *ptr;
   GtkWidget *widget;
+  GdkWindow *win;
   GdkCursorType gdk_cursor_type;
   GdkCursor *gdk_cursor;
 
@@ -255,16 +256,20 @@
 }
   
   widget = get_widget(GTK_WIDGET(ptr));
-
+  
+  win = widget->window;
+  if ((widget->window) == NULL)
+win = GTK_WIDGET(ptr)->window;
+
   if (image == NULL)
 gdk_cursor = gdk_cursor_new (gdk_cursor_type);
   else
 gdk_cursor
-  = gdk_cursor_new_from_pixbuf (gdk_drawable_get_display (widget->window),
+  = gdk_cursor_new_from_pixbuf (gdk_drawable_get_display (win),
 cp_gtk_image_get_pixbuf (env, image),
 x, y);
 
-  gdk_window_set_cursor (widget->window, gdk_cursor);
+  gdk_window_set_cursor (win, gdk_cursor);
   gdk_cursor_unref (gdk_cursor);
 
   /* Make sure the cursor is replaced on screen. */


[cp-patches] RFC: java.io.ObjectStreamConstants documented

2006-05-25 Thread Carsten Neumann

Hi,

if this is accepted, could someone with CVS write access please commit it,

Thanks,
Carsten

ChangeLog (also attached):

2006-05-25  Carsten Neumann  <[EMAIL PROTECTED]>

* java/io/ObjectStreamConstants.java: Added API docs.
Index: java/io/ObjectStreamConstants.java
===
RCS file: /sources/classpath/classpath/java/io/ObjectStreamConstants.java,v
retrieving revision 1.15
diff -u -r1.15 ObjectStreamConstants.java
--- java/io/ObjectStreamConstants.java	21 May 2006 20:53:14 -	1.15
+++ java/io/ObjectStreamConstants.java	25 May 2006 12:41:17 -
@@ -50,8 +50,6 @@
  */
 public interface ObjectStreamConstants
 {
-  // FIXME: Javadoc comment these values.
-  
   /** 
* The serialization stream protocol version 1. This version was
* the default serialization protocol before JDK 1.2.
@@ -70,39 +68,160 @@
*/
   int PROTOCOL_VERSION_2 = 2;
 
+  /**
+   * The magic number that is written as part of the stream header.
+   */
   short STREAM_MAGIC = (short)0xaced;
+  
+  /**
+   * The stream version number that is written as part of the stream header.
+   * Note that this is different from the protocol version that specifies
+   * the data format for the stream.
+   */
   short STREAM_VERSION = 5;
 
+  /**
+   * Token value to designate a null reference in the stream.
+   */
   byte TC_NULL = (byte)112;//0x70
+  
+  /**
+   * Token value to designate a reference to an already serialized object.
+   */
   byte TC_REFERENCE = (byte)113;   //0x71
+  
+  /**
+   * Token value to designate a class descriptor is next in the stream.
+   */
   byte TC_CLASSDESC = (byte)114;   //0x72
+  
+  /**
+   * Token value to designate a new object is next in the stream. 
+   */
   byte TC_OBJECT = (byte)115;  //0x73
+  
+  /**
+   * Token value to designate a new string is next in the stream.
+   */
   byte TC_STRING = (byte)116;  //0x74
+  
+  /**
+   * Token value to designate a new array is next in the stream.
+   */
   byte TC_ARRAY = (byte)117;   //0x75
+  
+  /**
+   * Token reference to designate a reference to a class.
+   */
   byte TC_CLASS = (byte)118;   //0x76
+  
+  /**
+   * Token value to designate a block of primitive data is next in the stream.
+   * The next byte in the stream holds the size of the block (in bytes).
+   */
   byte TC_BLOCKDATA = (byte)119;   //0x77
+  
+  /**
+   * Token value to designate the end of a block of primitve data.
+   */
   byte TC_ENDBLOCKDATA = (byte)120;//0x78
+  
+  /**
+   * Token value to designate a reset of the stream state.
+   */
   byte TC_RESET = (byte)121;   //0x79
+  
+  /**
+   * Token value to designate a long block of primitive data is next in the
+   * stream. The next long in the stream holds the size of the block
+   * (in bytes). 
+   */
   byte TC_BLOCKDATALONG = (byte)122;   //0x7A
+  
+  /**
+   * Token value to designate an exception occured during serialization.
+   */
   byte TC_EXCEPTION = (byte)123;   //0x7B
+  
+  /**
+   * Token value to designate a long string is next in the stream.
+   */
   byte TC_LONGSTRING = (byte)124;  //0x7C
+  
+  /**
+   * Token value to designate a proxy class descriptor is next in the stream.
+   */
   byte TC_PROXYCLASSDESC = (byte)125;  //0x7D
-  byte TC_ENUM = (byte)126;//0x7E
 
+  /**
+   * Token value to designate an enum constant is next in the stream.
+   * 
+   * @since 1.5
+   */
+  byte TC_ENUM = (byte)126;//0x7E
+  
+  /**
+   * The first token value.
+   */
   byte TC_BASE = TC_NULL;
+  
+  /**
+   * The last token value.
+   */
   byte TC_MAX = TC_ENUM;
 
+  /**
+   * The first handle that will be assigned to an object, for later references.
+   */
   int baseWireHandle = 0x7e;
 
+  /**
+   * Flag used in ObjectStreamClass to designate that the class
+   * defines the writeObject method.
+   */
   byte SC_WRITE_METHOD = 0x01;
+  
+  /**
+   * Flag used in ObjectStreamClass to designate that the class
+   * is serializeable.
+   */
   byte SC_SERIALIZABLE = 0x02;
+  
+  /**
+   * Flag used in ObjectStreamClass to designate that the class
+   * is externalizable.
+   */
   byte SC_EXTERNALIZABLE = 0x04;
+  
+  /**
+   * Flag used in ObjectStreamClass to designate that
+   * externalizable data is written in block data mode.
+   * 
+   * @since 1.2
+   */
   byte SC_BLOCK_DATA = 0x08;
   byte SC_ENUM = 0x10;
 
+  /**
+   * Flag used in ObjectStreamClass to designate that the class
+   * is an enum constant.
+   * 
+   * @since 1.5
+   */
+  byte SC_ENUM = 0x10;
+  
+  /**
+   * Constant for use with a SecurityManager to check if
+   * substitution of objects is allowed.
+   */
   SerializablePermission SUBSTITUTION_PERMISSION
 = new SerializablePermission("enableSubstitution");
 
+  /**
+   * Constant for use with a SecurityManager to check if
+   * overriding of the writeObject and readObject
+

[cp-patches] FYI:BasicTreeUI.TreeCancelEditingAction

2006-05-25 Thread Audrius Meskauskas

2006-05-25  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * javax/swing/plaf/basic/BasicTreeUI.java (TreeCancelEditingAction):
   Implemented.
Index: BasicTreeUI.java
===
RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.138
diff -u -r1.138 BasicTreeUI.java
--- BasicTreeUI.java	16 May 2006 18:57:33 -	1.138
+++ BasicTreeUI.java	25 May 2006 08:45:03 -
@@ -2591,42 +2591,31 @@
   }
 
   /**
-   * ActionListener that invokes cancelEditing when action performed.
+   * The action to cancel editing on this tree.
*/
   public class TreeCancelEditingAction
   extends AbstractAction
   {
-
 /**
- * Constructor
+ * Creates the new tree cancel editing action.
+ * 
+ * @param name the name of the action (used in toString).
  */
 public TreeCancelEditingAction(String name)
-throws NotImplementedException
 {
-  // TODO: Implement this properly.
+  super(name);
 }
 
 /**
- * Invoked when an action occurs.
+ * Invoked when an action occurs, cancels the cell editing (if the
+ * tree cell is being edited). 
  * 
  * @param e event that occured
  */
 public void actionPerformed(ActionEvent e)
-throws NotImplementedException
 {
-  // TODO: Implement this properly.
-}
-
-/**
- * Returns true if the action is enabled.
- * 
- * @return true if the action is enabled, false otherwise
- */
-public boolean isEnabled()
-throws NotImplementedException
-{
-  // TODO: Implement this properly.
-  return false;
+  if (isEnabled() && tree.isEditing())
+tree.cancelEditing();
 }
   }