Re: [cp-patches] GNU Classpath

2012-10-20 Thread Roman Kennke
Am Samstag, den 20.10.2012, 10:03 +0100 schrieb Chris Burdess:
 Mario Torre wrote:
  No.  Updating the ChangeLog is a requirement.
 
  Maybe it's a requirement, but to be honest, is also a very redundant piece 
  of information that is already in the commit log,
 
 The commit log is not part of the package. People may want to download 
 the package and see who the contributors were and when; the ChangeLog is 
 a long established convention for them to do this.

I don't get it. All of the information of the Changelog is also in the
commit history, and if it isn't, it's only a matter of convention to put
it there. Then, when doing a release, it should be a matter of a simple
script to create a ChangeLog in whatever format is required and put it
in the package (I am sure there are existing scripts that accomplish
exactly this out there). *All* of it can be automated, and it makes
branching, merging, etc much easier, especially in the face of
distributed VCSs.

Roman





Re: [cp-patches] FYI: Fix for PR34991

2009-01-07 Thread Roman Kennke
Hi,

  -draw(new Polygon(xPoints, yPoints, nPoints));
  +for (int i = 1; i  nPoints; i++)
  +  draw(new Line2D.Double(xPoints[i - 1], yPoints[i - 1],
  + xPoints[i], yPoints[i]));
  
  Hi Robert,
  
  Line2D instances are mutable (via setLine() methods) so you could save some 
  garbage here by creating one Line2D instance and reusing it within the 
  loop...
 
 There's even a class to help with that: gnu.java.awt.java2d.ShapeCache.

Forget it. This doesn't make sense...

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [GCJ] Performance of GUI applications on embedded systems

2008-11-03 Thread Roman Kennke
Hi,

  The problem is that the program is spending almost all of the time
  generating stack traces, millions and millions of them.
 
 And one reason for that is pointless class lookups in
 the GTK peer code.
 
 Look at this:
 
 Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning
 (JNIEnv *env, jobject obj __attribute__((unused)), jint rightGlyph, jint 
 leftGlyph, jlong fnt)
 {
   ...
 
   cls = (*env)-FindClass (env, java/awt/geom/Point2D$Double);
   method = (*env)-GetMethodID (env, cls, init, (DD)V);
   return (*env)-NewObjectA(env, cls, method, values);
 }
 
 Now, this method only returns a pair of points, and it would have been
 trivial to pass a 2-element array into it, fill, with x and y, and
 return the same array.  But no, we do a class lookup on
 java/awt/geom/Point2D$Double and call its constructor with two
 double values.

Or we could cache the MIDs and FIDs, like is recommended in all good JNI
books.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




Re: GTK+ peers on DirectFB (instead of Xorg)

2008-10-17 Thread Roman Kennke
Hi Francesco,

 is there a way to build GNU Classpath with Gtk peers being usable with
 DirectFB backend (instead of Xorg/X11)?

There's some X11 specific code in the GTK peers. You would have to get
rid of this. Besides this, it should be possible. It's some work though.

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [Fwd: Problem with AWT/Swing code]

2008-10-16 Thread Roman Kennke
Hi there,


The code looks like it should run into a loop. At the beginning you post
an InvocationEvent with the Runnable, then inside the runnable, you post
another InvocationEvent with the same runnable, so this runs into a
loop, swamping the event queue, and thus preventing Swing from doing
anything. The reason why this works on JDK is that JDK reorganizes the
events it gets, so probably a paint event gets executed in between.
However, this is not something that an application should assume.

What is this code supposed to do anyway? Why are you doing invokeLater()
inside the runnable? This doesn't sound like a good idea at all. If you
want to perform period tasks, I strongly recommend javax.swing.Timer.

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: Other class libraries

2008-06-24 Thread Roman Kennke
Hi Andrew,

 Since OpenJDK has been released, I've noticed that a tendency has
 arisen to not treat
 that codebase with the same 'don't look if working on the same code'
 approach we had
 when it was proprietary.  When working on GNU Classpath, we still need
 to be careful
 about cross-pollination between codebases, even though the OpenJDK
 class libraries
 are under (nearly) the same license.
 
 This also applies for other class libraries, namely Harmony's.

So where is the boundary? I already spent significant time studying
OpenJDK's code, in the graphics area (as part of my Challenge project)
as well as several other areas. Am I disqualified now as GNU Classpath
contributor? (Not that I contributed much in the last weeks, but
still...) You are 'walking the line' then too, with the CPStringBuilder
effort (I think this has been 'inspired' by OpenJDK iirc), and as part
of your Challenge project you are also studying a lot of OpenJDK code I
suppose.

Do we have any strong criteria by which we can measure which
contribution can go in and which can't?

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: Savannah has Mercurial!

2008-06-06 Thread Roman Kennke
Hi Andrew,

 I just noticed this announcement when submitting the news announcement
 for 0.97.2.
 
 What do people think to the idea of switching?  Maybe post 0.98?

As soon as possible. IMO.

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: Savannah has Mercurial!

2008-06-06 Thread Roman Kennke
Hi Andrew,

  What do people think to the idea of switching?  Maybe post 0.98?
 
 Mercurial is a disaster as far as I can see.  It doesn't seem to be
 possible to work locally and merge back into the trunk without having
 to do a complex and error-prone three-way merge, and several times
 I've got into a state that it was impossible to recover from, even
 with the help of the best Mercurial experts we have at RH.  The only
 way people work successfully is to merge from trunk, check in, and
 then push their changes immediately to the mater repo before someone
 else does any updates to the same files.  If you don't get in fast
 enough, merge time.  This approach doesn't scale at all.

I disagree. I think this impression stems from the attempt to map CVS
development behaviour to Mercurial (or any other DVCS). I think the way
that HG handles this is conceptionally better than CVS. Think about it:

Developer A and B both clone the repository at Changeset (CS) 1. Both
make changes and end try to push them back. We end up with:

 /-2
1
 \-3

This needs to be merged, no matter if the changes are disjoint or not.
Merging disjoint changes is easily done automatically. Now you could
argue that CVS does this automatically when committing. I argue that
this is not a good idea, because even disjoint changes might lead to a
broken tree (although it doesn't happen that often in a well-structured
project like Classpath. But I've run into it several times). Even worse,
with CVS you basically loose some in-between information (one of the CSs
automatically get merged, while with HG you retain all the changesets
and get one additional merge CS).

The problem you describe occurs when too many people work on one
'trunk'. Then it is possible that you run into a kind of race. E.g. you
try to push and get aborted because somebody else pushed in between. You
do fetch (which is a great help for such situations instead of pull 
update  merge  commit), and try to push again and fail again, because
again, somebody has pushed stuff. I agree, that this kind of development
doesn't scale beyond a handful of developers.

I see two practical solutions to that. A project with so many developers
should be structured on the level of the VCS. AFAICS, there are two
reasonable approaches to that:

1. the almost-anarchistic Linux kernel model: Every core developer (or
maintainer) basically maintains his own public tree and pulls all the
changes he cares about from somewhere else (mailing lists, other repos,
etc). The release is rolled from one of those trees (Linus' tree in the
case of the kernel).
2. A hierarchical model like Sun does for OpenJDK. Developers never push
to the master repository, but instead work in their group repository.
This decreases the size of each group to a reasonable level, thus
avoiding the above problem to a great degree. Pushing then means to do
hg fetch  hg push. A maintainer guy then pulls all the changes into
the master tree on a regular basis, at which point only disjoint CSs are
merged, and he can be reasonable certain that the thing ends up in a
consistent way (because the groups have reasonable stable interfaces
against each other). As a bonus, the maintainer guy should run a test
before pushing the stuff to the master repo.


  I wouldn't object (although I don't really have trouble with CVS at this
  point with classpath). So if enough developers think it is a positive
  switch lets do it. We would be the second project on savannah though, so
  expect some first adopter issues.
 
  The only thing we have to really look out for is doing a good
  conversion, some experimentation with hg convert and/or tailor might be
  necessary.

I think both tailor and hg convert are pretty good and yield reasonable
results for large-scale conversions. I think tailor is a little more
stable. I did conversion of Jamaica using tailor and had no problems so
far. It makes sense to use username mapping, if you want full usernames
instead of the CVS shorts.

  Also a better understanding (best practices for) release branches would
  be nice. I found the in-tree branching of mercurial somewhat confusing
  at times, so it would be good to make sure we have clear guidelines for
  those who want to do (release) branches on the tree would be nice.

I prefer separate trees for branches. In-tree branches are only
confusing and don't make so much sense. Same for tags. In my experience,
trying to map CVS behaviour in this respect is only confusing and
creates the impression that HG is in some way not mature. I had a lot of
trouble in the autobuild infrastructure of Jamaica, which sets and
deletes tags, and found that using clones for that is the only
reasonable solution, because a shell script cannot reliably merge things
(like tags and branches).

Cheers, Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe

Re: Savannah has Mercurial!

2008-06-06 Thread Roman Kennke
 is a pretty reasonable backup solution, so...

Cheers, Roman
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




Re: Savannah has Mercurial!

2008-06-06 Thread Roman Kennke
, then it pops up kdiff3 or
whatever tool it finds to let you merge manually.

  I don't consider automatic merging at push-time a feature. You
  cannot even get back to the state to where you have been before
  committing, because CVS and SVN don't bother to separate your
  changeset from the actual merge. I know, this is not a big deal in
  almost all situations, mostly because we got used to handle this,
  but again, HG appears to be more explicit about what happens.
 
 I don't want automatic merging at push-time.  I *do* want automatic
 merging of trunk with the changes I have committed locally when I
 pull, and if there are no real conflicts I want a subsequent push to
 work.

I understand. What exactly was the original problem then? hg fetch does
exactly this. The only thing I see is that another developer _might_
have pushed his own changes while you merge, which is usually easily
fixed by doing hg fetch again. BTW: The same usually happens with all
other VCSes too, at least when ChangeLog files are involved ;-)

  The problem with Mercurial is that its main advantage, that of
  being distributed, is much less of a big deal than the basic
  day-to-day business of commits, merges, branches and so on, almost
  all of which AFAICS it does worse than svn.  Even when I was new to
  CVS (and svn) I never managed to get into a state where I had to
  abandon my changes and start again.
 
  Frankly, I've never managed to get into such a state with HG either. In
  my experience, HG does the basic things like commit, merge, branches,
  etc just right.
 
 Well, I know it's possible in theory, but I also know what happens
 when I try.  And I've been around this in IRC, where I explain the
 simple thing I've been trying to do, the fact it doesn't work, and
 no-one has any clue how to repair the situation.  I suspect that most
 of the icedtea developers solve this problem simply by not doing local
 hg operations at all.  It would be interesting to ask icedtea
 developers just how much they use hg to do local develeopment.

Eh. Is there anyway to interact with Mercurial other than locally? I
don't think all the developers log into the server, and do all the work
directly in the master repo. Infact, I think this is not possible at
all, technically.


  Any developer can create a branch any time they like, and work on
  that branch as though it were their own repo, all changes are
  tracked, and everything is safely backed up.  Also, everyone gets
  to see and share the work on the branch.
 
  Cool. This seems to map perfectly with a distributed model then ;-)
 
 I have no idea what you mean by this.  There seems to be a world of
 difference between multiple repos all over the place and a single tree
 with branches, tags, and so on.

Ok, I think I misunderstood something. Yes, having things all in one
location is sweet. Infact, it is quite easy (and makes a lot of sense)
to mimic Subversion: Simply create a directory structure on the server
with trunk/, branches/ and tags/ in it, and clone the stuff for
branching and tagging. Yes, I consider tags and in-tree branches broken
in HG, and would strongly recommend to use clones for all that.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] FYI: PixelInterleavedSampleModel fix

2008-02-21 Thread Roman Kennke
This fixes an issue with the PixelInterleavedSampleModel that I noticed
while playing with OpenJDK's ImageIO and GNU Classpath. In
createCompatibleSampleModel, we need to adjust the scanline stride for
the new width, otherwise we only get garbage pixels, and we can optimize
the band offsets a little.

2008-02-21  Roman Kennke  [EMAIL PROTECTED]

* java/awt/image/PixelInterleavedSampleModel.java
(createCompatibleSampleModel): Adjust scanline stride for new
width and optimize band offsets.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/image/PixelInterleavedSampleModel.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/image/PixelInterleavedSampleModel.java,v
retrieving revision 1.3
diff -u -1 -0 -r1.3 PixelInterleavedSampleModel.java
--- java/awt/image/PixelInterleavedSampleModel.java	2 Jul 2005 20:32:36 -	1.3
+++ java/awt/image/PixelInterleavedSampleModel.java	21 Feb 2008 10:45:19 -
@@ -62,23 +62,48 @@
   /**
* Creates a new codeSampleModel/code that is like this one, but
* uses the specified width and height.
*
* @param width the number of pixels in the horizontal direction.
*
* @param height the number of pixels in the vertical direction.
*/
   public SampleModel createCompatibleSampleModel(int width, int height)
   {
+// Find minimum band offset.
+int minBandoff = bandOffsets[0];
+int numBands = bandOffsets.length;
+for (int i = 1; i  numBands; i++)
+  {
+if (bandOffsets[i]  minBandoff)
+  {
+minBandoff = bandOffsets[i];
+  }
+  }
+// Adjust band offsets so that minimum offset is at 0.
+int[] bandOff;
+if (minBandoff  0)
+  {
+bandOff = new int[numBands];
+for (int i = 0; i  numBands; i++)
+  {
+bandOff[i] = bandOffsets[i] - minBandoff;
+  }
+  }
+else
+  {
+bandOff = bandOffsets;
+  }
+// Adjust scanline stride for new width.
 return new PixelInterleavedSampleModel(dataType, width, height,
-   pixelStride, scanlineStride,
-   bandOffsets);
+   pixelStride, pixelStride * width,
+   bandOff);
   }
 
 
   /**
* Creates a new codeSampleModel/code that is like this one, but
* uses only a subset of its bands.
*
* @param bands an array whose elements indicate which bands shall
* be part of the subset. For example, code[0, 2, 3]/code would
* create a SampleModel containing bands #0, #2 and #3.


[commit-cp] classpath java/awt/image/PixelInterleavedSample...

2008-02-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/21 10:48:16

Modified files:
java/awt/image : PixelInterleavedSampleModel.java 
.  : ChangeLog 

Log message:
2008-02-21  Roman Kennke  [EMAIL PROTECTED]

* java/awt/image/PixelInterleavedSampleModel.java
(createCompatibleSampleModel): Adjust scanline stride for new
width and optimize band offsets.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/image/PixelInterleavedSampleModel.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9516r2=1.9517




Re: brandweg hacking session on friday

2008-02-19 Thread Roman Kennke
Hi there,


I will arrive in Brussels around 17:00, could be around 1 hour or so
later.

 Should we meet at the BXL at Grand Place from 5pm on?

Sounds fine.


  I take it that someone has a laptop or something, if we want this to
  be a practical session?
 
 Sure, I'll bring mine along, and a checkout of the classpath, openjdk 
 and brandweg trees. ;)

Yeah, I also come with laptop.

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] FYI: XGraphics2D fix

2008-02-18 Thread Roman Kennke
This fixes XGraphics2D:
- The rgb variable must be updated to receive the actual computed RGB
value, otherwise translucent images are not drawn correctly.
- Translucent images must not be cached, because we never know how their
background changes.

2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XGraphics2D.java
(rawDrawImage): Update the rgb variable correctly. Don't
cache translucent images.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.7
diff -u -1 -0 -r1.7 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java	20 Sep 2007 14:01:08 -	1.7
+++ gnu/java/awt/peer/x/XGraphics2D.java	18 Feb 2008 10:59:56 -
@@ -406,28 +406,30 @@
  + (255 - alpha) * zpixmap.get_red(xx, yy);
 red = red / 255;
 int green = 0xff  (rgb  8);
 green = green * alpha
+ (255 - alpha) * zpixmap.get_green(xx, yy);
 green = green / 255;
 int blue = 0xff  rgb;
 blue = blue * alpha
 + (255 - alpha) * zpixmap.get_blue(xx, yy);
 blue = blue / 255;
+rgb = red  16 | green  8 | blue;
   }
 // else keep rgb value from source image.
 
 zpixmap.set(xx, yy, rgb);
   }
   }
 xdrawable.put_image(xgc, zpixmap, x, y);
-imageCache.put(image, zpixmap);
+// We can't cache prerendered translucent images, because
+// we never know how the background changes.
   }
 ret = true;
   }
   }
 else
   {
 ret = super.rawDrawImage(image, x, y, obs);
   }
 return ret;
   }


[cp-patches] FYI: RGBImageFilter

2008-02-18 Thread Roman Kennke
I noticed that the gray filter (javax.swing.GrayFilter) doesn't work.
Seems like a problem in RGBImageFilter. This patch should fix it.

2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* java/awt/image/RGBImageFilter.java
(setPixels): Don't mask the source pixel.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/image/RGBImageFilter.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/image/RGBImageFilter.java,v
retrieving revision 1.14
diff -u -1 -0 -r1.14 RGBImageFilter.java
--- java/awt/image/RGBImageFilter.java	22 Nov 2006 15:18:32 -	1.14
+++ java/awt/image/RGBImageFilter.java	18 Feb 2008 14:20:01 -
@@ -238,21 +238,21 @@
 consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize);
   }
 else
   {
 int[] filtered = new int[w];
 int index = offset;
 for (int yp = 0; yp  h; yp++)
   {
 for (int xp = 0; xp  w; xp++)
   {
-filtered[xp] = model.getRGB((pixels[index]  0xff));
+filtered[xp] = model.getRGB((pixels[index]));
 index++;
   }
 index += scansize - w;
 filterRGBPixels(x, y + yp, w, 1, filtered, 0, w);
   }
   }
   }
 
   /**
* Filters a single pixel from the default ColorModel.


[cp-patches] FYI: Escher peer image handling

2008-02-18 Thread Roman Kennke
I improved the image handling in the Escher peers to support
asynchronous image loading. It is possible to pass an ImageProducer into
Toolkit.createImage() that loads the image asynchronously, i.e. in
another thread. For such ImageProducers, the resulting image must not be
null, but a kind of asynchronous wrapper. I introduced the AsyncImage
class in gnu.java.awt.image, together with an ImageConverter (an
ImageConsumer that creates a new BufferedImage instance) class. IMO, the
GTK peers should also use this implementation. (Now they use their own
AsyncImage - from which this new version is derived - but which is very
much inferior to the new).

2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/image/AsyncImage.java: New file. Implements
asynchronous image loading.
* gnu/java/awt/image/ImageConverter.java: New file.
An image consumer that creates a concrete image with
asynchronous behaviour.
* gnu/java/awt/peer/x/ImageConverter.java: Removed.
* gnu/java/awt/peer/x/XToolkit.java:
(createImage(ImageProducer)): Use new ImageConverter.
* gnu/java/awt/peer/x/XGraphics2D.java:
(rawDrawImage): Unwrap AsyncImages before painting.
(unwrap): New helper method.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/image/AsyncImage.java
===
RCS file: gnu/java/awt/image/AsyncImage.java
diff -N gnu/java/awt/image/AsyncImage.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ gnu/java/awt/image/AsyncImage.java	18 Feb 2008 19:43:40 -
@@ -0,0 +1,300 @@
+/* AsyncImage.java -- Loads images asynchronously
+   Copyright (C) 2008 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.image;
+
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.image.ImageConsumer;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Supports asynchronous loading of images.
+ */
+public class AsyncImage
+  extends Image
+{
+
+  /**
+   * The image source for AsyncImages.
+   */
+  private class AsyncImageSource
+implements ImageProducer
+  {
+/**
+ * The real image source, if already present, or codenull/code
+ * otherwise.
+ */
+private ImageProducer realSource;
+
+public void addConsumer(ImageConsumer ic)
+{
+  startProduction(ic);
+}
+
+public boolean isConsumer(ImageConsumer ic)
+{
+  return false;
+}
+
+public void removeConsumer(ImageConsumer ic)
+{
+  // Nothing to do here.
+}
+
+public void requestTopDownLeftRightResend(ImageConsumer ic)
+{
+  startProduction(ic);
+}
+
+public void startProduction(ImageConsumer ic)
+{
+  ImageProducer ip = getRealSource();
+  if (ip == null)
+{
+  ic.setDimensions(1, 1);
+  ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
+}
+  else

[cp-patches] FYI: XGraphics2D opaque rendering

2008-02-18 Thread Roman Kennke
This introduces a system property in XGraphics2D, which turns on opaque
image rendering for all images, even translucent ones. This is intended
for debugging and demostration purposes only.

2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XGraphics2D.java
(RENDER_OPAQUE): New constant with system property to
turn on opaque image rendering.
(rawDrawImage): Render images opaque when system property
is set. This is for demonstration and debugging purposes only.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.9
diff -u -1 -0 -r1.9 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java	18 Feb 2008 19:45:48 -	1.9
+++ gnu/java/awt/peer/x/XGraphics2D.java	18 Feb 2008 19:59:38 -
@@ -63,20 +63,28 @@
 import gnu.x11.Colormap;
 import gnu.x11.Drawable;
 import gnu.x11.GC;
 import gnu.x11.image.ZPixmap;
 
 public class XGraphics2D
   extends AbstractGraphics2D
 {
 
   /**
+   * When this property is set to true, then images are always rendered as
+   * opaque images, ignoring their translucence. This is intended for
+   * debugging and demonstration purposes.
+   */
+  private static final boolean RENDER_OPAQUE =
+Boolean.getBoolean(escherpeer.renderopaque);
+
+  /**
* The X Drawable to draw on.
*/
   private Drawable xdrawable;
 
   /**
* The X graphics context (GC).
*/
   private GC xgc;
 
   /**
@@ -362,21 +370,21 @@
 else
   {
 int transparency = bi.getTransparency();
 int w = bi.getWidth();
 int h = bi.getHeight();
 if (imageCache.containsKey(image))
   {
 ZPixmap zpixmap = imageCache.get(image);
 xdrawable.put_image(xgc, zpixmap, x, y);
   }
-else if (transparency == Transparency.OPAQUE)
+else if (transparency == Transparency.OPAQUE || RENDER_OPAQUE)
   {
 XGraphicsDevice gd = XToolkit.getDefaultDevice();
 ZPixmap zpixmap = new ZPixmap(gd.getDisplay(), w, h);
 for (int yy = 0; yy  h; yy++)
   {
 for (int xx = 0; xx  w; xx++)
   {
 int rgb = bi.getRGB(xx, yy);
 zpixmap.set(xx, yy, rgb);
   }


[commit-cp] classpath ChangeLog gnu/java/awt/peer/x/XGraphi...

2008-02-18 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/18 11:00:53

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/x: XGraphics2D.java 

Log message:
2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XGraphics2D.java
(rawDrawImage): Update the rgb variable correctly. Don't
cache translucent images.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9510r2=1.9511
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics2D.java?cvsroot=classpathr1=1.7r2=1.8




[commit-cp] classpath java/awt/image/RGBImageFilter.java Ch...

2008-02-18 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/18 14:23:51

Modified files:
java/awt/image : RGBImageFilter.java 
.  : ChangeLog 

Log message:
2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* java/awt/image/RGBImageFilter.java
(setPixels): Don't mask the source pixel.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/image/RGBImageFilter.java?cvsroot=classpathr1=1.14r2=1.15
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9511r2=1.9512




[commit-cp] classpath ChangeLog gnu/java/awt/peer/x/XGraphi...

2008-02-18 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/18 19:45:49

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/x: XGraphics2D.java XToolkit.java 
Added files:
gnu/java/awt/image: AsyncImage.java ImageConverter.java 
Removed files:
gnu/java/awt/peer/x: ImageConverter.java 

Log message:
2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/image/AsyncImage.java: New file. Implements
asynchronous image loading.
* gnu/java/awt/image/ImageConverter.java: New file.
An image consumer that creates a concrete image with
asynchronous behaviour.
* gnu/java/awt/peer/x/ImageConverter.java: Removed.
* gnu/java/awt/peer/x/XToolkit.java:
(createImage(ImageProducer)): Use new ImageConverter.
* gnu/java/awt/peer/x/XGraphics2D.java:
(rawDrawImage): Unwrap AsyncImages before painting.
(unwrap): New helper method.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9513r2=1.9514
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/image/AsyncImage.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/image/ImageConverter.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics2D.java?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XToolkit.java?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/ImageConverter.java?cvsroot=classpathr1=1.1r2=0




[commit-cp] classpath gnu/java/awt/peer/x/XGraphics2D.java ...

2008-02-18 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/18 20:00:19

Modified files:
gnu/java/awt/peer/x: XGraphics2D.java 
.  : ChangeLog 

Log message:
2008-02-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XGraphics2D.java
(RENDER_OPAQUE): New constant with system property to
turn on opaque image rendering.
(rawDrawImage): Render images opaque when system property
is set. This is for demonstration and debugging purposes only.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics2D.java?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9514r2=1.9515




Re: [cp-patches] RFC: Abstract StringBuilder and StringBuffer

2008-02-17 Thread Roman Kennke
Hi Robert,

  public final class StringBuilder
  +  extends AbstractStringBuffer
 StringBuffer and StringBuilder have Object as their superclass. I think
 we are not allowed to break that. If so you should change your
 implementation to follow a delegation pattern and make as many methods
 'final' as possible. :)

That doesn't matter as long as the superclass isn't public. JavaDoc
should document it as extends Object in this case. IIRC, OpenJDK also
implements this via an abstract superclass.

/Roman

-- 
http://kennke.org/blog/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] FYI: ICC_Profile fix

2008-02-12 Thread Roman Kennke
In ICC_Profile.getInstance(), the method
InputStream.read(byte[],int,int) is called. But only once. The correct
way is to call it in a loop until the buffer is fully read. An
InputStream implementation is free to fill only a part of a buffer.

2008-02-12  Roman Kennke  [EMAIL PROTECTED]

* java/awt/color/ICC_Profile.java
(getInstance()): Wrap call to InputStream.read(byte[],int,int) in
a loop, in order to read the whole thing.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/color/ICC_Profile.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/color/ICC_Profile.java,v
retrieving revision 1.13
diff -u -1 -0 -r1.13 ICC_Profile.java
--- java/awt/color/ICC_Profile.java	3 Oct 2005 17:21:07 -	1.13
+++ java/awt/color/ICC_Profile.java	12 Feb 2008 11:25:57 -
@@ -419,24 +419,29 @@
 
 // verify it as a correct ICC header, but do not verify the
 // size as we are reading from a stream.
 header.verifyHeader(-1);
 
 // get the size
 byte[] data = new byte[header.getSize()];
 System.arraycopy(headerData, 0, data, 0, ProfileHeader.HEADERSIZE);
 
 // read the rest
-if (in.read(data, ProfileHeader.HEADERSIZE,
-header.getSize() - ProfileHeader.HEADERSIZE) != header.getSize()
-- ProfileHeader.HEADERSIZE)
-  throw new IOException(Incorrect profile size);
+int totalBytes = header.getSize() - ProfileHeader.HEADERSIZE;
+int bytesLeft = totalBytes;
+while (bytesLeft  0)
+  {
+	int read = in.read(data,
+   ProfileHeader.HEADERSIZE + (totalBytes - bytesLeft),
+   bytesLeft);
+	bytesLeft -= read;
+  }
 
 return getInstance(data);
   }
 
   /**
* Returns the major version number
*/
   public int getMajorVersion()
   {
 return header.getMajorVersion();


[commit-cp] classpath ChangeLog java/awt/color/ICC_Profile....

2008-02-12 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/12 12:17:35

Modified files:
.  : ChangeLog 
java/awt/color : ICC_Profile.java 

Log message:
2008-02-12  Roman Kennke  [EMAIL PROTECTED]

* java/awt/color/ICC_Profile.java
(getInstance()): Wrap call to InputStream.read(byte[],int,int) 
in
a loop, in order to read the whole thing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9499r2=1.9500
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/color/ICC_Profile.java?cvsroot=classpathr1=1.13r2=1.14




Re: [cp-patches] FYI: GTK peers fixlet

2008-02-08 Thread Roman Kennke
I just realized that I committed some other stuff that I was
experimenting with. This patch reverts this. You haven't seen
anything ;-) This has to be cleaned up and committed later.

2008-02-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
* gnu/java/awt/peer/gtk/GtkToolkit.java: Removed mistakenly
committed code.

/Roman

Am Freitag, den 08.02.2008, 23:22 +0100 schrieb Roman Kennke:
 This changes the System.loadLibrary() calls in the GTK peers, so that
 they are only called when configured so. This is important for VMs that
 can't or don't want to link dynamically, e.g. when creating full static
 linked binaries like Jamaica.
 
 2008-02-08  Roman Kennke  [EMAIL PROTECTED]
 
   * gnu/java/awt/peer/gtk/CairoGraphics2D.java,
   * gnu/java/awt/peer/gtk/GdkFontPeer.java,
   * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
   * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
   * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,
   * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
   * gnu/java/awt/peer/gtk/GtkToolkit.java: Only call
   System.loadLibrary() when configured so.
 
 /Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.131
diff -u -1 -0 -r1.131 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java	8 Feb 2008 22:17:40 -	1.131
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java	8 Feb 2008 22:23:09 -
@@ -73,22 +73,20 @@
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
 import java.awt.image.VolatileImage;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.ContainerPeer;
 import java.awt.peer.LightweightPeer;
 import java.awt.peer.WindowPeer;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import sun.java2d.pipe.Region;
-
 public class GtkComponentPeer extends GtkGenericPeer
   implements ComponentPeer
 {
   VolatileImage backBuffer;
   BufferCapabilities caps;
 
   Component awtComponent;
 
   Insets insets;
 
@@ -913,15 +911,11 @@
 
   public boolean requestFocus(Component lightweightChild, boolean temporary,
   boolean focusedWindowChangeAllowed,
   long time, sun.awt.CausedFocusEvent.Cause cause)
   {
 // TODO: Implement this properly and remove the other requestFocus()
 // methods.
 return true;
   }
 
-  public void applyShape(Region shape)
-  {
-// TODO: Implement properly.
-  }
 }
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.105
diff -u -1 -0 -r1.105 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java	8 Feb 2008 22:17:40 -	1.105
+++ gnu/java/awt/peer/gtk/GtkToolkit.java	8 Feb 2008 22:23:09 -
@@ -60,21 +60,20 @@
 import java.awt.Dimension;
 import java.awt.EventQueue;
 import java.awt.FileDialog;
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Frame;
 import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
 import java.awt.HeadlessException;
 import java.awt.Image;
-import java.awt.KeyboardFocusManager;
 import java.awt.Label;
 import java.awt.List;
 import java.awt.Menu;
 import java.awt.MenuBar;
 import java.awt.MenuItem;
 import java.awt.Panel;
 import java.awt.Point;
 import java.awt.PopupMenu;
 import java.awt.PrintJob;
 import java.awt.Rectangle;
@@ -98,21 +97,20 @@
 import java.awt.image.ImageProducer;
 import java.awt.peer.ButtonPeer;
 import java.awt.peer.CanvasPeer;
 import java.awt.peer.CheckboxMenuItemPeer;
 import java.awt.peer.CheckboxPeer;
 import java.awt.peer.ChoicePeer;
 import java.awt.peer.DialogPeer;
 import java.awt.peer.FileDialogPeer;
 import java.awt.peer.FontPeer;
 import java.awt.peer.FramePeer;
-import java.awt.peer.KeyboardFocusManagerPeer;
 import java.awt.peer.LabelPeer;
 import java.awt.peer.ListPeer;
 import java.awt.peer.MenuBarPeer;
 import java.awt.peer.MenuItemPeer;
 import java.awt.peer.MenuPeer;
 import java.awt.peer.MouseInfoPeer;
 import java.awt.peer.PanelPeer;
 import java.awt.peer.PopupMenuPeer;
 import java.awt.peer.RobotPeer;
 import java.awt.peer.ScrollPanePeer;
@@ -122,31 +120,28 @@
 import java.awt.peer.WindowPeer;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Properties;
 
 import

[cp-patches] FYI: GTK peers fixlet

2008-02-08 Thread Roman Kennke
This changes the System.loadLibrary() calls in the GTK peers, so that
they are only called when configured so. This is important for VMs that
can't or don't want to link dynamically, e.g. when creating full static
linked binaries like Jamaica.

2008-02-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/gtk/CairoGraphics2D.java,
* gnu/java/awt/peer/gtk/GdkFontPeer.java,
* gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
* gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,
* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
* gnu/java/awt/peer/gtk/GtkToolkit.java: Only call
System.loadLibrary() when configured so.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -1 -0 -r1.72 -r1.73
--- gnu/java/awt/peer/gtk/CairoGraphics2D.java	9 Jan 2008 20:42:37 -	1.72
+++ gnu/java/awt/peer/gtk/CairoGraphics2D.java	8 Feb 2008 22:17:39 -	1.73
@@ -31,20 +31,22 @@
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package gnu.java.awt.peer.gtk;
 
+import gnu.classpath.Configuration;
+
 import gnu.java.awt.ClasspathToolkit;
 
 import java.awt.AWTPermission;
 import java.awt.AlphaComposite;
 import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Composite;
 import java.awt.CompositeContext;
 import java.awt.Font;
 import java.awt.FontMetrics;
@@ -113,21 +115,24 @@
  * Also, dispose() must be overloaded to free any native datastructures 
  * used by subclass and in addition call super.dispose() to free the
  * native cairographics2d structure and cairo_t.
  *
  * @author Sven de Marothy
  */
 public abstract class CairoGraphics2D extends Graphics2D
 {
   static 
   {
-System.loadLibrary(gtkpeer);
+if (Configuration.INIT_LOAD_LIBRARY)
+  {
+System.loadLibrary(gtkpeer);
+  }
   }
 
   /**
* Important: This is a pointer to the native cairographics2d structure
*
* DO NOT CHANGE WITHOUT CHANGING NATIVE CODE.
*/
   long nativePointer;
 
   // Drawing state variables
Index: gnu/java/awt/peer/gtk/GdkFontPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -1 -0 -r1.25 -r1.26
--- gnu/java/awt/peer/gtk/GdkFontPeer.java	25 Jun 2007 11:25:51 -	1.25
+++ gnu/java/awt/peer/gtk/GdkFontPeer.java	8 Feb 2008 22:17:40 -	1.26
@@ -31,20 +31,21 @@
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package gnu.java.awt.peer.gtk;
 
+import gnu.classpath.Configuration;
 import gnu.classpath.Pointer;
 
 import gnu.java.awt.ClasspathToolkit;
 import gnu.java.awt.peer.ClasspathFontPeer;
 import gnu.java.awt.font.opentype.NameDecoder;
 
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Toolkit;
 import java.awt.font.FontRenderContext;
@@ -159,21 +160,24 @@
   float maxDescent;
   float maxAdvance;
   float height;
   float underlineOffset;
   float underlineThickness;
 
   GdkFontMetrics metrics;
 
   static 
   {
-System.loadLibrary(gtkpeer);
+if (Configuration.INIT_LOAD_LIBRARY)
+  {
+System.loadLibrary(gtkpeer);
+  }
 
 initStaticState ();
 
   }
 
   private ByteBuffer nameTable = null;
 
   /**
* The pointer to the native font data.
*
Index: gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -1 -0 -r1.18 -r1.19
--- gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java	27 Nov 2007 22:06:58 -	1.18
+++ gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java

[commit-cp] classpath ChangeLog gnu/java/awt/peer/gtk/GtkCo...

2008-02-08 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/02/08 22:24:34

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/gtk: GtkComponentPeer.java GtkToolkit.java 

Log message:
2008-02-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
* gnu/java/awt/peer/gtk/GtkToolkit.java: Removed mistakenly
committed code.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9488r2=1.9489
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java?cvsroot=classpathr1=1.131r2=1.132
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java?cvsroot=classpathr1=1.105r2=1.106




Re: HttpUrlConnection on JamVM

2008-01-17 Thread Roman Kennke
Hi Nils,



 Anybody a solution?

Without some more details it is hard to dig up a solution ;-) Maybe you
can put together a small test case? That would be ideal.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] FYI: javax.tools.FileObject

2008-01-14 Thread Roman Kennke
I added another interface for javax.tools.

2006-01-14  Roman Kennke  [EMAIL PROTECTED]

* javax/tools/FileObject.java: New interface.

/Roman

-- 
http://kennke.org/blog/
Index: javax/tools/FileObject.java
===
RCS file: javax/tools/FileObject.java
diff -N javax/tools/FileObject.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ javax/tools/FileObject.java	14 Jan 2008 11:46:15 -
@@ -0,0 +1,155 @@
+/* FileObject.java --
+   Copyright (C) 2008  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.tools;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.URI;
+
+/**
+ * Abstraction for all kinds of file objects used by tools, e.g. regular files,
+ * memory cache, or database data.
+ *
+ * @author Roman Kennke ([EMAIL PROTECTED])
+ *
+ * @since 1.6
+ */
+public interface FileObject
+{
+
+  /**
+   * Returns a URI that represents this file object.
+   *
+   * @return a URI that represents this file object
+   */
+  URI toURI();
+
+  /**
+   * Returns a name for this file object. The exact name is implementation
+   * dependent.
+   *
+   * @return a name for this file object
+   */
+  String getName();
+
+  /**
+   * Opens this file for reading and returns an input stream.
+   *
+   * @return an input stream to read this file object
+   *
+   * @throws IOException if an I/O error occured
+   * @throws IllegalStateException if this file was opened for writing and
+   * does not support reading
+   * @throws UnsupportedOperationException if this kind of file does not allow
+   * byte reading
+   */
+  InputStream openInputStream() throws IOException;
+
+  /**
+   * Opens this file for writing and returns an output stream.
+   *
+   * @return an output stream for writing this file object
+   *
+   * @throws IOException if an I/O error occurs
+   * @throws IllegalStateException if this file was opened for reading and
+   * does not support writing
+   * @throws UnsupportedOperationException if this kind of file does not allow
+   * byte writing
+   */
+  OutputStream openOutputStream() throws IOException;
+
+  /**
+   * Opens this file for reading and returns a reader.
+   *
+   * @return a reader for reading this file object
+   *
+   * @throws IOException if an I/O error occurs
+   * @throws IllegalStateException if this file was opened for writing and
+   * does not support reading
+   * @throws UnsupportedOperationException if this kind of file does not allow
+   * character reading
+   */
+  Reader openReader() throws IOException;
+
+  /**
+   * Returns the character content of the file, if available. Any byte
+   * that cannot be decoded will be replaced by the default replacement
+   * character. A diagnostic may be reported, unless
+   * codeignoreEncodingErrors/code is codetrue/code.
+   * 
+   * @param ignoreEncodingErrors codetrue/code when encoding errors should be ignored
+   * codefalse/code otherwise
+   * @return the character content, or codenull/code if not available
+   *
+   * @throws IOException if an I/O error occurs
+   */
+  CharSequence getCharContent(boolean ignoreEncodingErrors) throws

[commit-cp] classpath ChangeLog javax/tools/FileObject.java

2008-01-14 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/01/14 11:46:57

Modified files:
.  : ChangeLog 
Added files:
javax/tools: FileObject.java 

Log message:
2006-01-14  Roman Kennke  [EMAIL PROTECTED]

* javax/tools/FileObject.java: New interface.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/tools/FileObject.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9472r2=1.9473




Re: Quality control and FOSS rant

2008-01-10 Thread Roman Kennke
Hi Andy,

  Comments and criticisms welcome.

 I suppose this is more of a troll than a criticism, sorry about that.
 
  Classpath bugs don't
  have such administration issues due to
  its longer history as a FOSS project and existing community-oriented fun
  development paradigm.
 Wouldn't it be more accurate to say that Classpath lacks the basic 
 quality controls that OpenJDK has?

Classpath and most FOSS projects for that matter work differently, but
still surprisingly well. From my experience with Classpath I can only
say the following:

- We have an extensive unit testsuite (Mauve) that has been developed
alongside with Classpath. Many bugs got a corresponding Mauve test and a
couple of regressions have been caught that way. While not beeing
mandadory for any patch to go in, many developers have taken the
responsibility to write tests and look out for regressions before
committing. Of course, that has not always been the case, I am myself
guilty of quickly checking in code that has not been checked that way.
- The quick turnaround between the Classpath developers and users
resulted in a much more efficient handling of bugs (IMO). This, together
with the first point, has helped _a_lot_ to keep the overall quality
suprisingly high, despite the apparent lack of formal processes (except
the ones that Mark already mentioned).

That whole discussion is probably interesting but mostly pointless. Both
approaches (closed and open) apparently tend to produce relatively high
quality code (or really crappy code, happens in both camps), where with
the closed approach the developers (or vendors) have to take over 100%
responsibility (because the end user has no way to interact with the
development), which usually makes things very formal and slow, where the
open approach relies very much on the end users reporting problems. In
most active projects these are fixed really quickly, giving both the
developers and the end users a warm fuzzy feeling ;-) Labelling FOSS as
playground for bored developers is, uhm, strange. But yeah, now that
Classpath has lost most of its end users, we might end up like that ;-)
I don't care, I'll continue anyway.

Cheers, Roman
-- 
http://kennke.org/blog/




[cp-patches] FYI: RuleBasedCollator fixlet

2008-01-09 Thread Roman Kennke
This fixed
RuleBasedCollator.getCollationElementIterator(CharacterIterator) to
simply return a CollationElementIterator for it. This means to tweak the
latter class to work with CharacterIterator instead of String. This is
the last missing jdk13 method according to JAPI.

2006-01-09  Roman Kennke  [EMAIL PROTECTED]

* java/text/CollationElementIterator.java
(text): Changed type to CharacterIterator.
(CollationElementIterator(RuleBasedCollator,CharacterIterator)):
New
constructor.
(setOffset(int)): Use CharacterIterator.getEndIndex() instead of
String.length().
(setText(String)): Wrap string into a StringCharacterIterator.
* java/text/RuleBasedCollator.java
(getCollationElementIterator(CharacterIterator)): Simply return
CollationElementIterator for the character iterator, instead of
expanding things.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/text/CollationElementIterator.java
===
RCS file: /cvsroot/classpath/classpath/java/text/CollationElementIterator.java,v
retrieving revision 1.24
diff -u -1 -0 -r1.24 CollationElementIterator.java
--- java/text/CollationElementIterator.java	23 Jul 2005 20:25:15 -	1.24
+++ java/text/CollationElementIterator.java	9 Jan 2008 13:39:29 -
@@ -66,21 +66,21 @@
   public static final int NULLORDER = -1;
 
   /**
* This is the RuleBasedCollator this object was created from.
*/
   RuleBasedCollator collator;
 
   /**
* This is the String that is being iterated over.
*/
-  String text;
+  CharacterIterator text;
 
   /**
* This is the index into the collation decomposition where we are currently scanning.
*/
   int index;
 
   /**
* This is the index into the String where we are currently scanning.
*/
   int textIndex;
@@ -104,20 +104,35 @@
* @param collator The codeRuleBasedCollation/code used for calculating collation values
* @param text The codeString/code to iterate over.
*/
   CollationElementIterator(RuleBasedCollator collator, String text)
   {
 this.collator = collator;
 
 setText (text);
   }
 
+  /**
+   * This method initializes a new instance of codeCollationElementIterator/code
+   * to iterate over the specified codeString/code using the rules in the
+   * specified codeRuleBasedCollator/code.
+   *
+   * @param collator The codeRuleBasedCollation/code used for calculating collation values
+   * @param text The character iterator to iterate over.
+   */
+  CollationElementIterator(RuleBasedCollator collator, CharacterIterator text)
+  {
+this.collator = collator;
+
+setText (text);
+  }
+
   RuleBasedCollator.CollationElement nextBlock()
   {
 if (index = text_decomposition.length)
   return null;
 
 RuleBasedCollator.CollationElement e = text_decomposition[index];
 
 textIndex = text_indexes[index+1];
 
 index++;
@@ -239,21 +254,21 @@
*
* @since 1.2
*/
   public void setText(String text)
   {
 int idx = 0;
 int idx_idx = 0;
 int alreadyExpanded = 0;
 int idxToMove = 0;
 
-this.text = text;
+this.text = new StringCharacterIterator(text);
 this.index = 0;
 
 String work_text = text.intern();
 
 ArrayList a_element = new ArrayList();
 ArrayList a_idx = new ArrayList();
 
 // Build element collection ordered as they come in text.
 while (idx  work_text.length())
   {
@@ -433,21 +448,21 @@
*
* @param offset The new iteration index position.
*
* @exception IllegalArgumentException If the new offset is not valid.
*/
   public void setOffset(int offset)
   {
 if (offset  0)
   throw new IllegalArgumentException(Negative offset:  + offset);
 
-if (offset  (text.length() - 1))
+if (offset  (text.getEndIndex() - 1))
   throw new IllegalArgumentException(Offset too large:  + offset);
 
 for (index = 0; index  text_decomposition.length; index++)
   {	
 	if (offset = text_indexes[index])
 	  break;
   }
 /*
  * As text_indexes[0] == 0, we should not have to take care whether index is
  * greater than 0. It is always.
Index: java/text/RuleBasedCollator.java
===
RCS file: /cvsroot/classpath/classpath/java/text/RuleBasedCollator.java,v
retrieving revision 1.32
diff -u -1 -0 -r1.32 RuleBasedCollator.java
--- java/text/RuleBasedCollator.java	22 Mar 2006 19:15:25 -	1.32
+++ java/text/RuleBasedCollator.java	9 Jan 2008 13:39:29 -
@@ -916,31 +916,22 @@
   /**
* This method returns an instance

[cp-patches] FYI: FontMetrics for X Fonts

2008-01-09 Thread Roman Kennke
This re-enables font metrics for X Fonts.

2006-01-09  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XWindowPeer.java
(getFontMetrics): Re-enable that for X fonts.

/Roman

-- 
http://kennke.org/blog/
Index: gnu/java/awt/peer/x/XWindowPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XWindowPeer.java,v
retrieving revision 1.5
diff -u -1 -0 -r1.5 XWindowPeer.java
--- gnu/java/awt/peer/x/XWindowPeer.java	20 Sep 2007 14:01:09 -	1.5
+++ gnu/java/awt/peer/x/XWindowPeer.java	9 Jan 2008 22:05:08 -
@@ -54,20 +54,21 @@
 import java.awt.Rectangle;
 import java.awt.event.PaintEvent;
 import java.awt.event.WindowEvent;
 import java.awt.image.VolatileImage;
 
 import gnu.x11.Atom;
 import gnu.x11.Window;
 import gnu.x11.event.Event;
 
 import gnu.java.awt.font.OpenTypeFontPeer;
+import gnu.java.awt.peer.ClasspathFontPeer;
 import gnu.java.awt.peer.swing.SwingWindowPeer;
 
 public class XWindowPeer
 extends SwingWindowPeer
 {
 
   private static int standardSelect = Event.BUTTON_PRESS_MASK
   | Event.BUTTON_RELEASE_MASK
   | Event.POINTER_MOTION_MASK
   //| Event.RESIZE_REDIRECT_MASK
@@ -283,22 +284,21 @@
 return (Insets) insets.clone();
   }
 
   /**
* Returns the font metrics for the specified font.
*
* @return the font metrics for the specified font
*/
   public FontMetrics getFontMetrics(Font font)
   {
-// FIXME: Fix this for X fonts.
-OpenTypeFontPeer fontPeer = (OpenTypeFontPeer) font.getPeer();
+ClasspathFontPeer fontPeer = (ClasspathFontPeer) font.getPeer();
 return fontPeer.getFontMetrics(font);
   }
 
   /**
* Unregisters the window in the event pump when it is closed.
*/
   protected void finalize()
   {
 XGraphicsDevice dev = XToolkit.getDefaultDevice();
 dev.getEventPump().unregisterWindow(xwindow);


[cp-patches] FYI: javax.tools stuff

2008-01-09 Thread Roman Kennke
I'm beginning the implementation of javax.tools with two interfaces.

2006-01-09  Roman Kennke  [EMAIL PROTECTED]

* javax/tools/Diagnostic.java,
* javax/tools/DiagnosticListener.java:
New interfaces.

/Roman

-- 
http://kennke.org/blog/
Index: gnu/java/awt/peer/x/XWindowPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XWindowPeer.java,v
retrieving revision 1.5
diff -u -1 -0 -r1.5 XWindowPeer.java
--- gnu/java/awt/peer/x/XWindowPeer.java	20 Sep 2007 14:01:09 -	1.5
+++ gnu/java/awt/peer/x/XWindowPeer.java	9 Jan 2008 22:05:08 -
@@ -54,20 +54,21 @@
 import java.awt.Rectangle;
 import java.awt.event.PaintEvent;
 import java.awt.event.WindowEvent;
 import java.awt.image.VolatileImage;
 
 import gnu.x11.Atom;
 import gnu.x11.Window;
 import gnu.x11.event.Event;
 
 import gnu.java.awt.font.OpenTypeFontPeer;
+import gnu.java.awt.peer.ClasspathFontPeer;
 import gnu.java.awt.peer.swing.SwingWindowPeer;
 
 public class XWindowPeer
 extends SwingWindowPeer
 {
 
   private static int standardSelect = Event.BUTTON_PRESS_MASK
   | Event.BUTTON_RELEASE_MASK
   | Event.POINTER_MOTION_MASK
   //| Event.RESIZE_REDIRECT_MASK
@@ -283,22 +284,21 @@
 return (Insets) insets.clone();
   }
 
   /**
* Returns the font metrics for the specified font.
*
* @return the font metrics for the specified font
*/
   public FontMetrics getFontMetrics(Font font)
   {
-// FIXME: Fix this for X fonts.
-OpenTypeFontPeer fontPeer = (OpenTypeFontPeer) font.getPeer();
+ClasspathFontPeer fontPeer = (ClasspathFontPeer) font.getPeer();
 return fontPeer.getFontMetrics(font);
   }
 
   /**
* Unregisters the window in the event pump when it is closed.
*/
   protected void finalize()
   {
 XGraphicsDevice dev = XToolkit.getDefaultDevice();
 dev.getEventPump().unregisterWindow(xwindow);


Re: [cp-patches] FYI: javax.tools stuff

2008-01-09 Thread Roman Kennke
Hi,

Am Mittwoch, den 09.01.2008, 23:36 +0100 schrieb Michael Koch:
 On Wed, Jan 09, 2008 at 11:13:00PM +0100, Roman Kennke wrote:
  I'm beginning the implementation of javax.tools with two interfaces.
  
  2006-01-09  Roman Kennke  [EMAIL PROTECTED]
  
  * javax/tools/Diagnostic.java,
  * javax/tools/DiagnosticListener.java:
  New interfaces.
 
 Hmmm, that doesnt fit the patch below somehow ;-)

Ugh. Wrong patch. Here comes the correct thing.

/Roman

-- 
http://kennke.org/blog/
Index: javax/tools/Diagnostic.java
===
RCS file: javax/tools/Diagnostic.java
diff -N javax/tools/Diagnostic.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ javax/tools/Diagnostic.java	9 Jan 2008 22:12:29 -	1.1
@@ -0,0 +1,167 @@
+/* Diagnostic.java --
+   Copyright (C) 2008  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.tools;
+
+import java.util.Locale;
+
+/**
+ * Encapsulates diagnostic information from a tool. This usually includes
+ * (but is not required) a position in a source file, line and column number
+ * information and a message.
+ *
+ * @author Roman Kennke ([EMAIL PROTECTED])
+ *
+ * @param S the type of the source object
+ *
+ * @since 1.6
+ */
+public interface DiagnosticS
+{
+  /**
+   * The kind of diagnostic information.
+   */
+  public static enum Kind
+  {
+/**
+ * Indicates and error.
+ */
+ERROR,
+
+/**
+ * Indicates a warning.
+ */
+WARNING,
+
+/**
+ * Indicates a mandatory warning.
+ */
+MANDATORY_WARNING,
+
+/**
+ * Indicates a note.
+ */
+NOTE,
+
+/**
+ * Indicates something else.
+ */
+OTHER
+  }
+
+  /**
+   * Indicates that this diagnostic object doesn't carry position information.
+   */
+  public static final long NOPOS = -1L;
+
+  /**
+   * Returns the kind of this diagnostic object.
+   *
+   * @return the kind of this diagnostic object
+   */
+  Kind getKind();
+
+  /**
+   * Returns the source of this diagnostic object.
+   *
+   * @return the source of this diagnostic object
+   */
+  S getSource();
+
+  /**
+   * Returns the position in the source object. This is a zero based value,
+   * or [EMAIL PROTECTED] # NOPOS}, indicating that this doesn't carry position
+   * information.
+   *
+   * @return the position in the source object
+   */
+  long getPosition();
+
+  /**
+   * Returns the start position in the source object. This is a zero based
+   * value, or [EMAIL PROTECTED] #NOPOS}, indicating that this doesn't carry position
+   * information.
+   *
+   * @return the start position in the source object
+   */
+  long getStartPosition();
+
+  /*
+  * Returns the end position in the source object. This is a zero based
+  * value, or [EMAIL PROTECTED] #NOPOS}, indicating that this doesn't carry position
+  * information.
+  *
+  * @return the end position in the source object
+  */
+  long getEndPosition();
+
+  /**
+   * Returns the line number or [EMAIL PROTECTED] #NOPOS}, indicating that this doesn't
+   * carry position information. This is a 1-based value indicating the line
+   * in the source object.
+   *
+   * @return the line number
+   */
+  long getLineNumber();
+
+  /**
+   * Returns the column number or [EMAIL PROTECTED] #NOPOS}, indicating

[commit-cp] classpath ChangeLog java/text/CollationElementI...

2008-01-09 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/01/09 13:49:53

Modified files:
.  : ChangeLog 
java/text  : CollationElementIterator.java 
 RuleBasedCollator.java 

Log message:
2006-01-09  Roman Kennke  [EMAIL PROTECTED]

* java/text/CollationElementIterator.java
(text): Changed type to CharacterIterator.

(CollationElementIterator(RuleBasedCollator,CharacterIterator)): New
constructor.
(setOffset(int)): Use CharacterIterator.getEndIndex() instead of
String.length().
(setText(String)): Wrap string into a StringCharacterIterator.
* java/text/RuleBasedCollator.java
(getCollationElementIterator(CharacterIterator)): Simply return
CollationElementIterator for the character iterator, instead of
expanding things.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9463r2=1.9464
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/CollationElementIterator.java?cvsroot=classpathr1=1.24r2=1.25
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/RuleBasedCollator.java?cvsroot=classpathr1=1.32r2=1.33




[commit-cp] classpath gnu/java/awt/peer/x/XWindowPeer.java ...

2008-01-09 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/01/09 22:06:22

Modified files:
gnu/java/awt/peer/x: XWindowPeer.java 
.  : ChangeLog 

Log message:
2006-01-09  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XWindowPeer.java
(getFontMetrics): Re-enable that for X fonts.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XWindowPeer.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9465r2=1.9466




[commit-cp] classpath/javax/tools

2008-01-09 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/01/09 22:11:06

New directory:
javax/tools

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/tools/?cvsroot=classpath




[commit-cp] classpath ChangeLog javax/tools/Diagnostic.java...

2008-01-09 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 08/01/09 22:12:29

Modified files:
.  : ChangeLog 
Added files:
javax/tools: Diagnostic.java DiagnosticListener.java 

Log message:
2006-01-09  Roman Kennke  [EMAIL PROTECTED]

* javax/tools/Diagnostic.java,
* javax/tools/DiagnosticListener.java:
New interfaces.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9466r2=1.9467
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/tools/Diagnostic.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/tools/DiagnosticListener.java?cvsroot=classpathrev=1.1




Re: Problem with JPEGDecoder class

2007-12-28 Thread Roman Kennke
Hi Allesandro,

Am Freitag, den 28.12.2007, 12:19 +0100 schrieb Alessandro Maldini:
 Hello everybody,
 I've a problem using your JPEGDecoder class and I hope someone would help me.
 
 I imported in my Project
 classpath-0.96.1/gnu/javax/imageio/jpeg/IIOInputStream.java and all
 classpath-0.96.1/gnu/javax/imageio/jpeg/* files.
 
 When I try to open a jpeg image in order to decode it, an Unsupported
 JFIF version exception.

This means that the specific JPEG format you are trying is not
supported. The JPEG decoder in Classpath is very incomplete and doesn't
support the mainstream JPEG formats. Your options are: 1. try to use the
OpenJDK JPEG decoder in Classpath somehow (should be possible because it
is designed as a plugin for IIO) 2. try to implement the missing JPEG
formats ;-)

Roman

-- 
http://kennke.org/blog/




Re: A problem in native methods implementation of GtkToolkit

2007-10-17 Thread Roman Kennke
Hi,

 A class, gnu.java.awt.peer.gtk.GtkToolkit, has serveral native methods
 including gtkInit() and gtkMain().
 The native implementation in gnu_java_awt_peer_gtk_GtkToolkit.c
 declares a variable of static jclass gtktoolkit which is assigned by
 JNI call, (*env)-FindClass(env,
 gnu/java/awt/peer/gtk/GtkMainThread) in gtkInit(). 
 
 A problem is that gtktoolkit is used in gtkMain() while it is remained
 as a local reference, so that it might occur errors.
 
 I think gtktoolkit should be a global reference. 

That's correct. I'll fix this. Thanks.

Cheers, Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




Re: Classpath 0.96 Imminent

2007-10-17 Thread Roman Kennke
Hi,
   After I posted that I realized that I could have made a Firefly
   reference and suggested Too pretty to die... I don't know if any
   Classpath hackers are browncoats though.

I'd have chosen 'Too old to rock'n'roll, Too young to die' ;-)

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] FYI: LightweightDispatcher fix

2007-10-15 Thread Roman Kennke
This fixes a deadlock (i.e. in JFileChooser) by removing a lock in
LightweightDispatcher. This is _not_ the 100% correct solution, it only
rolls back to what we had before. The correct solution would be to
minimize the lock to only the code that needs it, and dispatch the
events _without_ holding the lock.

2007-10-15  Roman Kennke  [EMAIL PROTECTED]

* java/awt/LightweightDispatcher.java
(dispatchEvent): Don't synchronize on the AWT lock here,
this causes a deadlock in some situations.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] Re: RFC: Avoid EmptyStackException in jgecko

2007-10-15 Thread Roman Kennke
Hi,

 * javax/swing/text/DefaultStyledDocument.java  
   (ElementBuffer.insertElement): Added check for empty
   stack to avoid EmptyStackException. 

Hmm, this clearly isn't the correct solution, because the stack should
never get empty anyway. I suspect some weird HTML (I don't want to say
broken, because HTML is much less strict with nesting than XML for
example), which causes the stack running empty. However, it doesn't hurt
either, so go with it. This is one of the most horrible undocumented and
hard-to-figure-out classes where I hoped we could simply import the
OpenJDK version somehow (have a look at all those mauve tests and ask
Lillian or Anthony ;-) ). Apparently, this isn't easily possible, sigh.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] FYI: MouseEvent fix

2007-10-15 Thread Roman Kennke
This fixes the MouseEvent constructor, to not call into
getLocationOnScreen(), because this might cause deadlocks. Instead, we
set the absX/absY fields to 0, just like the JDK does.

2007-10-15  Roman Kennke  [EMAIL PROTECTED]

* java/awt/event/MouseEvent.java
(MouseEvent): For the no-absX/absY constructor, set the
absX/absY to 0, instead of calling into getLocationOnScreen(),
which might cause nasty deadlocks.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/event/MouseEvent.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/event/MouseEvent.java,v
retrieving revision 1.14
diff -u -1 -0 -r1.14 MouseEvent.java
--- java/awt/event/MouseEvent.java	25 Jun 2007 11:25:52 -	1.14
+++ java/awt/event/MouseEvent.java	15 Oct 2007 18:26:43 -
@@ -214,51 +214,22 @@
* @param clickCount the number of mouse clicks for this event
* @param popupTrigger true if this event triggers a popup menu
* @param button the most recent mouse button to change state
* @throws IllegalArgumentException if source is null or button is invalid
* @since 1.4
*/
   public MouseEvent(Component source, int id, long when, int modifiers,
 int x, int y, int clickCount, boolean popupTrigger,
 int button)
   {
-super(source, id, when, modifiers);
-
-this.x = x;
-this.y = y;
-this.clickCount = clickCount;
-this.popupTrigger = popupTrigger;
-this.button = button;
-if (button  NOBUTTON || button  BUTTON3)
-  throw new IllegalArgumentException();
-if ((modifiers  EventModifier.OLD_MASK) != 0)
-  {
-if ((modifiers  BUTTON1_MASK) != 0)
-  this.button = BUTTON1;
-else if ((modifiers  BUTTON2_MASK) != 0)
-  this.button = BUTTON2;
-else if ((modifiers  BUTTON3_MASK) != 0)
-  this.button = BUTTON3;
-  }
-// clear the mouse button modifier masks if this is a button
-// release event.
-if (id == MOUSE_RELEASED)
-  this.modifiersEx = ~(BUTTON1_DOWN_MASK
-			| BUTTON2_DOWN_MASK
-			| BUTTON3_DOWN_MASK);
-
-if (source != null)
-  {
-Point screenLoc = source.getLocationOnScreen();
-absX = screenLoc.x + x;
-absY = screenLoc.y + y;
-  }
+this(source, id, when, modifiers, x, y, 0, 0, clickCount, popupTrigger,
+ button);
   }
 
   /**
* Initializes a new instance of codeMouseEvent/code with the specified
* information. Note that an invalid id leads to unspecified results.
*
* @param source the source of the event
* @param id the event id
* @param when the timestamp of when the event occurred
* @param modifiers the modifier keys during the event, in old or new style


[commit-cp] classpath ChangeLog java/awt/LightweightDispatc...

2007-10-15 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/10/15 12:13:13

Modified files:
.  : ChangeLog 
java/awt   : LightweightDispatcher.java 

Log message:
2007-10-15  Roman Kennke  [EMAIL PROTECTED]

* java/awt/LightweightDispatcher.java
(dispatchEvent): Don't synchronize on the AWT lock here,
this causes a deadlock in some situations.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9414r2=1.9415
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/LightweightDispatcher.java?cvsroot=classpathr1=1.18r2=1.19




[commit-cp] classpath java/awt/event/MouseEvent.java ChangeLog

2007-10-15 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/10/15 18:30:10

Modified files:
java/awt/event : MouseEvent.java 
.  : ChangeLog 

Log message:
2007-10-15  Roman Kennke  [EMAIL PROTECTED]

* java/awt/event/MouseEvent.java
(MouseEvent): For the no-absX/absY constructor, set the
absX/absY to 0, instead of calling into getLocationOnScreen(),
which might cause nasty deadlocks.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/event/MouseEvent.java?cvsroot=classpathr1=1.14r2=1.15
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9416r2=1.9417




[cp-patches] FYI: NEWS entry for Escher

2007-10-12 Thread Roman Kennke
I've added an entry for the Escher peers to the NEWS file because they
improved significantly in this release (from mostly unusable to quite
usable ;-) ).

2007-10-12  Roman Kennke  [EMAIL PROTECTED]

* NEWS: Added entry for Escher peers.

/Roman
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: NEWS
===
RCS file: /cvsroot/classpath/classpath/NEWS,v
retrieving revision 1.182
diff -u -1 -0 -r1.182 NEWS
--- NEWS	12 Oct 2007 12:17:07 -	1.182
+++ NEWS	12 Oct 2007 12:28:23 -
@@ -1,16 +1,17 @@
 New in release 0.96
 
 * New experimental GStreamer javax.sound peer (see README.gstreamer)
 * The JNI interface has been updated to 1.6
 * Better support for the OpenJDK javac compiler
 * Support for using javah via tools.zip and com.sun.tools.javah.Main
+* Much improved Escher AWT peers
 * Many bug fixes including improvements to AWT and Swing support
 
 Runtime interface changes:
 
 * Add VMFloat.toString(float) and VMFloat.parseFloat(String). Default
   implementations are the same as previous behavior.
 * Add new default implementations of VMMemoryMXBean.getHeapUsage()
   and VMMemoryMXBean.getNonHeapUsage() via iteration over the memory
   pools of the appropriate type.
 


[commit-cp] classpath NEWS ChangeLog

2007-10-12 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/10/12 12:29:33

Modified files:
.  : NEWS ChangeLog 

Log message:
2007-10-12  Roman Kennke  [EMAIL PROTECTED]

* NEWS: Added entry for Escher peers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/NEWS?cvsroot=classpathr1=1.182r2=1.183
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9408r2=1.9409




[cp-patches] FYI: BasicTreeUI patch

2007-10-11 Thread Roman Kennke
This removes a not used constant in BasicTreeUI. This was creating a
synthetic MouseEvent, which wouldn't work because the MouseEvent tries
to get the screen location of the source component, which fails because
the artificial component is not showing. Alas, the constant isn't used
anyway, so I remove it. This should fix the Mauve regression and should
also help with FindBugs, AFAICS.

2007-10-11  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicTreeUI.java
(EDIT): Removed obsolete constant.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: javax/swing/plaf/basic/BasicTreeUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.157
diff -u -1 -0 -r1.157 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java	3 Apr 2007 20:41:03 -	1.157
+++ javax/swing/plaf/basic/BasicTreeUI.java	11 Oct 2007 10:32:19 -
@@ -272,28 +272,20 @@
   TreeExpansionListener treeExpansionListener;
 
   TreeModelListener treeModelListener;
 
   /**
* The zero size icon, used for expand controls, if they are not visible.
*/
   static Icon nullIcon;
 
   /**
-   * The special value of the mouse event is sent indicating that this is not
-   * just the mouse click, but the mouse click on the selected node. Sending
-   * such event forces to start the cell editing session.
-   */
-  static final MouseEvent EDIT = new MouseEvent(new Label(), 7, 7, 7, 7, 7, 7,
-false);
-
-  /**
* Creates a new BasicTreeUI object.
*/
   public BasicTreeUI()
   {
 validCachedPreferredSize = false;
 drawingCache = new Hashtable();
 nodeDimensions = createNodeDimensions();
 configureLayoutCache();
 
 editingRow = - 1;


Re: Classpath 0.96: Update

2007-10-11 Thread Roman Kennke
Hi,

 +FAIL: java.awt.TextArea.ScrollbarPaintTest
 +FAIL: java.awt.ScrollPane.ScrollbarPaintTest
 +FAIL: java.awt.Scrollbar.ScrollbarPaintTest
 +FAIL: java.awt.Component.keyPressTest

Also fails with JDK.

 +FAIL: javax.swing.JTree.getCellRenderer

This looks like a real problem, although a minor one. I'll take care of
it.

Cheers, Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[commit-cp] classpath javax/swing/plaf/basic/BasicTreeUI.ja...

2007-10-11 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/10/11 10:33:21

Modified files:
javax/swing/plaf/basic: BasicTreeUI.java 
.  : ChangeLog 

Log message:
2007-10-11  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicTreeUI.java
(EDIT): Removed obsolete constant.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/basic/BasicTreeUI.java?cvsroot=classpathr1=1.157r2=1.158
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9402r2=1.9403




[cp-patches] FYI: Font hashcode

2007-09-21 Thread Roman Kennke
This is a better implementation for java.awt.Font.hashCode(). Before we
created a new identifying string (urgs) and got the hashcode from that
(string hashcode: urgs too). Now we compute the hashcode of the font's
significant properties (name, size, style and transform). In addition to
that we now cache the hashcode, because those properties never change
for a font object.

2007-09-21  Roman Kennke  [EMAIL PROTECTED]

* java/awt/Font.java
(hashCode): New field. Stores a cached hash code.
(hashCode()): Re-implemented. Don't create new string here, instead
make hashcode of name, style, size and transform. Cache hashcode.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/Font.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Font.java,v
retrieving revision 1.40
diff -u -1 -0 -r1.40 Font.java
--- java/awt/Font.java	25 Jun 2007 11:25:52 -	1.40
+++ java/awt/Font.java	21 Sep 2007 08:32:57 -
@@ -222,20 +222,25 @@
*/
   protected int style;
 
 //Serialization constant
   private static final long serialVersionUID = -4206021311591459213L;
 
 
   // The ClasspathToolkit-provided peer which implements this font
   private transient ClasspathFontPeer peer;
 
+  /**
+   * The cached hashcode. A value of 0 (default initialized) means that the
+   * hashcode is not computed yet.
+   */
+  private transient int hashCode;
 
   /**
* Creates a codeFont/code object from the specified string, which
* is in one of the following formats:
* p
* ul
* lifontname-style-pointsize
* lifontname-style
* lifontname-pointsize
* lifontname
@@ -1311,21 +1316,35 @@
   }
 
 
   /**
* Returns a hash value for this font.
* 
* @return A hash for this font.
*/
   public int hashCode()
   {
-return this.toString().hashCode();
+// We cache the hashcode. This makes sense, because the font wouldn't
+// change the relevant properties.
+if (hashCode == 0)
+  {
+hashCode = getName().hashCode() ^ getTransform().hashCode() ^ getSize()
+   ^ getStyle();
+// In the rare case when the above yields 0, we set this to some other
+// value to avoid recomputing over and over again. This is still
+// conform to the specification of hashCode().
+if (hashCode == 0)
+  {
+hashCode = -1;
+  }
+  }
+return hashCode;
   }
 
 
   /**
* Tests whether or not the specified object is equal to this font.  This
* will be true if and only if:
* P
* ul
* liThe object is not codenull/code.
* liThe object is an instance of codeFont/code.


[cp-patches] FYI: LightweightDispatcher fix

2007-09-21 Thread Roman Kennke
This fixes a problem in the lightweight dispatcher, when it dispatches
events for no-more showing components. This lead to occasional glitches
in Swing GUIs.

2007-09-21  Roman Kennke  [EMAIL PROTECTED]

* java/awt/LightweightDispatcher.java
(dispatchEvent): Lock the component's tree to avoid threading
problems.
(redispatch): Only redispatch when component is showing.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/LightweightDispatcher.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/LightweightDispatcher.java,v
retrieving revision 1.17
diff -u -1 -0 -r1.17 LightweightDispatcher.java
--- java/awt/LightweightDispatcher.java	10 Oct 2006 15:29:04 -	1.17
+++ java/awt/LightweightDispatcher.java	21 Sep 2007 08:37:49 -
@@ -105,21 +105,29 @@
   /**
* Receives notification if a mouse event passes along the eventqueue.
*
* @param event the event
*/
   public boolean dispatchEvent(final AWTEvent event)
   {
 if (event instanceof MouseEvent)
   {
 MouseEvent mouseEvent = (MouseEvent) event;
-return handleMouseEvent(mouseEvent);
+/**
+ * The lightweight dispatching relies on the integrity of the
+ * component tree (e.g. isShowing(), getLocationOnScreen(), etc),
+ * therefore we must synchronize on the tree lock here.
+ */
+synchronized (mouseEvent.getComponent().getTreeLock())
+  {
+return handleMouseEvent(mouseEvent);
+  }
   }
 return false;
   }
 
   /**
* Handles all mouse events that are targetted at toplevel containers
* (Window instances) and dispatches them to the correct lightweight child.
* 
* @param ev the mouse event
* @return whether or not we found a lightweight that handled the event.
@@ -279,21 +287,22 @@
* Redispatches the specified mouse event to the specified target with the
* specified id.
*
* @param ev the mouse event
* @param target the new target
* @param id the new id
*/
   private void redispatch(MouseEvent ev, Component target, int id)
   {
 Component source = ev.getComponent();
-if (target != null)
+assert target != null;
+if (target.isShowing())
   {
 // Translate coordinates.
 int x = ev.getX();
 int y = ev.getY();
 for (Component c = target; c != null  c != source; c = c.getParent())
   {
 x -= c.x;
 y -= c.y;
   }
 


[cp-patches] FYI: BasicGraphicsUtil fixlet

2007-09-21 Thread Roman Kennke
This fixes the Y location for the underlining line in
BasicGraphicsUtil.drawStringUnderlineCharAt(). Before it drew the line
anywhere but not below the string. This is fixed now.

2007-09-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicGraphicsUtils.java
(drawStringUnderlineCharAt): Fix Y location of underline.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: javax/swing/plaf/basic/BasicGraphicsUtils.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java,v
retrieving revision 1.19
diff -u -1 -0 -r1.19 BasicGraphicsUtils.java
--- javax/swing/plaf/basic/BasicGraphicsUtils.java	17 Aug 2006 14:45:46 -	1.19
+++ javax/swing/plaf/basic/BasicGraphicsUtils.java	21 Sep 2007 08:42:07 -
@@ -635,21 +635,21 @@
   /* Fall-back. This is likely to produce garbage for any text
* containing right-to-left (Hebrew or Arabic) characters, even
* if the underlined character is left-to-right.
*/
   g.drawString(text, x, y);
   if (drawUnderline)
   {
 fmet = g.getFontMetrics();
 g.fillRect(
   /* x */ x + fmet.stringWidth(text.substring(0, underlinedIndex)),
-  /* y */ y + fmet.getDescent() - 1,
+  /* y */ y + 1,
   /* width */ fmet.charWidth(text.charAt(underlinedIndex)),
   /* height */ 1);
   }
 
   return;
 }
 
 g2 = (Graphics2D) g;
 font = g2.getFont();
 frc = g2.getFontRenderContext();


[commit-cp] classpath java/awt/Font.java ChangeLog

2007-09-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/21 08:33:44

Modified files:
java/awt   : Font.java 
.  : ChangeLog 

Log message:
2007-09-21  Roman Kennke  [EMAIL PROTECTED]

* java/awt/Font.java
(hashCode): New field. Stores a cached hash code.
(hashCode()): Re-implemented. Don't create new string here, 
instead
make hashcode of name, style, size and transform. Cache 
hashcode.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Font.java?cvsroot=classpathr1=1.40r2=1.41
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9388r2=1.9389




[commit-cp] classpath java/awt/LightweightDispatcher.java C...

2007-09-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/21 08:38:21

Modified files:
java/awt   : LightweightDispatcher.java 
.  : ChangeLog 

Log message:
2007-09-21  Roman Kennke  [EMAIL PROTECTED]

* java/awt/LightweightDispatcher.java
(dispatchEvent): Lock the component's tree to avoid threading
problems.
(redispatch): Only redispatch when component is showing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/LightweightDispatcher.java?cvsroot=classpathr1=1.17r2=1.18
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9389r2=1.9390




[commit-cp] classpath javax/swing/plaf/basic/BasicGraphicsU...

2007-09-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/21 08:42:36

Modified files:
javax/swing/plaf/basic: BasicGraphicsUtils.java 
.  : ChangeLog 

Log message:
2007-09-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicGraphicsUtils.java
(drawStringUnderlineCharAt): Fix Y location of underline.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java?cvsroot=classpathr1=1.19r2=1.20
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9390r2=1.9391




[cp-patches] FYI: Fonts/Java2D/Escher fixes

2007-09-20 Thread Roman Kennke
I think I'll follow Mario's advice and check in some new stuff. Here
comes a bunch of fixes for Escher and its J2D and font implementation.
It fixes the Escher peers so that they become actually useful for real
applications. Things fixed/added include:

- (Improved) Caching for glyph vectors, font instances, etc.
- The default for text AA can now be switched by a property.
- Implemented a couple of missing toolkit methods.
- Implemented setTitle() and the insets for windows.
- Re-introduced the option to use X Fonts instead of the TrueType
engine.


2007-09-20  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/font/GNUGlyphVector.java
(cleanOutline): New field, caches the untransformed outline.
(getOutline()): No need to validate here. Already done in
getOutline(float,float).
(getOutline(float,float)): Cache untransformed outlines. Protect
returned shape from modification by wrapping in ShapeWrapper
object.
* gnu/java/awt/font/OpenTypeFontPeer.java: New class. Implements
ClasspathFontPeer for OpenType fonts.
* gnu/java/awt/java2d/AbstractGraphics2D.java
(DEFAULT_TEXT_AA): New constant/property for controlling
default anti-aliasing for text.
(GC_CACHE_SIZE): New constant for the size of the glyph vector
cache.
(shapeCache): Don't make shapeCache thread local. This wouldn't
gain much, because the event dispatch thread is restarted quite
often.
(scanlineConverters): Don't make scanlineConverters thread local,
but instead pool them into a list.
(gvCache): New cache for glyph vectors.
(searchTextKey): New static field, a shared key used for GV caching.
(drawString): Cache glyph vectors.
(getFontRenderContext): Protect the current transform from beeing
changed.
(clone): Check clip for null when cloning.
(drawLine): Use shared shape cache. No need for calling a method here.
(drawRect): Likewise. Add translation to rectangle coordinates.
(fillRect): Use shared shape cache. No need for calling a method here.
(drawRoundRect): Likewise.
(fillRoundRect): Likewise.
(drawOval): Likewise.
(fillOval): Likewise.
(drawArc): Likewise.
(fillArc): Likewise.
(drawPolyline): Likewise.
(drawPolygon): Likewise.
(fillPolygon): Likewise.
(fillShape): Check property for default text AA. Set Y resolution.
(rawDrawLine): Use shared shape cache. No need for calling a method
here.
(rawDrawRect): Likewise.
(rawFillRect): Likewise.
(rawDrawString): Removed. Subclasses override drawString() instead.
(getShapeCache): Removed. No longer needed.
(getScanlineConverter): New helper method for pooling
scanline converters.
(freeScanlineConverter): New helper method for pooling
scanline converters.
* gnu/java/awt/java2d/PixelCoverage.java: New class. Used by the
reworked scanline converter.
* gnu/java/awt/java2d/ScanlineConverter.java
(Y_RESOLUTION): Removed. The Y resolution is now specified
by the caller.
(yResolution): New field. Stores the Y resolution.
(renderShape): Take y resolution as argument.
(setResolution): Take y resolution as argument.
* gnu/java/awt/java2d/ShapeWrapper.java: New class. Protects
shape objects from modification by application code.
* gnu/java/awt/java2d/TextCacheKey.java: New class. Used for
caching GlyphVectors.
* gnu/java/awt/peer/x/XFontPeer2.java: Removed. This is now
implemented in OpenTypeFontPeer now.
* gnu/java/awt/peer/x/XEventPump.java
(handleEvent): Check insets.
* gnu/java/awt/peer/x/XFontPeer.java
Changed class and method names for changed Escher API.
(clinit): Use font properties from xfonts.properties.
(canDisplay): Changed to take int argument.
* gnu/java/awt/peer/x/XFramePeer.java
(XFramePeer): Set the title of the frame on creation time.
(setTitle): Implemented.
* gnu/java/awt/peer/x/XGraphics2D.java
(imageCache): New field. Caches native representations for
images.
(drawString): New method. Optimized version for X fonts.
(fillScanline): Removed.
(fillScanlineAA): Removed.
(rawDrawImage): Optimized drawing for ZPixmap-backed images.
(rawDrawRect): Optimized rectangle drawing.
(renderScanline): Added compositing code.
(setFont): Overridden for X font support.
(setPaint): Added TODO.
* gnu/java/awt/peer/x/XGraphicsConfiguration.java
(getSize): New helper method for XToolkit.
(getResolution): New helper method for XToolkit.
* gnu/java/awt/peer/x/XGraphicsEnvironment.java
(getAvailableFontFamilyNames): Implemented

[commit-cp] classpath/resource/gnu/java/awt/font

2007-09-20 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/20 13:53:49

New directory:
resource/gnu/java/awt/font

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/resource/gnu/java/awt/font/?cvsroot=classpath




[commit-cp] classpath ChangeLog gnu/java/awt/font/GNUGlyphV...

2007-09-20 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/20 14:01:09

Modified files:
.  : ChangeLog 
gnu/java/awt/font: GNUGlyphVector.java 
gnu/java/awt/java2d: AbstractGraphics2D.java 
 ScanlineConverter.java 
gnu/java/awt/peer/x: XEventPump.java XFramePeer.java 
 XGraphics2D.java 
 XGraphicsConfiguration.java 
 XGraphicsEnvironment.java XToolkit.java 
 XWindowPeer.java ZPixmapDataBuffer.java 
Added files:
gnu/java/util  : LRUCache.java 
resource/gnu/java/awt/font: fonts.properties 
resource/gnu/java/awt/peer/x: xfonts.properties 
gnu/java/awt/font: OpenTypeFontPeer.java 
gnu/java/awt/java2d: PixelCoverage.java ShapeWrapper.java 
 TextCacheKey.java 
gnu/java/awt/peer/x: XFontPeer.java 
Removed files:
gnu/java/awt/peer/x: XFontPeer2.java 

Log message:
2007-09-20  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/font/GNUGlyphVector.java
(cleanOutline): New field, caches the untransformed outline.
(getOutline()): No need to validate here. Already done in
getOutline(float,float).
(getOutline(float,float)): Cache untransformed outlines. Protect
returned shape from modification by wrapping in ShapeWrapper
object.
* gnu/java/awt/font/OpenTypeFontPeer.java: New class. Implements
ClasspathFontPeer for OpenType fonts.
* gnu/java/awt/java2d/AbstractGraphics2D.java
(DEFAULT_TEXT_AA): New constant/property for controlling
default anti-aliasing for text.
(GC_CACHE_SIZE): New constant for the size of the glyph vector
cache.
(shapeCache): Don't make shapeCache thread local. This wouldn't
gain much, because the event dispatch thread is restarted quite
often.
(scanlineConverters): Don't make scanlineConverters thread 
local,
but instead pool them into a list.
(gvCache): New cache for glyph vectors.
(searchTextKey): New static field, a shared key used for GV 
caching.
(drawString): Cache glyph vectors.
(getFontRenderContext): Protect the current transform from 
beeing
changed.
(clone): Check clip for null when cloning.
(drawLine): Use shared shape cache. No need for calling a 
method here.
(drawRect): Likewise. Add translation to rectangle coordinates.
(fillRect): Use shared shape cache. No need for calling a 
method here.
(drawRoundRect): Likewise.
(fillRoundRect): Likewise.
(drawOval): Likewise.
(fillOval): Likewise.
(drawArc): Likewise.
(fillArc): Likewise.
(drawPolyline): Likewise.
(drawPolygon): Likewise.
(fillPolygon): Likewise.
(fillShape): Check property for default text AA. Set Y 
resolution.
(rawDrawLine): Use shared shape cache. No need for calling a 
method
here.
(rawDrawRect): Likewise.
(rawFillRect): Likewise.
(rawDrawString): Removed. Subclasses override drawString() 
instead.
(getShapeCache): Removed. No longer needed.
(getScanlineConverter): New helper method for pooling
scanline converters.
(freeScanlineConverter): New helper method for pooling
scanline converters.
* gnu/java/awt/java2d/PixelCoverage.java: New class. Used by the
reworked scanline converter.
* gnu/java/awt/java2d/ScanlineConverter.java
(Y_RESOLUTION): Removed. The Y resolution is now specified
by the caller.
(yResolution): New field. Stores the Y resolution.
(renderShape): Take y resolution as argument.
(setResolution): Take y resolution as argument.
* gnu/java/awt/java2d/ShapeWrapper.java: New class. Protects
shape objects from modification by application code.
* gnu/java/awt/java2d/TextCacheKey.java: New class. Used for
caching GlyphVectors.
* gnu/java/awt/peer/x/XFontPeer2.java: Removed. This is now
implemented in OpenTypeFontPeer now.
* gnu/java/awt/peer/x/XEventPump.java
(handleEvent): Check insets.
* gnu/java/awt/peer/x/XFontPeer.java
Changed class and method names

Re: Classpath / Icedtea Qtopia

2007-09-18 Thread Roman Kennke
Hi,

 1.) Compilation of Classpath 0.95 with Qtopia 4.3 fails:
 When compiling qtembeddedwindowpeer.cpp, 
 qx11embed_x11.h is included.
 This header exists in Qtopia, but is uncompileable:
 It needs the XEvent type, which exists only in X11-based builds of Qt.
 
 Any fixes for that?

Not out of the box. The Qt peers are somewhat unmaintained at the
moment. I did some splitting out in the GTK peers lately, so that they
compile without X. I guess, something similar could be done for the Qt
peers.

 Has anybody ever been able to run classpath on top of Qtopia?

Not that I know.

 Any other options for framebuffer-based (X11-less) classpath?

As I said, the GTK peers (in CVS HEAD) should be able to compile without
X, and might or might not run on GTK/Embedded.

 2.) Icedtea currently needs X11 and Gtk.
 Are there any plans to support other GUI backends in Icedtea
 (Qt / Qtopia, Escher, ...)?

It would be a worthwhile effort to split out the Classpath peers, so
that they can be used with OpenJDK/IcedTea. I've had some success with
the GTK peers a while ago, but I'm not sure if this works out of the box
right now.

Kind regards, Roman Kennke
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] FYI: Fix Eclipse Build-Path

2007-09-13 Thread Roman Kennke
For some reason, the javah tool was excluded from Eclipse's build-path.
This made the build fail in Eclipse. This patch fixes this.

2007-09-14  Roman Kennke  [EMAIL PROTECTED]

* .classpath: Include javah in Eclipse build.


/Roman

-- 
http://kennke.org/blog/
Index: .classpath
===
RCS file: /cvsroot/classpath/classpath/.classpath,v
retrieving revision 1.18
diff -u -1 -0 -r1.18 .classpath
--- .classpath	11 Dec 2006 11:32:20 -	1.18
+++ .classpath	13 Sep 2007 22:30:28 -
@@ -1,14 +1,15 @@
 ?xml version=1.0 encoding=UTF-8?
 classpath
-	classpathentry excluding=.externalToolBuilders/|.settings/|ChangeLog*|Makefile*|autom4te.cache/|compat/|config*|doc/|examples/|external/|external/relaxngDatatype/|include/|install/|lib/|m4/|native/|resource/|scripts/|test/|testsuite/|tools/|vm/reference/|tools/external/asm/|gnu/java/awt/peer/x/ kind=src path=/
+	classpathentry excluding=.externalToolBuilders/|.settings/|ChangeLog*|Makefile*|autom4te.cache/|compat/|config*|doc/|examples/|external/|external/relaxngDatatype/|include/|install/|lib/|m4/|native/|resource/|scripts/|test/|testsuite/|tools/|tools/external/asm/|vm/reference/ kind=src path=/
 	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in|README.txt kind=src path=external/relaxngDatatype/
 	classpathentry kind=src path=external/jsr166/
-	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in|README|gnu/classpath/tools/javah/|external/asm/ kind=src path=tools/
+	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in|README|external/asm/ kind=src path=tools/
 	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in kind=src path=resource/
 	classpathentry excluding=.cvsignore|Makefile.am kind=src path=vm/reference/
 	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in|README kind=src path=external/sax/
 	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in|README kind=src path=external/w3c_dom/
 	classpathentry excluding=.cvsignore|Makefile|Makefile.am|Makefile.in|Makefile.jawt|Makefile.jawt.in|README kind=src path=examples/
 	classpathentry kind=src path=tools/external/asm/
+	classpathentry kind=lib path=/escher/build/
 	classpathentry kind=output path=install/share/classpath/
 /classpath


[commit-cp] classpath .classpath ChangeLog

2007-09-13 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/13 22:31:05

Modified files:
.  : .classpath ChangeLog 

Log message:
2007-09-14  Roman Kennke  [EMAIL PROTECTED]

* .classpath: Include javah in Eclipse build.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/.classpath?cvsroot=classpathr1=1.18r2=1.19
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9380r2=1.9381




[cp-patches] FYI: GTK peers without X

2007-09-11 Thread Roman Kennke
Hi,

This patch changes the GTK peers, so that they can be compiled and used
on systems without X, for example on GTK for embedded or Windows
systems. In many places this only removes imports that are unused, there
are only two notable changes:
- The GdkRobotPeer now has #ifdef HAVE_XTEST for all operations and does
nothing if XTest is not present on compile time.
- The code for fetching the frame extents now uses the (new?) GDK
function gdk_window_get_frame_extents() rather than pulling the frame
extents using the extended window property _NET_FRAME_EXTENTS.

2007-09-11  Roman Kennke  [EMAIL PROTECTED]

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
Removed unusued excludes. Put Xrender includes in HAVE_XRENDER
conditional.
(flush): Use gdk_display_flush() instead of XFlush().
(initState): Use GDK/Cairo functions to get cairo_t object.
(initFromVolatile): Likewise.
*
native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
Use HAVE_XTEST conditionals for code that uses XTest.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
Removed unused includes. Rewrote frame-extents code to use
gdk_window_get_frame_extents() rather than the X window
properties
directly.
* include/gnu_java_awt_peer_gtk_ComponentGraphics.h
(initFromVolatile): Removed width and height parameters.
* gnu/java/awt/peer/gtk/ComponentGraphics.java
(initFromVolatile): Remove width and height parameters.
* gnu/java/awt/peer/gtk/VolatileImageGraphics.java
(VolatileImageGraphics): Use initFromVolatile without width and
height.
* configure.ac: Check for presence of XTest, and define
HAVE_XTEST
accordingly.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: include/gnu_java_awt_peer_gtk_ComponentGraphics.h
===
RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,v
retrieving revision 1.11
diff -u -1 -0 -r1.11 gnu_java_awt_peer_gtk_ComponentGraphics.h
--- include/gnu_java_awt_peer_gtk_ComponentGraphics.h	9 Apr 2007 21:34:27 -	1.11
+++ include/gnu_java_awt_peer_gtk_ComponentGraphics.h	11 Sep 2007 09:44:10 -
@@ -4,21 +4,21 @@
 #define __gnu_java_awt_peer_gtk_ComponentGraphics__
 
 #include jni.h
 
 #ifdef __cplusplus
 extern C
 {
 #endif
 
 JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_initState (JNIEnv *env, jobject, jobject);
-JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_initFromVolatile (JNIEnv *env, jobject, jlong, jint, jint);
+JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_initFromVolatile (JNIEnv *env, jobject, jlong);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_start_1gdk_1drawing (JNIEnv *env, jobject);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_end_1gdk_1drawing (JNIEnv *env, jobject);
 JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_hasXRender (JNIEnv *env, jclass);
 JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_nativeGrab (JNIEnv *env, jclass, jobject);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative (JNIEnv *env, jobject, jobject, jint, jint, jint, jint, jint, jint);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile (JNIEnv *env, jobject, jobject, jlong, jint, jint, jint, jint, jint, jint, jint, jint);
 
 #ifdef __cplusplus
 }
 #endif
Index: configure.ac
===
RCS file: /cvsroot/classpath/classpath/configure.ac,v
retrieving revision 1.212
diff -u -1 -0 -r1.212 configure.ac
--- configure.ac	9 Jul 2007 16:32:20 -	1.212
+++ configure.ac	11 Sep 2007 09:44:10 -
@@ -478,25 +478,27 @@
 AC_SUBST(XSLT_LIBS)
 AC_SUBST(XSLT_CFLAGS)
   fi
 
   dnl Check for AWT related gthread/gtk
   if test x${COMPILE_GTK_PEER} = xyes; then
 AC_PATH_XTRA
 if test

Re: [cp-patches] FYI: GTK peers without X

2007-09-11 Thread Roman Kennke
Hi Tom,

  - The code for fetching the frame extents now uses the (new?) GDK
  function gdk_window_get_frame_extents() rather than pulling the frame
  extents using the extended window property _NET_FRAME_EXTENTS.
 
 This will result in the wrong insets being calculated upon window 
 realization, 
 since gdk_window_get_frame_extents relies on the window being mapped.  For 
 now 
 you can ifdef this code based on the presence or absence of X.  Ideally 
 though, 
 _NET_FRAME_EXTENTS support would be added to the X11 implementation of 
 gdk_window_get_frame_extents.

Not sure if I understand correctly. Window realization is when the
window object is created, but not yet visible (==mapped), right? In this
case, the _NET_FRAME_EXTENTS thing reports 0-extents, because it doesn't
know yet about the real borders. This is exactly what
gdk_window_get_frame_extents() does in this case. When the window is
mapped, we receive a callback and fetch the real extents. What's the
difference between _NET_FRAME_EXTENTS and gdk_window_get_frame_extents()
then?

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[commit-cp] classpath include/gnu_java_awt_peer_gtk_Compone...

2007-09-11 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/09/11 09:48:50

Modified files:
include: gnu_java_awt_peer_gtk_ComponentGraphics.h 
.  : configure.ac 
native/jni/gtk-peer: gnu_java_awt_peer_gtk_CairoGraphics2D.c 
 gnu_java_awt_peer_gtk_CairoSurface.c 
 gnu_java_awt_peer_gtk_ComponentGraphics.c 
 gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c 
 gnu_java_awt_peer_gtk_GdkRobotPeer.c 
 gnu_java_awt_peer_gtk_GtkImage.c 
 gnu_java_awt_peer_gtk_GtkToolkit.c 
 gnu_java_awt_peer_gtk_GtkVolatileImage.c 
 gnu_java_awt_peer_gtk_GtkWindowPeer.c 
gnu/java/awt/peer/gtk: ComponentGraphics.java 
   VolatileImageGraphics.java 

Log message:
2007-09-11  Roman Kennke  [EMAIL PROTECTED]

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
Removed unusued excludes. Put Xrender includes in HAVE_XRENDER
conditional.
(flush): Use gdk_display_flush() instead of XFlush().
(initState): Use GDK/Cairo functions to get cairo_t object.
(initFromVolatile): Likewise.
* 
native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
Use HAVE_XTEST conditionals for code that uses XTest.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
Removed unused includes.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
Removed unused includes. Rewrote frame-extents code to use
gdk_window_get_frame_extents() rather than the X window 
properties
directly.
* include/gnu_java_awt_peer_gtk_ComponentGraphics.h
(initFromVolatile): Removed width and height parameters.
* gnu/java/awt/peer/gtk/ComponentGraphics.java
(initFromVolatile): Remove width and height parameters.
* gnu/java/awt/peer/gtk/VolatileImageGraphics.java
(VolatileImageGraphics): Use initFromVolatile without width and
height.
* configure.ac: Check for presence of XTest, and define 
HAVE_XTEST
accordingly.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h?cvsroot=classpathr1=1.11r2=1.12
http://cvs.savannah.gnu.org/viewcvs/classpath/configure.ac?cvsroot=classpathr1=1.212r2=1.213
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c?cvsroot=classpathr1=1.25r2=1.26
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c?cvsroot=classpathr1=1.24r2=1.25
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c?cvsroot=classpathr1=1.21r2=1.22
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c?cvsroot=classpathr1=1.6r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c?cvsroot=classpathr1=1.6r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c?cvsroot=classpathr1=1.27r2=1.28
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c?cvsroot=classpathr1=1.37r2=1.38
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c?cvsroot=classpathr1=1.72r2=1.73
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java?cvsroot=classpathr1=1.28r2=1.29
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java?cvsroot=classpathr1=1.13r2=1.14




Re: [cp-patches] FYI: AWT stuff

2007-08-23 Thread Roman Kennke
Hi there,

Am Donnerstag, den 23.08.2007, 15:35 -0400 schrieb Francis Kung:
 I started looking into the complete graphical lockup of all classpath 
 awt/swing apps, and I think this may be the problem:
 
  This adds a bunch of 1.6 methods and constants to our AWT, and fixes
  some issues in the peers. Together with these patches and a bunch of
  modifications on OpenJDK, I was able to use the GTK peers in OpenJDK to
  get Swing running:
  
  * gnu/java/awt/peer/gtk/GtkComponentPeer.java
  (postMouseEvent): Use MouseEvent constructor with absolute coordinates
  to avoid deadlock (over getLocationOnScreen()).

Yeah it's definitely related to this. I found out that using the
recursive lock instead of the GTK lock helps already. Not sure how to
solve this yet, had no time to dig this.

 Currently testing a fix...

Cool. Keep me updated.

/Roman
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




Re: [cp-patches] FYI: AWT stuff

2007-08-23 Thread Roman Kennke
Hey,

Am Donnerstag, den 23.08.2007, 16:09 -0400 schrieb Francis Kung:
  Yeah it's definitely related to this. I found out that using the
  recursive lock instead of the GTK lock helps already. Not sure how to
  solve this yet, had no time to dig this.
  
  Currently testing a fix...
  
  Cool. Keep me updated.
 
 Committing the attached patch, which resolves the deadlock... the same 
 unlocked pattern has been used for a number of other GTK methods, and 
 seems appropriate here too.
 
 Unfortunately, graphics still don't seem to work - mouse events don't 
 seem to register (clicking on buttons in the Swing demo has no effect, 
 for example)...

Strange thing is, AWT/Swing seems to work here for me, even before your
patch. I have a ton of uncommitted stuff lying around, I gotta check
this. Hope we don't do dupe work. The unlocked pattern seems ok though.
For the mouse events, it might have something to do with how Swing
recognizes the 1st button. There's a method to check that in
SwingUtilities.isLeftMouseButton() IIRC. Hope that helps.

Cheers, Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[cp-patches] FYI: Some Escher peer enhancements

2007-07-16 Thread Roman Kennke
This fixes a couple of issues in the X peers. See below.

2007-07-13  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(clip(Shape)): Call setClip when the clip changes.
(drawImage): Add translation.
(drawLine): Add translation.
* gnu/java/awt/peer/x/PixmapVolatileImage.java
(getPixmap): New method.
* gnu/java/awt/peer/x/XEventPump.java
(XEventPump): Name thread. Start as daemon thread.
* gnu/java/awt/peer/x/XGraphics2D.java
(rawDrawImage): Special handling for PixmapVolatileImage.
(rawDrawLine): Don't add translation here. This is done in
the superclass.
(rawFillRect): Don't add translation here. This is done in
the superclass.
(renderScanline): Added null check.

/Roman
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.18
diff -u -1 -0 -r1.18 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java	24 May 2007 20:28:43 -	1.18
+++ gnu/java/awt/java2d/AbstractGraphics2D.java	16 Jul 2007 15:04:24 -
@@ -907,22 +907,22 @@
 
   /**
* Intersects the clip of this graphics object with the specified clip.
*
* @param s the clip with which the current clip should be intersected
*/
   public void clip(Shape s)
   {
 // Initialize clip if not already present.
 if (clip == null)
-  clip = s;
-
+  setClip(s);
+
 // This is so common, let's optimize this. 
 else if (clip instanceof Rectangle  s instanceof Rectangle)
   {
 Rectangle clipRect = (Rectangle) clip;
 Rectangle r = (Rectangle) s;
 computeIntersection(r.x, r.y, r.width, r.height, clipRect);
 // Call setClip so that subclasses get notified.
 setClip(clipRect);
   }
else
@@ -1150,21 +1150,23 @@
   /**
* Draws a line from (x1, y1) to (x2, y2).
*
* This implementation transforms the coordinates and forwards the call to
* [EMAIL PROTECTED] #rawDrawLine}.
*/
   public void drawLine(int x1, int y1, int x2, int y2)
   {
 if (isOptimized)
   {
-rawDrawLine(x1, y1, x2, y2);
+int tx = (int) transform.getTranslateX();
+int ty = (int) transform.getTranslateY();
+rawDrawLine(x1 + tx, y1 + ty, x2 + tx, y2 + ty);
   }
 else
   {
 ShapeCache sc = getShapeCache();
 if (sc.line == null)
   sc.line = new Line2D.Float();
 sc.line.setLine(x1, y1, x2, y2);
 draw(sc.line);
   }
   }
@@ -1190,21 +1192,22 @@
*
* @param x the upper left corner, X coordinate
* @param y the upper left corner, Y coordinate
* @param width the width of the rectangle
* @param height the height of the rectangle
*/
   public void fillRect(int x, int y, int width, int height)
   {
 if (isOptimized)
   {
-rawFillRect(x, y, width, height);
+rawFillRect(x + (int) transform.getTranslateX(),
+y + (int) transform.getTranslateY(), width, height);
   }
 else
   {
 ShapeCache sc = getShapeCache();
 if (sc.rect == null)
   sc.rect = new Rectangle();
 sc.rect.setBounds(x, y, width, height);
 fill(sc.rect);
   }
   }
@@ -1383,21 +1386,24 @@
*
* @param image the image to render
* @param x the x location to render to
* @param y the y location to render to
* @param observer the image observer to receive notification
*/
   public boolean drawImage(Image image, int x, int y, ImageObserver observer)
   {
 boolean ret;
 if (isOptimized)
-  ret = rawDrawImage(image, x, y, observer);
+  {
+ret = rawDrawImage(image, x + (int) transform.getTranslateX(),
+   y + (int) transform.getTranslateY(), observer);
+  }
 else
   {
 AffineTransform t = new AffineTransform();
 t.translate(x, y);
 ret = drawImage(image, t, observer);
   }
 return ret;
   }
 
   /**
Index: gnu/java/awt/peer/x/PixmapVolatileImage.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/PixmapVolatileImage.java,v
retrieving revision 1.1
diff -u -1 -0 -r1.1 PixmapVolatileImage.java
--- gnu/java/awt/peer/x/PixmapVolatileImage.java	13 Jul 2007 19:43:44 -	1.1
+++ gnu/java/awt/peer/x/PixmapVolatileImage.java	16 Jul 2007 15:04:24 -
@@ -166,11 +166,20 @@
   {
 return null

[cp-patches] FYI: X Peer image stuff

2007-07-13 Thread Roman Kennke
This implements VolatileImage and DataBuffer for the Escher peers.


2007-07-13  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/PixmapVolatileImage.java: New class.
* gnu/java/awt/peer/x/XGraphicsConfiguration.java
(createCompatibleImage(int,int)): Delegate to the 3-int overload.
(createCompatibleImage(int,int,int)): Implemented. Using
the ZPixmapDataBuffer for OPAQUE images.
(createCompatibleVolatileImage(int,int)): Delegate to the 3-int
overload.
(createCompatibleVolatileImage(int,int,int)): Implemented. Using
PixmapVolatileImage.
* gnu/java/awt/peer/x/XWindowPeer.java
(createImage): Return a PixmapVolatileImage (for now).
(createVolatileImage): Implemented, using PixmapVolatileImage.
* gnu/java/awt/peer/x/ZPixmapDataBuffer.java
New class.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
? gnu/java/awt/peer/x/PixmapVolatileImage.java
? gnu/java/awt/peer/x/ZPixmapDataBuffer.java
Index: gnu/java/awt/peer/x/XGraphicsConfiguration.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java,v
retrieving revision 1.1
diff -u -1 -0 -r1.1 XGraphicsConfiguration.java
--- gnu/java/awt/peer/x/XGraphicsConfiguration.java	29 Jun 2006 15:15:56 -	1.1
+++ gnu/java/awt/peer/x/XGraphicsConfiguration.java	13 Jul 2007 19:32:25 -
@@ -32,64 +32,107 @@
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 package gnu.java.awt.peer.x;
 
 import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
+import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
 import java.awt.geom.AffineTransform;
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.Raster;
+import java.awt.image.SampleModel;
 import java.awt.image.VolatileImage;
+import java.awt.image.WritableRaster;
 
 public class XGraphicsConfiguration
 extends GraphicsConfiguration
 {
 
   XGraphicsDevice device;
 
   XGraphicsConfiguration(XGraphicsDevice dev)
   {
 device = dev;
   }
 
   public GraphicsDevice getDevice()
   {
 return device;
   }
 
   public BufferedImage createCompatibleImage(int w, int h)
   {
-return new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+return createCompatibleImage(w, h, Transparency.OPAQUE);
   }
 
-  public VolatileImage createCompatibleVolatileImage(int w, int h)
+  public BufferedImage createCompatibleImage(int w, int h, int transparency)
   {
-// TODO: Implement this.
-throw new UnsupportedOperationException(Not yet implemented.);
+BufferedImage bi;
+switch (transparency)
+  {
+case Transparency.OPAQUE:
+  DataBuffer buffer = new ZPixmapDataBuffer(w, h);
+  SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h,
+4, w * 4,
+new int[]{0, 1, 2, 3 });
+  ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
+  ColorModel cm = new ComponentColorModel(cs, true, false,
+  Transparency.OPAQUE,
+  DataBuffer.TYPE_BYTE);
+  WritableRaster raster = Raster.createWritableRaster(sm, buffer,
+  new Point(0, 0));
+  bi = new BufferedImage(cm, raster, false, null);
+  break;
+case Transparency.BITMASK:
+case Transparency.TRANSLUCENT:
+  bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+  break;
+default:
+  throw new IllegalArgumentException(Illegal transparency: 
+ + transparency);
+  }
+return bi;
   }
 
-  public VolatileImage createCompatibleVolatileImage(int width, int height,
- int transparency)
+  public VolatileImage createCompatibleVolatileImage(int w, int h)
   {
-// TODO: Implement this.
-throw new UnsupportedOperationException(Not yet implemented.);
+return createCompatibleVolatileImage

[commit-cp] classpath/gnu/java/awt/peer/x PixmapVolatileIma...

2007-07-13 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/07/13 19:43:45

Added files:
gnu/java/awt/peer/x: PixmapVolatileImage.java 
 ZPixmapDataBuffer.java 

Log message:
Whoops. Forgot those.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/PixmapVolatileImage.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java?cvsroot=classpathrev=1.1




[cp-patches] FYI: GTK Peer fixlet

2007-07-10 Thread Roman Kennke
This patch swaps two assertions and solves one bug :-)

2007-07-10  Roman Kennke  [EMAIL PROTECTED]

PR 32645
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
(copyPixbuf): Swap asserts.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c,v
retrieving revision 1.5
diff -u -1 -0 -r1.5 gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c	21 Jun 2007 14:07:01 -	1.5
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c	10 Jul 2007 14:31:52 -
@@ -101,24 +101,24 @@
   gint pwidth, pheight;
   GdkPixbuf *pixbuf;
   GdkDrawable *drawable;
   GdkWindow *win;
   GtkWidget *widget = NULL;
   void *ptr = NULL;
 
   gdk_threads_enter();
 
   ptr = gtkpeer_get_widget (env, peer);
-  g_assert (widget != NULL);
+  g_assert (ptr != NULL);
 
   widget = GTK_WIDGET (ptr);
-  g_assert (ptr != NULL);
+  g_assert (widget != NULL);
 
   cp_gtk_grab_current_drawable (widget, drawable, win);
   g_assert (drawable != NULL);
 
   pixbuf = cp_gtk_image_get_pixbuf( env, image );
   g_assert( pixbuf != NULL);
 
   pwidth = gdk_pixbuf_get_width( pixbuf );
   pheight = gdk_pixbuf_get_height( pixbuf );
 


[cp-patches] FYI: AWT stuff

2007-06-25 Thread Roman Kennke
This adds a bunch of 1.6 methods and constants to our AWT, and fixes
some issues in the peers. Together with these patches and a bunch of
modifications on OpenJDK, I was able to use the GTK peers in OpenJDK to
get Swing running:

http://kennke.org/blog/2007/06/25/openjdk-swing-on-gtk-peers/

2007-06-25  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/ClasspathFontPeer.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/gtk/GdkFontPeer.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
(postMouseEvent): Use MouseEvent constructor with absolute coordinates
to avoid deadlock (over getLocationOnScreen()).
* gnu/java/awt/peer/gtk/VolatileImageGraphics.java
(getDeviceConfiguration): Fall back to the default configuration
if the component is not set.
* gnu/java/awt/peer/qt/QtFontMetrics.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/qt/QtFontPeer.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/x/XFontPeer2.java
(canDisplay): Take character as integer codepoint.
* include/gnu_java_awt_peer_qt_QtFontMetrics.h
(canDisplay): Take character as integer codepoint.
* java/awt/Font.java
(DIALOG): New constant.
(DIALOG_INPUT): New constant.
(MONOSPACED): New constant.
(SANS_SERIF): New constant.
(SERIF): New constant.
(Font(Font)): New constructor.
(canDisplay(char)): Use new canDisplay(int) method.
(canDisplay(int)): New method.
(hasLayoutAttributes): New method.
* java/awt/event/MouseEvent.java
(absX,absY): New fields.
(MouseEvent): New constructor with absolute coordinates.
(getLocationOnScreen): New method.
(getXOnScreen): New method.
(getYOnScreen): New method.
* native/jni/qt-peer/qtfontmetrics.cpp
(canDisplay): Take character as integer codepoint.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: include/gnu_java_awt_peer_qt_QtFontMetrics.h
===
RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_qt_QtFontMetrics.h,v
retrieving revision 1.9
diff -u -1 -0 -r1.9 gnu_java_awt_peer_qt_QtFontMetrics.h
--- include/gnu_java_awt_peer_qt_QtFontMetrics.h	30 Apr 2006 10:37:36 -	1.9
+++ include/gnu_java_awt_peer_qt_QtFontMetrics.h	25 Jun 2007 11:25:17 -
@@ -7,21 +7,21 @@
 
 #ifdef __cplusplus
 extern C
 {
 #endif
 
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_init (JNIEnv *env, jobject, jobject);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_initGraphics (JNIEnv *env, jobject, jobject, jobject);
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_dispose (JNIEnv *env, jobject);
 JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getStringBounds (JNIEnv *env, jobject, jstring);
-JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_canDisplay (JNIEnv *env, jobject, jchar);
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_canDisplay (JNIEnv *env, jobject, jint);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getAscent (JNIEnv *env, jobject);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getDescent (JNIEnv *env, jobject);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getHeight (JNIEnv *env, jobject);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getLeading (JNIEnv *env, jobject);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getMaxAdvance (JNIEnv *env, jobject);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_charWidth (JNIEnv *env, jobject, jchar);
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_stringWidth (JNIEnv *env, jobject, jstring);
 
 #ifdef __cplusplus
 }
Index: gnu/java/awt/peer/ClasspathFontPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/ClasspathFontPeer.java,v
retrieving revision 1.11
diff -u -1 -0 -r1.11 ClasspathFontPeer.java
--- gnu/java/awt/peer/ClasspathFontPeer.java	12 Apr 2007 14:02:16 -	1.11
+++ gnu/java/awt/peer/ClasspathFontPeer.java	25 Jun 2007 11:25:18 -
@@ -637,21 +637,21 @@
   /* Remaining methods are abstract */
 
   /** 
* Implementation of [EMAIL PROTECTED] Font#canDisplay(char)}
*
* @param font the font this peer is being called from. This may be
* useful if you are sharing peers between

[commit-cp] classpath include/gnu_java_awt_peer_qt_QtFontMe...

2007-06-25 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/06/25 11:25:52

Modified files:
include: gnu_java_awt_peer_qt_QtFontMetrics.h 
.  : ChangeLog 
gnu/java/awt/peer: ClasspathFontPeer.java 
gnu/java/awt/peer/gtk: GdkFontPeer.java GtkComponentPeer.java 
   VolatileImageGraphics.java 
gnu/java/awt/peer/qt: QtFontMetrics.java QtFontPeer.java 
gnu/java/awt/peer/x: XFontPeer2.java 
java/awt   : Font.java 
java/awt/event : MouseEvent.java 
native/jni/qt-peer: qtfontmetrics.cpp 

Log message:
2007-06-25  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/ClasspathFontPeer.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/gtk/GdkFontPeer.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
(postMouseEvent): Use MouseEvent constructor with absolute 
coordinates
to avoid deadlock (over getLocationOnScreen()).
* gnu/java/awt/peer/gtk/VolatileImageGraphics.java
(getDeviceConfiguration): Fall back to the default configuration
if the component is not set.
* gnu/java/awt/peer/qt/QtFontMetrics.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/qt/QtFontPeer.java
(canDisplay): Take character as integer codepoint.
* gnu/java/awt/peer/x/XFontPeer2.java
(canDisplay): Take character as integer codepoint.
* include/gnu_java_awt_peer_qt_QtFontMetrics.h
(canDisplay): Take character as integer codepoint.
* java/awt/Font.java
(DIALOG): New constant.
(DIALOG_INPUT): New constant.
(MONOSPACED): New constant.
(SANS_SERIF): New constant.
(SERIF): New constant.
(Font(Font)): New constructor.
(canDisplay(char)): Use new canDisplay(int) method.
(canDisplay(int)): New method.
(hasLayoutAttributes): New method.
* java/awt/event/MouseEvent.java
(absX,absY): New fields.
(MouseEvent): New constructor with absolute coordinates.
(getLocationOnScreen): New method.
(getXOnScreen): New method.
(getYOnScreen): New method.
* native/jni/qt-peer/qtfontmetrics.cpp
(canDisplay): Take character as integer codepoint.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/include/gnu_java_awt_peer_qt_QtFontMetrics.h?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9343r2=1.9344
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/ClasspathFontPeer.java?cvsroot=classpathr1=1.11r2=1.12
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java?cvsroot=classpathr1=1.24r2=1.25
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java?cvsroot=classpathr1=1.127r2=1.128
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java?cvsroot=classpathr1=1.12r2=1.13
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/qt/QtFontMetrics.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/qt/QtFontPeer.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XFontPeer2.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Font.java?cvsroot=classpathr1=1.39r2=1.40
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/event/MouseEvent.java?cvsroot=classpathr1=1.13r2=1.14
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/qt-peer/qtfontmetrics.cpp?cvsroot=classpathr1=1.2r2=1.3




[cp-patches] FYI: Remove @Overrides

2007-06-22 Thread Roman Kennke
This patch removes some @Overrides from interface implementation
methods. This has broken compilation with pre 1.6 compilers.

2007-06-22  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/GLightweightPeer.java
* gnu/java/awt/peer/gtk/GdkRobotPeer.java
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
* gnu/java/awt/peer/gtk/GtkFramePeer.java
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
* gnu/java/awt/peer/qt/QtComponentPeer.java
* gnu/java/awt/peer/qt/QtFramePeer.java
* gnu/java/awt/peer/qt/QtWindowPeer.java
* gnu/java/awt/peer/swing/SwingComponentPeer.java
* gnu/java/awt/peer/swing/SwingWindowPeer.java
* gnu/java/awt/peer/x/XFramePeer.java:
Removed @Override annotations from some interface implementation
methods to ensure 1.5 compatibility.

/Roman
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/GLightweightPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/GLightweightPeer.java,v
retrieving revision 1.12
diff -u -1 -0 -r1.12 GLightweightPeer.java
--- gnu/java/awt/peer/GLightweightPeer.java	22 Jun 2007 09:52:06 -	1.12
+++ gnu/java/awt/peer/GLightweightPeer.java	22 Jun 2007 14:27:07 -
@@ -443,20 +443,19 @@
   {
 // Nothing to do here for lightweights.
 return true;
   }
 
   public void layout()
   {
 // Nothing to do here for lightweights.
   }
 
-  @Override
   public boolean requestFocus(Component lightweightChild, boolean temporary,
   boolean focusedWindowChangeAllowed,
   long time, sun.awt.CausedFocusEvent.Cause cause)
   {
 // Always grant focus request.
 return true;
   }
 
 }
Index: gnu/java/awt/peer/gtk/GdkRobotPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java,v
retrieving revision 1.5
diff -u -1 -0 -r1.5 GdkRobotPeer.java
--- gnu/java/awt/peer/gtk/GdkRobotPeer.java	22 Jun 2007 09:52:06 -	1.5
+++ gnu/java/awt/peer/gtk/GdkRobotPeer.java	22 Jun 2007 14:27:07 -
@@ -85,16 +85,15 @@
   {
 int[] gdk_pixels = nativeGetRGBPixels (r.x, r.y, r.width, r.height);
 int[] pixels = new int[r.width * r.height];
 
 for (int i = 0; i  r.width * r.height; i++)
   pixels[i] = cm.getRGB (gdk_pixels[i]);
 
 return pixels;
   }
 
-  @Override
   public void dispose()
   {
 // Nothing to do here yet.
   }
 }
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.126
diff -u -1 -0 -r1.126 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java	22 Jun 2007 09:52:06 -	1.126
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java	22 Jun 2007 14:27:07 -
@@ -893,21 +893,20 @@
 // FIXME: implement
 
 return false;
   }
   public void layout()
   {
 // FIXME: implement
  
   }
 
-  @Override
   public boolean requestFocus(Component lightweightChild, boolean temporary,
   boolean focusedWindowChangeAllowed,
   long time, sun.awt.CausedFocusEvent.Cause cause)
   {
 // TODO: Implement this properly and remove the other requestFocus()
 // methods.
 return true;
   }
 
 }
Index: gnu/java/awt/peer/gtk/GtkFramePeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java,v
retrieving revision 1.52
diff -u -1 -0 -r1.52 GtkFramePeer.java
--- gnu/java/awt/peer/gtk/GtkFramePeer.java	22 Jun 2007 09:52:07 -	1.52
+++ gnu/java/awt/peer/gtk/GtkFramePeer.java	22 Jun 2007 14:27:07 -
@@ -238,20 +238,19 @@
 // TODO Auto-generated method stub
 
   }
 
   public boolean requestWindowFocus()
   {
 // TODO Auto-generated method stub
 return false;
   }
 
-  @Override
   public Rectangle getBoundsPrivate()
   {
 // TODO: Implement this properly.
 throw new InternalError(Not yet implemented);
   }
 
 }
 
 
Index: gnu/java/awt/peer/gtk/GtkWindowPeer.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java,v
retrieving revision 1.60
diff -u -1 -0 -r1.60 GtkWindowPeer.java
--- gnu/java/awt/peer/gtk/GtkWindowPeer.java	22 Jun 2007 09:52:07 -	1.60
+++ gnu/java/awt/peer/gtk/GtkWindowPeer.java	22 Jun 2007 14:27:07 -
@@ -392,40 +392,35

[commit-cp] classpath ChangeLog java/awt/Dialog.java java/a...

2007-06-22 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/06/22 09:52:08

Modified files:
.  : ChangeLog 
java/awt   : Dialog.java Toolkit.java 
java/awt/peer  : ComponentPeer.java FramePeer.java 
 RobotPeer.java WindowPeer.java 
gnu/java/awt/peer: GLightweightPeer.java 
gnu/java/awt/peer/gtk: GdkRobotPeer.java GtkComponentPeer.java 
   GtkFramePeer.java GtkToolkit.java 
   GtkWindowPeer.java 
gnu/java/awt/peer/headless: HeadlessToolkit.java 
gnu/java/awt/peer/qt: QtComponentPeer.java QtFramePeer.java 
  QtToolkit.java QtWindowPeer.java 
gnu/java/awt/peer/swing: SwingComponentPeer.java 
 SwingToolkit.java SwingWindowPeer.java 
gnu/java/awt/peer/x: XFramePeer.java XToolkit.java 
Added files:
sun/awt: CausedFocusEvent.java 

Log message:
2007-06-22  Roman Kennke  [EMAIL PROTECTED]

* sun/awt/CausedFocusEvent.java: New class. Needed for 
compatibility
in java.awt.peer.
* java/awt/Dialog.java
(ModalExclusionType): New enum.
(ModalityType): New enum.
* java/awt/Toolkit.java
(isModalExclusionTypeSupported): New abstract method.
(isModalityTypeSupported): New abstract method.
* java/awt/peer/ComponentPeer.java
(requestFocus): New method.
* java/awt/peer/FramePeer.java
(getBoundsPrivate): New method.
* java/awt/peer/RobotPeer.java
(dispose): New method.
* java/awt/peer/WindowPeer.java
(setAlwaysOnTop): New method.
(updateFocusableWindowState): New method.
(setModalBlocked): New method.
(updateMinimumSize): New method.
(updateIconImages): New method.
* gnu/java/awt/peer/GLightweightPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/gtk/GdkRobotPeer.java
(dispose): New method.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/gtk/GtkFramePeer.java
(getBoundsPrivate): New method.
* gnu/java/awt/peer/gtk/GtkToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(updateIconImages): New method.
(updateMinimumSize): New method.
(setModalBlocked): New method.
(updateFocusableWindowState): New method.
(setAlwaysOnTop): New method.
* gnu/java/awt/peer/headless/HeadlessToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/qt/QtComponentPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/qt/QtFramePeer.java
(getBoundsPrivate): New method.
* gnu/java/awt/peer/qt/QtToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/qt/QtWindowPeer.java
(updateIconImages): New method.
(updateMinimumSize): New method.
(setModalBlocked): New method.
(updateFocusableWindowState): New method.
(setAlwaysOnTop): New method.
* gnu/java/awt/peer/swing/SwingComponentPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/swing/SwingToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/swing/SwingWindowPeer.java
(updateIconImages): New method.
(updateMinimumSize): New method.
(setModalBlocked): New method.
(updateFocusableWindowState): New method.
(setAlwaysOnTop): New method.
* gnu/java/awt/peer/x/XFramePeer.java
(getBoundsPrivate): New method.
* gnu/java/awt/peer/x/XToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9334r2=1.9335
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Dialog.java?cvsroot=classpathr1=1.29r2=1.30
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Toolkit.java?cvsroot

[commit-cp] classpath ChangeLog gnu/java/awt/peer/GLightwei...

2007-06-22 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/06/22 14:27:58

Modified files:
.  : ChangeLog 
gnu/java/awt/peer: GLightweightPeer.java 
gnu/java/awt/peer/gtk: GdkRobotPeer.java GtkComponentPeer.java 
   GtkFramePeer.java GtkWindowPeer.java 
gnu/java/awt/peer/qt: QtComponentPeer.java QtFramePeer.java 
  QtWindowPeer.java 
gnu/java/awt/peer/swing: SwingComponentPeer.java 
 SwingWindowPeer.java 
gnu/java/awt/peer/x: XFramePeer.java 

Log message:
2007-06-22  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/GLightweightPeer.java
* gnu/java/awt/peer/gtk/GdkRobotPeer.java
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
* gnu/java/awt/peer/gtk/GtkFramePeer.java
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
* gnu/java/awt/peer/qt/QtComponentPeer.java
* gnu/java/awt/peer/qt/QtFramePeer.java
* gnu/java/awt/peer/qt/QtWindowPeer.java
* gnu/java/awt/peer/swing/SwingComponentPeer.java
* gnu/java/awt/peer/swing/SwingWindowPeer.java
* gnu/java/awt/peer/x/XFramePeer.java:
Removed @Override annotations from some interface implementation
methods to ensure 1.5 compatibility.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9336r2=1.9337
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/GLightweightPeer.java?cvsroot=classpathr1=1.12r2=1.13
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java?cvsroot=classpathr1=1.126r2=1.127
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java?cvsroot=classpathr1=1.52r2=1.53
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java?cvsroot=classpathr1=1.60r2=1.61
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/qt/QtComponentPeer.java?cvsroot=classpathr1=1.10r2=1.11
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/qt/QtFramePeer.java?cvsroot=classpathr1=1.7r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java?cvsroot=classpathr1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java?cvsroot=classpathr1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XFramePeer.java?cvsroot=classpathr1=1.3r2=1.4




[cp-patches] FYI: Minor GTK peer patchlets

2007-06-21 Thread Roman Kennke
This fixes some type signatures in the GTK peers and some intendation.
Cosmetic changes.

2007-06-21  Roman Kennke  [EMAIL PROTECTED]

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
*
native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
Fix some type signatures.
*
native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
Fix intendation.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,v
retrieving revision 1.24
diff -u -1 -0 -r1.24 gnu_java_awt_peer_gtk_CairoGraphics2D.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c	25 Apr 2007 14:53:03 -	1.24
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c	21 Jun 2007 14:05:46 -
@@ -500,21 +500,21 @@
   break;
 }
 }
 
 /**
  * Set the line style, except for dashes.
  */
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine
 (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
- jlong pointer, jdouble width, int cap, int join, double miterLimit)
+ jlong pointer, jdouble width, jint cap, jint join, jdouble miterLimit)
 {
   struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer);
   g_assert (gr != NULL);
 
   /* set width */
   cairo_set_line_width (gr-cr, width);
 
   /* set cap */
   switch ((enum java_awt_basic_stroke_cap_rule) cap)
 {
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c,v
retrieving revision 1.4
diff -u -1 -0 -r1.4 gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c	25 Apr 2007 14:53:03 -	1.4
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c	21 Jun 2007 14:05:46 -
@@ -88,22 +88,22 @@
 0, 0, 0, 0,
 width, height );
   gdk_threads_leave();
 }
 
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_ComponentGraphicsCopy_copyPixbuf
   (JNIEnv *env, jobject obj __attribute__((unused)),
jobject peer, jobject image,
-   int x __attribute__((unused)), int y __attribute__((unused)),
-   int width __attribute__((unused)), int height __attribute__((unused)))
+   jint x __attribute__((unused)), jint y __attribute__((unused)),
+   jint width __attribute__((unused)), jint height __attribute__((unused)))
 {
   gint pwidth, pheight;
   GdkPixbuf *pixbuf;
   GdkDrawable *drawable;
   GdkWindow *win;
   GtkWidget *widget = NULL;
   void *ptr = NULL;
 
   gdk_threads_enter();
 
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c,v
retrieving revision 1.8
diff -u -1 -0 -r1.8 gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c	25 Apr 2007 14:53:04 -	1.8
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c	21 Jun 2007 14:05:46 -
@@ -200,29 +200,26 @@
 jmethodID gdkScreenGraphicsDevice_ctor, gdkScreenGraphicsDevice_init;
 jobject defaultDevice;
 GdkScreen *defaultScreen;
 
 gdkScreenGraphicsDevice_class = (*env)-FindClass 
 (env, gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice);
 
 gdkScreenGraphicsDevice_ctor = (*env)-GetMethodID 
 (env, gdkScreenGraphicsDevice_class, init,
  (Lgnu/java/awt/peer/gtk/GdkGraphicsEnvironment;)V);
-
 gdkScreenGraphicsDevice_init = (*env)-GetMethodID 
 (env, gdkScreenGraphicsDevice_class, init, ()V);
 
 /* Create the GdkScreenGraphicsDevice instance. */
-defaultDevice = (*env)-NewObject (env, 
-	   gdkScreenGraphicsDevice_class,
-	   gdkScreenGraphicsDevice_ctor,
-	   obj);
+defaultDevice = (*env)-NewObject(env, gdkScreenGraphicsDevice_class,
+  gdkScreenGraphicsDevice_ctor, obj);
 	   
 gdk_threads_enter();
 	
 defaultScreen = gdk_screen_get_default();
 	
 gdk_threads_leave();
 	   
 	/* Class initialization will have set up the native_state storage
 	 * mechanism for GdkScreenGraphicsDevice.
 	 */
Index: native/jni/gtk-peer

[cp-patches] RFC: AWT Peers update

2007-06-21 Thread Roman Kennke
This brings the AWT peers interfaces in sync with OpenJDK, that is, all
the new abstract methods have been added to java.awt.peer.* and stubbed
methods to their implementation classes. This was needed to get the GTK
peers working with OpenJDK:

http://kennke.org/blog/2007/06/21/gtk-peers-on-openjdk/

The reason why I post this as RFC is that I added the
sun.awt.CausedFocusEvent class. This class is needed in the
java.awt.peer.ComponentPeer interface. I rewrote it completely but I
have to admit that I have looked at OpenJDK's version before..

I'll remove the obsolete abstract methods and refactor the AWT to use
the new methods later.

Ok to go in?

2007-06-21  Roman Kennke  [EMAIL PROTECTED]

* sun/awt/CausedFocusEvent.java: New class. Needed for compatibility
in java.awt.peer.
* java/awt/Dialog.java
(ModalExclusionType): New enum.
(ModalityType): New enum.
* java/awt/Toolkit.java
(isModalExclusionTypeSupported): New abstract method.
(isModalityTypeSupported): New abstract method.
* java/awt/peer/ComponentPeer.java
(requestFocus): New method.
* java/awt/peer/FramePeer.java
(getBoundsPrivate): New method.
* java/awt/peer/RobotPeer.java
(dispose): New method.
* java/awt/peer/WindowPeer.java
(setAlwaysOnTop): New method.
(updateFocusableWindowState): New method.
(setModalBlocked): New method.
(updateMinimumSize): New method.
(updateIconImages): New method.
* gnu/java/awt/peer/GLightweightPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/gtk/GdkRobotPeer.java
(dispose): New method.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/gtk/GtkFramePeer.java
(getBoundsPrivate): New method.
* gnu/java/awt/peer/gtk/GtkToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(updateIconImages): New method.
(updateMinimumSize): New method.
(setModalBlocked): New method.
(updateFocusableWindowState): New method.
(setAlwaysOnTop): New method.
* gnu/java/awt/peer/headless/HeadlessToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/qt/QtComponentPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/qt/QtFramePeer.java
(getBoundsPrivate): New method.
* gnu/java/awt/peer/qt/QtToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/qt/QtWindowPeer.java
(updateIconImages): New method.
(updateMinimumSize): New method.
(setModalBlocked): New method.
(updateFocusableWindowState): New method.
(setAlwaysOnTop): New method.
* gnu/java/awt/peer/swing/SwingComponentPeer.java
(requestFocus): New method.
* gnu/java/awt/peer/swing/SwingToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.
* gnu/java/awt/peer/swing/SwingWindowPeer.java
(updateIconImages): New method.
(updateMinimumSize): New method.
(setModalBlocked): New method.
(updateFocusableWindowState): New method.
(setAlwaysOnTop): New method.
* gnu/java/awt/peer/x/XFramePeer.java
(getBoundsPrivate): New method.
* gnu/java/awt/peer/x/XToolkit.java
(isModalExclusionTypeSupported): New method.
(isModalityTypeSupported): New method.

/Roman
-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/Dialog.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Dialog.java,v
retrieving revision 1.29
diff -u -1 -0 -r1.29 Dialog.java
--- java/awt/Dialog.java	25 Oct 2006 20:57:52 -	1.29
+++ java/awt/Dialog.java	21 Jun 2007 14:51:51 -
@@ -54,20 +54,35 @@
  * if this owner is visible to the user. The default layout of dialogs is the 
  * codeBorderLayout/code. Dialogs can be modal (blocks user input to other
  * components) or non-modal (user input in other components are allowed).
  * /p 
  * 
  * @author Aaron M. Renn ([EMAIL PROTECTED])
  * @author Tom Tromey ([EMAIL PROTECTED])
  */
 public class Dialog extends Window
 {
+  public enum ModalExclusionType
+  {
+APPLICATION_EXCLUDE,
+NO_EXCLUDE,
+TOOLKIT_EXCLUDE
+  }
+
+  public enum ModalityType
+  {
+APPLICATION_MODAL

[commit-cp] classpath ChangeLog native/jni/gtk-peer/gnu_jav...

2007-06-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/06/21 14:07:01

Modified files:
.  : ChangeLog 
native/jni/gtk-peer: gnu_java_awt_peer_gtk_CairoGraphics2D.c 
 gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c 
 gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c 
 gnu_java_awt_peer_gtk_GtkFileDialogPeer.c 

Log message:
2007-06-21  Roman Kennke  [EMAIL PROTECTED]

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
* 
native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
Fix some type signatures.
* 
native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
Fix intendation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9331r2=1.9332
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c?cvsroot=classpathr1=1.24r2=1.25
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c?cvsroot=classpathr1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c?cvsroot=classpathr1=1.26r2=1.27




[cp-patches] FYI: Rasterizer stuff

2007-05-24 Thread Roman Kennke
This adds some infrastructure to the rasterizer, this is needed for the
upcoming quality improvements, but does not improve the rendering for
itself.

2007-05-24  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/ScanlineCoverage.java
(Iterator): New class.
(Range): New class.
(Coverage.covDelta): Made field package private.
(Coverage.xPos): Made field package private.
(iterator): New field. Stores the iterator that is reused.
(ScanlineCoverage): Initialize iterator.
(assertion): Removed.
(isEmpty): Refined conditions.
(iterate): Return Iterator instance.
(next): Removed. This is done by the Iterator class now.
(test): Removed.
* gnu/java/awt/java2d/ScanlineConverter.java
(main): Removed.
* gnu/java/awt/peer/x/XGraphics2D.java
(renderScanline): Adjust to new coverage iterator stuff.
* gnu/java/awt/java2d/AbstractGraphics2D.java
(renderScanline): Adjust to new coverage iterator stuff.

/Roman

-- 
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.3
diff -u -1 -5 -r1.3 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java	22 May 2007 13:12:56 -	1.3
+++ gnu/java/awt/peer/x/XGraphics2D.java	24 May 2007 16:26:25 -
@@ -207,64 +207,60 @@
 //System.err.println(tx:  + tx + , ty:  + ty + , pixel:  + pixel[0] + ,  + pixel[1] + ,  + pixel[2]);
 //  System.err.print(r:  + pixel[0]);
 //  System.err.print(, g:  + pixel[1]);
 //  System.err.println(, b:  + pixel[2]);
 zPixmap.set_red(tx - x, ty - y, pixel[0]);
 zPixmap.set_green(tx - x, ty - y, pixel[1]);
 zPixmap.set_blue(tx - x, ty - y, pixel[2]);
   }
   }
 xdrawable.put_image(xgc, zPixmap, x, y);
   }
   }
 
   public void renderScanline(int y, ScanlineCoverage c)
   {
-ScanlineCoverage.Coverage start = c.iterate();
-ScanlineCoverage.Coverage end = c.next();
-assert (start != null);
-assert (end != null);
-int coverageAlpha = 0;
+ScanlineCoverage.Iterator iter = c.iterate();
+float coverageAlpha = 0;
 int maxCoverage = c.getMaxCoverage();
 Color old = getColor();
 Color col = getColor();
 if (col == null)
   col = Color.BLACK;
-do
+while (iter.hasNext())
   {
+ScanlineCoverage.Range range = iter.next();
 // TODO: Dumb implementation for testing.
-coverageAlpha = coverageAlpha + start.getCoverageDelta();
+coverageAlpha = range.getCoverage();
 if (coverageAlpha  0)
   {
 int red = col.getRed();
 int green = col.getGreen();
 int blue = col.getBlue();
 if (coverageAlpha  c.getMaxCoverage())
   {
 float alpha = coverageAlpha / maxCoverage;
 red = 255 - (int) ((255 - red) * alpha);
 green = 255 - (int) ((255 - green) * alpha);
 blue = 255 - (int) ((255 - blue) * alpha);
   }
 xgc.set_foreground(red  16 | green  8 | blue);
-int x0 = start.getXPos();
-int x1 = end.getXPos();
-xdrawable.fill_rectangle(xgc, x0, y, x1 - x0, 1);
+int x0 = range.getXPos();
+int l = range.getLength();
+xdrawable.fill_rectangle(xgc, x0, y, l, 1);
   }
-start = end;
-end = c.next();
-  } while (end != null);
+  }
 xgc.set_foreground(old.getRGB());
   }
 
   protected void fillScanline(int x0, int x1, int y)
   {
 xdrawable.segment(xgc, x0, y, x1, y);
   }
 
   protected void fillScanlineAA(int x0, int x1, int y, int alpha)
   {
 //System.err.println(fillScanlineAA:  + x0 + ,  + x1 + ,  + y + ,  + alpha);
 // FIXME: This is for testing only.
 Color c = getColor();
 setColor(new Color(255-alpha, 255-alpha, 255-alpha));
 xdrawable.segment(xgc, x0, y, x1, y);
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.16
diff -u -1 -5 -r1.16 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java	18 May 2007 16:22:40 -	1.16
+++ gnu/java/awt/java2d/AbstractGraphics2D.java	24 May 2007 16:26:26 -
@@ -1549,31 +1549,30 @@
   {
 // Determine if we need to antialias stuff

[cp-patches] FYI: More rasterizer goodness

2007-05-24 Thread Roman Kennke
This improves the rasterizer alot. It increases the accuracy of the
calculation of the pixel coverage by a factor of 16, without any
performance impact (because we already know the intersection points, but
haven't used this knowledge before).

2007-05-24  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(fillShape): Pass rendering hints to scanline converter.
* gnu/java/awt/java2d/ScanlineConverter.java
(ONE): New constant for the number 1 as fixed point number.
(Y_RESOLUTION): New constant for the Y resolution.
(doScanline): Handle the Y resolution.
(renderShape): Accept rendering hints.
(setResolution): Adjust maximum resolution with Y resolution.
* gnu/java/awt/java2d/ScanlineCoverage.java
(Iterator.handledPixelCoverage): New field.
(Iterator.next): Handle single pixel coverage.
(Iterator.hasNext): Handle single pixel coverage.
(Iterator.reset): Reset single pixel coverage.
(Range.toString): New method.
(Coverage.pixelCoverage): New field.
(add): Include Y (pixel) coverage.
(findOrInsert): Reset Y coverage in reused entries.

/Roman

-- 
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.17
diff -u -1 -5 -r1.17 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java	24 May 2007 16:26:57 -	1.17
+++ gnu/java/awt/java2d/AbstractGraphics2D.java	24 May 2007 20:27:48 -
@@ -1556,31 +1556,31 @@
 antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON
  || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
   }
 else
   {
 Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING);
 antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON);
   }
 ScanlineConverter sc = getScanlineConverter();
 int resolution = 0;
 if (antialias)
   {
 // Adjust resolution according to rendering hints.
 resolution = 2;
   }
-sc.renderShape(this, s, clip, transform, resolution);
+sc.renderShape(this, s, clip, transform, resolution, renderingHints);
   }
 
   /**
* Returns the color model of this Graphics object.
*
* @return the color model of this Graphics object
*/
   protected abstract ColorModel getColorModel();
 
   /**
* Returns the bounds of the target.
*
* @return the bounds of the target
*/
   protected Rectangle getDeviceBounds()
Index: gnu/java/awt/java2d/ScanlineConverter.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/ScanlineConverter.java,v
retrieving revision 1.4
diff -u -1 -5 -r1.4 ScanlineConverter.java
--- gnu/java/awt/java2d/ScanlineConverter.java	24 May 2007 16:26:57 -	1.4
+++ gnu/java/awt/java2d/ScanlineConverter.java	24 May 2007 20:27:48 -
@@ -28,46 +28,57 @@
 executable, regardless of the license terms of these independent
 modules, and to copy and distribute the resulting executable under
 terms of your choice, provided that you also meet, for each linked
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package gnu.java.awt.java2d;
 
 import gnu.java.math.Fixed;
 
+import java.awt.RenderingHints;
 import java.awt.Shape;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.PathIterator;
 
 /**
  * Rasterizes [EMAIL PROTECTED] Shape} objects on an AbstractGraphics2D.
  */
 public final class ScanlineConverter
 {
 
   /**
* The number of digits to use for fixed point arithmetics.
*/
   private static int FIXED_DIGITS = 6;
 
   /**
+   * The fixed point constant for the number one.
+   */
+  private static int ONE = Fixed.fixedValue(FIXED_DIGITS, 1);
+
+  /**
+   * The number of significant bits for the Y resolution.
+   */
+  private static int Y_RESOLUTION = 4;
+
+  /**
* The actual number of scanlines.
*/
   private int numScanlines;
 
   /**
* The number of scanlines. This can contain more elements than we have
* scanlines. The real number of scanlines is stored in
* [EMAIL PROTECTED] #numScanlines}. This can also contain null values for empty

[cp-patches] FYI: New fixed point math method

2007-05-24 Thread Roman Kennke
This new method in the Fixed class is needed by the new rasterizer code.
It truncates a fixed point number so that only the digits after the
point are left.

2007-05-24  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/math/Fixed.java
(trunc): New method.

/Roman

-- 
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/math/Fixed.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/math/Fixed.java,v
retrieving revision 1.1
diff -u -1 -5 -r1.1 Fixed.java
--- gnu/java/math/Fixed.java	1 Jan 2007 23:12:09 -	1.1
+++ gnu/java/math/Fixed.java	24 May 2007 20:56:03 -
@@ -97,30 +97,43 @@
   /**
* Returns the floor value of a fixed point value codea/code with
* coden/code digits.
*
* @param n the number of digits
* @param a the fixed point value
*
* @return codefloor(a)/code as fixed point value
*/
   public static int floor(int n, int a)
   {
 return a  -(1  n);
   }
 
   /**
+   * Truncates the number so that only the digits after the point are left.
+   *
+   * @param n the number of digits
+   * @param a the fixed point value
+   *
+   * @return the truncated value
+   */
+  public static int trunc(int n, int a)
+  {
+return a  (0x  32 - n);
+  }
+
+  /**
* Returns the round value of a fixed point value codea/code with
* the coden/code digits.
*
* @param n the number of digits
* @param a the fixed point value
*
* @return coderound(a)/code as fixed point value
*/
   public static int round(int n, int a)
   {
 return (a + (1  (n - 1)))  -(1  n);
   }
 
   /**
* Returns the fixed point value codea/code with coden/code digits


[commit-cp] classpath gnu/java/awt/peer/x/XGraphics2D.java ...

2007-05-24 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/24 16:26:57

Modified files:
gnu/java/awt/peer/x: XGraphics2D.java 
.  : ChangeLog 
gnu/java/awt/java2d: AbstractGraphics2D.java 
 ScanlineConverter.java 
 ScanlineCoverage.java 

Log message:
2007-05-24  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/ScanlineCoverage.java
(Iterator): New class.
(Range): New class.
(Coverage.covDelta): Made field package private.
(Coverage.xPos): Made field package private.
(iterator): New field. Stores the iterator that is reused.
(ScanlineCoverage): Initialize iterator.
(assertion): Removed.
(isEmpty): Refined conditions.
(iterate): Return Iterator instance.
(next): Removed. This is done by the Iterator class now.
(test): Removed.
* gnu/java/awt/java2d/ScanlineConverter.java
(main): Removed.
* gnu/java/awt/peer/x/XGraphics2D.java
(renderScanline): Adjust to new coverage iterator stuff.
* gnu/java/awt/java2d/AbstractGraphics2D.java
(renderScanline): Adjust to new coverage iterator stuff.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics2D.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9314r2=1.9315
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java?cvsroot=classpathr1=1.16r2=1.17
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineConverter.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineCoverage.java?cvsroot=classpathr1=1.1r2=1.2




[commit-cp] classpath ChangeLog gnu/java/awt/java2d/Abstrac...

2007-05-24 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/24 20:28:43

Modified files:
.  : ChangeLog 
gnu/java/awt/java2d: AbstractGraphics2D.java 
 ScanlineConverter.java 
 ScanlineCoverage.java 

Log message:
2007-05-24  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(fillShape): Pass rendering hints to scanline converter.
* gnu/java/awt/java2d/ScanlineConverter.java
(ONE): New constant for the number 1 as fixed point number.
(Y_RESOLUTION): New constant for the Y resolution.
(doScanline): Handle the Y resolution.
(renderShape): Accept rendering hints.
(setResolution): Adjust maximum resolution with Y resolution.
* gnu/java/awt/java2d/ScanlineCoverage.java
(Iterator.handledPixelCoverage): New field.
(Iterator.next): Handle single pixel coverage.
(Iterator.hasNext): Handle single pixel coverage.
(Iterator.reset): Reset single pixel coverage.
(Range.toString): New method.
(Coverage.pixelCoverage): New field.
(add): Include Y (pixel) coverage.
(findOrInsert): Reset Y coverage in reused entries.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9315r2=1.9316
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java?cvsroot=classpathr1=1.17r2=1.18
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineConverter.java?cvsroot=classpathr1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineCoverage.java?cvsroot=classpathr1=1.2r2=1.3




[commit-cp] classpath gnu/java/math/Fixed.java ChangeLog

2007-05-24 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/24 20:56:36

Modified files:
gnu/java/math  : Fixed.java 
.  : ChangeLog 

Log message:
2007-05-24  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/math/Fixed.java
(trunc): New method.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/math/Fixed.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9316r2=1.9317




[cp-patches] FYI: X Peers enhancement

2007-05-22 Thread Roman Kennke
This brings the X peers up to the recent enhancement of the rasterizer.

2007-05-22  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XFontPeer2.java
(XFontMetrics.charWidth): Use cached Point2D instance.
* gnu/java/awt/peer/x/XGraphics2D.java
(renderScanline): New method. Renders a scanline according to
the coverage information.
(setPaint): Call super, so that the state is updated correctly.

/Roman
-- 
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XFontPeer2.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XFontPeer2.java,v
retrieving revision 1.4
diff -u -1 -5 -r1.4 XFontPeer2.java
--- gnu/java/awt/peer/x/XFontPeer2.java	8 May 2007 15:03:07 -	1.4
+++ gnu/java/awt/peer/x/XFontPeer2.java	22 May 2007 13:12:05 -
@@ -194,31 +194,31 @@
false, false, false);
 }
 
 public int getHeight()
 {
   GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
 new FontRenderContext(IDENDITY, false, false),
 new StringCharacterIterator(m));
   Rectangle2D b = gv.getVisualBounds();
   return (int) b.getHeight();
 }
 
 public int charWidth(char c)
 {
   int code = fontDelegate.getGlyphIndex(c);
-  Point2D advance = new Point2D.Double();
+  Point2D advance = cachedPoint;
   fontDelegate.getAdvance(code, font.getSize2D(), IDENDITY,
   false, false, true, advance);
   return (int) advance.getX();
 }
 
 public int charsWidth(char[] chars, int offs, int len)
 {
   return stringWidth(new String(chars, offs, len));
 }
 
 public int stringWidth(String s)
 {
   GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
 new FontRenderContext(IDENDITY, false, false),
 new StringCharacterIterator(s));
Index: gnu/java/awt/peer/x/XGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.2
diff -u -1 -5 -r1.2 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java	30 Apr 2007 20:30:56 -	1.2
+++ gnu/java/awt/peer/x/XGraphics2D.java	22 May 2007 13:12:05 -
@@ -40,30 +40,31 @@
 import java.awt.Color;
 import java.awt.Graphics;
 import java.awt.GraphicsConfiguration;
 import java.awt.Image;
 import java.awt.Paint;
 import java.awt.Rectangle;
 import java.awt.Shape;
 import java.awt.Toolkit;
 import java.awt.geom.AffineTransform;
 import java.awt.image.ColorModel;
 import java.awt.image.ImageObserver;
 import java.awt.image.Raster;
 import java.util.HashMap;
 
 import gnu.java.awt.java2d.AbstractGraphics2D;
+import gnu.java.awt.java2d.ScanlineCoverage;
 import gnu.x11.Colormap;
 import gnu.x11.Drawable;
 import gnu.x11.GC;
 import gnu.x11.image.ZPixmap;
 
 public class XGraphics2D
   extends AbstractGraphics2D
 {
 
   /**
* The X Drawable to draw on.
*/
   private Drawable xdrawable;
 
   /**
@@ -204,52 +205,92 @@
   {
 pixel = raster.getPixel(tx, ty, pixel);
 //System.err.println(tx:  + tx + , ty:  + ty + , pixel:  + pixel[0] + ,  + pixel[1] + ,  + pixel[2]);
 //  System.err.print(r:  + pixel[0]);
 //  System.err.print(, g:  + pixel[1]);
 //  System.err.println(, b:  + pixel[2]);
 zPixmap.set_red(tx - x, ty - y, pixel[0]);
 zPixmap.set_green(tx - x, ty - y, pixel[1]);
 zPixmap.set_blue(tx - x, ty - y, pixel[2]);
   }
   }
 xdrawable.put_image(xgc, zPixmap, x, y);
   }
   }
 
+  public void renderScanline(int y, ScanlineCoverage c)
+  {
+ScanlineCoverage.Coverage start = c.iterate();
+ScanlineCoverage.Coverage end = c.next();
+assert (start != null);
+assert (end != null);
+int coverageAlpha = 0;
+int maxCoverage = c.getMaxCoverage();
+Color old = getColor();
+Color col = getColor();
+if (col == null)
+  col = Color.BLACK;
+do
+  {
+// TODO: Dumb implementation for testing.
+coverageAlpha = coverageAlpha + start.getCoverageDelta();
+if (coverageAlpha  0)
+  {
+int red = col.getRed();
+int green = col.getGreen();
+int blue = col.getBlue();
+if (coverageAlpha  c.getMaxCoverage())
+  {
+float alpha = coverageAlpha / maxCoverage;
+red = 255 - (int) ((255 - red) * alpha);
+green = 255

Re: [cp-patches] RFC: calculate button modifiers for X peers

2007-05-22 Thread Roman Kennke
Hi Robert,

 the attached patch properly calculates the modifiers for mouse press
 and release events.

This looks very good. Except, if I read the patch correctly, the import
gnu.java.awt.EventModifier isn't needed. Please commit. Thank you for
fixing this.

/Roman

-- 
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




[commit-cp] classpath/gnu/java/awt/peer/x XFontPeer2.java X...

2007-05-22 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/22 13:12:57

Modified files:
gnu/java/awt/peer/x: XFontPeer2.java XGraphics2D.java 

Log message:
2007-05-22  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XFontPeer2.java
(XFontMetrics.charWidth): Use cached Point2D instance.
* gnu/java/awt/peer/x/XGraphics2D.java
(renderScanline): New method. Renders a scanline according to
the coverage information.
(setPaint): Call super, so that the state is updated correctly.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XFontPeer2.java?cvsroot=classpathr1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics2D.java?cvsroot=classpathr1=1.2r2=1.3




[cp-patches] FYI: Rasterizer improvement

2007-05-18 Thread Roman Kennke
I wanted to do this for a long time. This improves the performance and
quality of the Shape rasterizer (that is used for rendering shapes and
text in the Escher peers for example).
Basically, the coverage information of the anti-aliasing rasterizer is
now no more stored in an array, but in a much more efficient data
structure. This makes the rasterizer code more concise, better
performing and it allows to rasterize with and without anti-aliasing
without penalty (non-AA is then only a special case of AA rasterization,
where the scanline resolution is 1 (2^0), rather than 2^N).

2007-05-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(fillScanlineAA): Removed. Replaced by renderScanline().
(fillScanline): Dito.
(renderScanline): New method. Renders a scanline according to
the coverage information from the scanline converter.
* gnu/java/awt/java2d/Pixelizer.java: New interface. Describes
the targets of the rasterizer.
* gnu/java/awt/java2d/ScanlineConverter.java
(alphaRes): Removed.
(ONE): Removed.
(scanlineCoverage): New field. Manages the coverage information.
(scanlinesPerPixel): Removed.
(scanlineXCov): Removed.
(scanlineYCov): Removed.
(slPix0): Removed.
(ScanlineConverter): Initialize scanline coverage data
structure.
(clear): Also clear the scanline coverage.
(doScanline): Work with Pixelizer objects.
Use the ScanlineCoverage datastructure.
(main): New method. Performs some tests.
(renderShape): Work with pixelizer objects rather than directly
on AbstractGraphic2D. Adjust to use ScanlineCoverage
datastructure.
(setResolution): Set resolution on ScanlineCoverage data too.
* gnu/java/awt/java2d/ScanlineCoverage.java: New class. Stores
and manages scanline coverage information.

/Roman

-- 
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.15
diff -u -1 -5 -r1.15 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java	8 May 2007 13:27:30 -	1.15
+++ gnu/java/awt/java2d/AbstractGraphics2D.java	18 May 2007 16:22:00 -
@@ -39,54 +39,56 @@
 
 import java.awt.AWTError;
 import java.awt.AlphaComposite;
 import java.awt.AWTPermission;
 import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Composite;
 import java.awt.CompositeContext;
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Image;
 import java.awt.Paint;
 import java.awt.PaintContext;
+import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.Shape;
 import java.awt.Stroke;
 import java.awt.Toolkit;
 import java.awt.RenderingHints.Key;
 import java.awt.font.FontRenderContext;
 import java.awt.font.GlyphVector;
 import java.awt.geom.AffineTransform;
 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.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.SampleModel;
 import java.awt.image.WritableRaster;
 import java.awt.image.renderable.RenderableImage;
 import java.text.AttributedCharacterIterator;
 import java.util.HashMap;
 import java.util.Map;
 
 /**
  * This is a 100% Java implementation of the Java2D rendering pipeline. It is
  * meant as a base class for Graphics2D implementations.
  *
  * h2Backend interface/h2
  * p
  * The backend must at the very least provide a Raster which the the rendering
  * pipeline can paint into. This must be implemented in
  * [EMAIL PROTECTED] #getDestinationRaster()}. For some backends that might be enough, like
@@ -134,31 +136,31 @@
  *   using native code. These have proved to two of the most performance
  *   critical points in the rendering pipeline and cannot really be done quickly
  *   in plain Java because they involve lots of shuffling around with large
  *   arrays. In fact, you really would want to let the graphics card to the
  *   work, they are made for this./li
  * liProvide an accelerated

[commit-cp] classpath ChangeLog gnu/java/awt/java2d/Abstrac...

2007-05-18 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/18 16:22:40

Modified files:
.  : ChangeLog 
gnu/java/awt/java2d: AbstractGraphics2D.java 
 ScanlineConverter.java 
Added files:
gnu/java/awt/java2d: Pixelizer.java ScanlineCoverage.java 

Log message:
2007-05-18  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(fillScanlineAA): Removed. Replaced by renderScanline().
(fillScanline): Dito.
(renderScanline): New method. Renders a scanline according to
the coverage information from the scanline converter.
* gnu/java/awt/java2d/Pixelizer.java: New interface. Describes
the targets of the rasterizer.
* gnu/java/awt/java2d/ScanlineConverter.java
(alphaRes): Removed.
(ONE): Removed.
(scanlineCoverage): New field. Manages the coverage information.
(scanlinesPerPixel): Removed.
(scanlineXCov): Removed.
(scanlineYCov): Removed.
(slPix0): Removed.
(ScanlineConverter): Initialize scanline coverage data 
structure.
(clear): Also clear the scanline coverage.
(doScanline): Work with Pixelizer objects.
Use the ScanlineCoverage datastructure.
(main): New method. Performs some tests.
(renderShape): Work with pixelizer objects rather than directly
on AbstractGraphic2D. Adjust to use ScanlineCoverage 
datastructure.
(setResolution): Set resolution on ScanlineCoverage data too.
* gnu/java/awt/java2d/ScanlineCoverage.java: New class. Stores
and manages scanline coverage information.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9306r2=1.9307
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java?cvsroot=classpathr1=1.15r2=1.16
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineConverter.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/Pixelizer.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineCoverage.java?cvsroot=classpathrev=1.1




Re: [cp-patches] FYI: Make gtkpeer.c support 64-bit pointers

2007-05-08 Thread Roman Kennke
Hi Andrew,

 It's a good job I compile with -Werror; the new gtkpeer.c
 file only supports 32-bit pointers, thus squashing 64-bit
 ones into a 32-bit integer.  This adds #ifdefs in the same
 style as jcl.h

Wanted to do just that. Thank you.

Cheers, Roman

-- 
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0

USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] FYI: HintingDemo update

2007-05-08 Thread Roman Kennke
This improves the hinting demo by adding options to show a grid, as well
as the original and hinted glyphs.

2007-05-08  Roman Kennke  [EMAIL PROTECTED]

* examples/gnu/classpath/examples/awt/HintingDemo.java
Add support for showing the original vs the hinted glyphs plus
a grid.

/Roman

-- 
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0

USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: examples/gnu/classpath/examples/awt/HintingDemo.java
===
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/awt/HintingDemo.java,v
retrieving revision 1.1
diff -u -1 -5 -r1.1 HintingDemo.java
--- examples/gnu/classpath/examples/awt/HintingDemo.java	16 Dec 2006 20:53:10 -	1.1
+++ examples/gnu/classpath/examples/awt/HintingDemo.java	8 May 2007 12:40:32 -
@@ -8,67 +8,81 @@
 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.awt;
 
-import gnu.java.awt.font.*;
-import gnu.java.awt.font.opentype.*;
-
-import java.awt.*;
+import gnu.java.awt.font.FontDelegate;
+import gnu.java.awt.font.GNUGlyphVector;
+import gnu.java.awt.font.opentype.OpenTypeFontFactory;
+
+import java.awt.BasicStroke;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.RenderingHints;
+import java.awt.Shape;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.awt.font.*;
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.text.*;
+import java.awt.font.FontRenderContext;
+import java.io.File;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.text.StringCharacterIterator;
 
 import javax.swing.BoxLayout;
 import javax.swing.JCheckBox;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JSpinner;
 import javax.swing.JTextField;
 import javax.swing.border.TitledBorder;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 public class HintingDemo extends JFrame {
 
   FontDelegate font;
   GNUGlyphVector glyph;
   GlyphPreview glyphPreview;
   HintPanel hintPanel;
   StringViewer stringViewer;
   Chooser chooser;
   char character;
   Options options;
   boolean antiAlias;
+  boolean showGrid;
+  boolean showOriginal;
+  boolean showHinted;
   int flags;
 
   class StringViewer extends JPanel
   implements ActionListener
   {
 JTextField input;
 GNUGlyphVector gv;
 Viewer viewer;
 StringViewer()
 {
   setLayout(new GridLayout(0, 1));
   setBorder(new TitledBorder(Use this field to render complete strings));
   input = new JTextField();
   input.addActionListener(this);
   add(input);
@@ -121,48 +135,59 @@
   class HintPanel extends JPanel
   {
 
 HintPanel()
 {
   setBorder(new TitledBorder(Detailed glyph view));
 }
 protected void paintComponent(Graphics g)
 {
   if (glyph != null  g instanceof Graphics2D)
 {
   Graphics2D g2d = (Graphics2D) g.create();
   Insets i = getInsets();
   g2d.clearRect(i.left, i.top, getWidth() - i.left - i.right,
 getHeight() - i.top - i.bottom);
-  g2d.setColor(Color.GRAY);
-  for (int x = 20; x  getWidth(); x += 20)
-{
-  g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
-}
-  for (int y = 20; y  getHeight(); y += 20)
+  if (showGrid)
 {
-  g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
+  g2d.setColor(Color.GRAY);
+  for (int x = 20; x  getWidth(); x += 20)
+{
+  g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
+}
+  for (int y = 20; y  getHeight(); y += 20)
+{
+  g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
+}
 }
-  g2d.setRenderingHint

[cp-patches] FYI: Java2D stuff

2007-05-08 Thread Roman Kennke
This adds primitive anti-aliasing to the AbstractGraphics2D scanline
converter and fixes some bits here and there.

2007-05-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(AA_SAMPLING): Removed.
(alpha): Removed field.
(edgeTable): Removed field.
(fillScanlineAA): Removed obsolete method.
(drawPolyline): Implemented by using a GeneralPath.
(drawPolygon): Reset the cached polygon.
(fillPolygon): Reset the cached polygon.
(fillShape): Default to antialias on for text.
(rawDrawLine): Use ShapeCache.
(rawDrawRect): Use ShapeCache.
(rawFillRect): Use ShapeCache.
(fillScanlineAA): New method for antialiased rendering. 
* gnu/java/awt/java2d/ScanlineConverter.java
(scanlinesPerPixel): New field.
(minX,maxX): New fields.
(scanlineYCov,scanlineXCov): New fields.
(slPix0): New field.
(alphaRes): New field.
(renderShape): Add antialiasing functionality.
(doScanline): Add antialiasing functionality.
(setResolution): Add antialiasing functionality.
(addShape): Determine span in X direction.
(fit): Fix thinko.
* gnu/java/awt/java2d/ShapeCache.java
(polyline): New field for caching polylines.

/Roman
-- 
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0

USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.14
diff -u -1 -5 -r1.14 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java	1 Jan 2007 23:28:01 -	1.14
+++ gnu/java/awt/java2d/AbstractGraphics2D.java	8 May 2007 13:27:00 -
@@ -66,31 +66,30 @@
 import java.awt.geom.Ellipse2D;
 import java.awt.geom.GeneralPath;
 import java.awt.geom.Line2D;
 import java.awt.geom.NoninvertibleTransformException;
 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.Map;
 
 /**
  * This is a 100% Java implementation of the Java2D rendering pipeline. It is
  * meant as a base class for Graphics2D implementations.
  *
  * h2Backend interface/h2
  * p
  * The backend must at the very least provide a Raster which the the rendering
  * pipeline can paint into. This must be implemented in
  * [EMAIL PROTECTED] #getDestinationRaster()}. For some backends that might be enough, like
  * when the target surface can be directly access via the raster (like in
  * BufferedImages). Other targets need some way to synchronize the raster with
  * the surface, which can be achieved by implementing the
@@ -144,37 +143,30 @@
  * /p
  *
  * @author Roman Kennke ([EMAIL PROTECTED])
  */
 public abstract class AbstractGraphics2D
   extends Graphics2D
   implements Cloneable
 {
 
   /**
* The default font to use on the graphics object.
*/
   private static final Font FONT = new Font(SansSerif, Font.PLAIN, 12);
 
   /**
-   * 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;
-
-  /**
* Caches certain shapes to avoid massive creation of such Shapes in
* the various draw* and fill* methods.
*/
   private static final ThreadLocalShapeCache shapeCache =
 new ThreadLocalShapeCache();
 
   /**
* The scanline converters by thread.
*/
   private static final ThreadLocalScanlineConverter scanlineConverters =
 new ThreadLocalScanlineConverter();
 
   /**
* The transformation for this Graphics2D instance
*/
@@ -215,41 +207,30 @@
*/
   private Shape clip;
 
   /**
* The rendering hints.
*/
   private RenderingHints renderingHints;
 
   /**
* The raster of the destination surface. This is where the painting is
* performed.
*/
   private WritableRaster destinationRaster;
 
   /**
-   * Stores the alpha values for a scanline in the anti-aliasing shape
-   * renderer.
-   */
-  private transient int[] alpha;
-
-  /**
-   * The edge table for the scanline conversion algorithms.
-   */
-  private transient ArrayList[] edgeTable;
-
-  /**
* Indicates if certain graphics primitives can be rendered

[commit-cp] classpath examples/gnu/classpath/examples/awt/H...

2007-05-08 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/08 12:41:26

Modified files:
examples/gnu/classpath/examples/awt: HintingDemo.java 
.  : ChangeLog 

Log message:
2007-05-08  Roman Kennke  [EMAIL PROTECTED]

* examples/gnu/classpath/examples/awt/HintingDemo.java
Add support for showing the original vs the hinted glyphs plus
a grid.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/examples/gnu/classpath/examples/awt/HintingDemo.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9297r2=1.9298




[commit-cp] classpath gnu/java/awt/java2d/AbstractGraphics2...

2007-05-08 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/08 13:27:30

Modified files:
gnu/java/awt/java2d: AbstractGraphics2D.java 
 ScanlineConverter.java ShapeCache.java 
.  : ChangeLog 

Log message:
2007-05-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/java2d/AbstractGraphics2D.java
(AA_SAMPLING): Removed.
(alpha): Removed field.
(edgeTable): Removed field.
(fillScanlineAA): Removed obsolete method.
(drawPolyline): Implemented by using a GeneralPath.
(drawPolygon): Reset the cached polygon.
(fillPolygon): Reset the cached polygon.
(fillShape): Default to antialias on for text.
(rawDrawLine): Use ShapeCache.
(rawDrawRect): Use ShapeCache.
(rawFillRect): Use ShapeCache.
(fillScanlineAA): New method for antialiased rendering. 
* gnu/java/awt/java2d/ScanlineConverter.java
(scanlinesPerPixel): New field.
(minX,maxX): New fields.
(scanlineYCov,scanlineXCov): New fields.
(slPix0): New field.
(alphaRes): New field.
(renderShape): Add antialiasing functionality.
(doScanline): Add antialiasing functionality.
(setResolution): Add antialiasing functionality.
(addShape): Determine span in X direction.
(fit): Fix thinko.
* gnu/java/awt/java2d/ShapeCache.java
(polyline): New field for caching polylines.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java?cvsroot=classpathr1=1.14r2=1.15
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ScanlineConverter.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/java2d/ShapeCache.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9298r2=1.9299




[commit-cp] classpath ChangeLog gnu/java/awt/font/FontDeleg...

2007-05-08 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/08 14:40:12

Modified files:
.  : ChangeLog 
gnu/java/awt/font: FontDelegate.java 
gnu/java/awt/font/opentype: OpenTypeFont.java 

Log message:
2007-05-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/font/FontDelegate.java
(getGlyphIndex): New method. Maps characters to their
glyph index in the font.
M gnu/java/awt/font/opentype/OpenTypeFont.java
(getGlyphIndex): New method. Maps characters to their
glyph index in the font.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9299r2=1.9300
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/font/FontDelegate.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java?cvsroot=classpathr1=1.6r2=1.7




[commit-cp] classpath ChangeLog gnu/java/awt/peer/x/XFontPe...

2007-05-08 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Roman Kennke rabbit78 07/05/08 15:03:07

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/x: XFontPeer2.java 
Removed files:
gnu/java/awt/peer/x: XFontPeer.java XGraphics.java 

Log message:
2007-05-08  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XFontPeer.java: Removed.
* gnu/java/awt/peer/x/XGraphics.java: Removed
* gnu/java/awt/peer/x/XFontPeer2.java
(XLineMetrics.getDescent): Use cached idendity transform.
(XFontMetrics.cachedPoint): New field. Caches a Point2D instance
for reuse.
(XFontMetrics.getAscent): Use cached idendity transform.
(XFontMetrics.getDescent): Use cached idendity transform.
(XFontMetrics.getHeight): Use cached idendity transform.
(XFontMetrics.charWidth): Map character to glyph index first.
(XFontMetrics.stringWidth): Use cached idendity transform.
(IDENDITY): New static field. A reused AffineTransform instance.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9300r2=1.9301
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XFontPeer2.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XFontPeer.java?cvsroot=classpathr1=1.3r2=0
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics.java?cvsroot=classpathr1=1.7r2=0




[cp-patches] FYI: Escher peers update

2007-04-30 Thread Roman Kennke
This makes the escher peers implement a Graphics2D and make use of the
GNU Classpath TrueType implementation. Plus some other fixes and things.

Unfortunately, this will only compile with latest Escher SVN version
(which, right now, doesn't even fully compile, but that will beat me to
release a new Escher in the next two months - or how long it is till the
next classpath release).

2007-04-30  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XLightweightPeer.java: Removed.
* gnu/java/awt/peer/x/XEventPump.java
(handleEvent): Improved handling of event ids to window mapping.
* gnu/java/awt/peer/x/XFontPeer2.java:
Load font.properties at startup.
(XLineMetrics.glyphVector): New field.
(XLineMetrics.XLineMetrics): Get glyphVector from font delegate.
(XLineMetrics.getHeight): Implemented using glyph vector.
(XLineMetrics.getLeading): Implemented.
(XFontPeer2): Change hardwired font to something more common.
(encodeFont): New methods, encodes a font to the font.properties
format.
(validName): New method. Checks and returns a valid font name.
* gnu/java/awt/peer/x/XGraphics2D.java
(foreground): New field.
(rawSetPixel): Removed.
(rawDrawLine): Draw a segment.
(rawSetForeground): Removed.
(fillScanline): New method.
(fillScanlineAA): New method.
(setPaint): Set the foreground color.
(fillShape): Synchronize super behaviour.
(rawDrawImage): Optimize XImage.
* gnu/java/awt/peer/x/XGraphicsDevice.java
(getDisplay): Improve creation of socket.
(createLocalSocket): New helper method to create a local socket.
* gnu/java/awt/peer/x/XImage.java
(getGraphics): Return an XGraphics2D.
* gnu/java/awt/peer/x/XToolkit.java
(getClasspathFontPeer): Use XFontPeer2.
(createComponent): Removed.
* gnu/java/awt/peer/x/XWindowPeer.java
(getGraphics): Return an XGraphics2D.
(show): Clear the window.
(getFontMetrics): Use XFontPeer2.

/Roman

-- 
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0

USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.2
diff -u -1 -5 -r1.2 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	18 Jul 2006 10:23:20 -	1.2
+++ gnu/java/awt/peer/x/XEventPump.java	30 Apr 2007 20:29:41 -
@@ -136,33 +136,38 @@
*/
   void registerWindow(gnu.x11.Window xWindow, Window awtWindow)
   {
 if (XToolkit.DEBUG)
   System.err.println(registering window id:  + xWindow.id);
 windows.put(new Integer(xWindow.id), awtWindow);
   }
 
   void unregisterWindow(gnu.x11.Window xWindow)
   {
 windows.remove(new Integer(xWindow.id));
   }
 
   private void handleEvent(Event xEvent)
   {
-Integer key = new Integer(xEvent.window_id());;
-Window awtWindow = (Window) windows.get(key);
 
+Integer key = null;
+Window awtWindow = null;
+if (xEvent instanceof Input)
+  {
+key= new Integer(((Input) xEvent).child_window_id);
+awtWindow = (Window) windows.get(key);
+  }
 if (XToolkit.DEBUG)
   System.err.println(fetched event:  + xEvent);
 switch (xEvent.code())
 {
 case ButtonPress.CODE:
   ButtonPress bp = (ButtonPress) xEvent;
   // Create and post the mouse event.
   int button = bp.detail();
   drag = button;
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
  System.currentTimeMillis(), 0,
  bp.event_x(), bp.event_y(),
  1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
   break;
@@ -183,48 +188,52 @@
   mm = new MouseEvent(awtWindow, MouseEvent.MOUSE_MOVED,
   System.currentTimeMillis(), 0,
   mn.event_x(), mn.event_y(),
   1, false);
 }
   else
 {
   mm = new MouseEvent(awtWindow, MouseEvent.MOUSE_DRAGGED,
   System.currentTimeMillis(), 0,
   mn.event_x(), mn.event_y(),
   1, false);
 }
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm);
   break;
 case ConfigureNotify.CODE:
+  key= new Integer(((ConfigureNotify) xEvent).event_window_id);
+  awtWindow = (Window) windows.get(key);
   ConfigureNotify c = (ConfigureNotify) xEvent;
   if (XToolkit.DEBUG

  1   2   3   4   5   6   7   8   9   10   >