[cp-patches] FYI: mouse event modifiers fix for the X peers

2007-05-22 Thread Robert Schuster
Hi,
the attached patch fixes the modifiers for the X peers.

Changes since my last RFC are: Removed a superfluous import, changed all
number literals to constant names and mentioned the button clipping in
the changelog.

2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Calculate modifier value for mouse presse
and release events, clip button values.
(buttonToModifier): New method.
* gnu/java/awt/peer/x/KeyboardMapping.java:
(mapModifiers): Added cases for alt gr and the meta key.

Regards
Robert
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.5
diff -u -r1.5 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:45:13 -	1.5
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 22:21:58 -
@@ -162,10 +162,15 @@
   awtWindow = (Window) windows.get(key);
   // Create and post the mouse event.
   int button = bp.detail();
+
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button >= gnu.x11.Input.BUTTON3)
+button = 0;
   drag = button;
 
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
  bp.event_x(), bp.event_y(),
  1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
@@ -174,11 +179,17 @@
   ButtonRelease br = (ButtonRelease) xEvent;
   key= new Integer(br.event_window_id);
   awtWindow = (Window) windows.get(key);
+
+  button = br.detail();
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button >= gnu.x11.Input.BUTTON3)
+button = 0;
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
  br.event_x(), br.event_y(),
- 1, false, br.detail());
+ 1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
   break;
 case MotionNotify.CODE:
@@ -297,6 +308,23 @@
 
   }
 
+  /** Translates an X button identifier to the AWT's MouseEvent modifier
+   *  mask. As the AWT cannot handle more than 3 buttons those return
+   *  0.
+   */
+  static int buttonToModifier(int button)
+  {
+switch (button)
+{
+  case gnu.x11.Input.BUTTON1:
+return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
+  case gnu.x11.Input.BUTTON2:
+return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
+  case gnu.x11.Input.BUTTON3:
+return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
+}
 
-}
+return 0;
+  }
 
+}
Index: gnu/java/awt/peer/x/KeyboardMapping.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/KeyboardMapping.java,v
retrieving revision 1.1
diff -u -r1.1 KeyboardMapping.java
--- gnu/java/awt/peer/x/KeyboardMapping.java	29 Jun 2006 15:15:56 -	1.1
+++ gnu/java/awt/peer/x/KeyboardMapping.java	22 May 2007 22:21:58 -
@@ -405,8 +405,12 @@
 
 if ((xMods & Input.SHIFT_MASK) != 0)
   mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
+if ((xMods & Input.META_MASK) != 0)
+  mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
 if ((xMods & Input.ALT_MASK) != 0)
   mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
+if ((xMods & Input.MOD5_MASK) != 0)
+  mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
 if ((xMods & Input.CONTROL_MASK) != 0)
   mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
 


signature.asc
Description: OpenPGP digital signature


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




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

2007-05-22 Thread Robert Schuster
Hi,
the attached patch properly calculates the modifiers for mouse press
and release events.

Ok, to commit?

2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Calculate modifier value for mouse presse
and release events.
(buttonToModifier): New method.
* gnu/java/awt/peer/x/KeyboardMapping.java:
(mapModifiers): Added cases for alt gr and the meta key.

Regards
Robert

Index: gnu/java/awt/peer/x/KeyboardMapping.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/KeyboardMapping.java,v
retrieving revision 1.1
diff -u -r1.1 KeyboardMapping.java
--- gnu/java/awt/peer/x/KeyboardMapping.java	29 Jun 2006 15:15:56 -	1.1
+++ gnu/java/awt/peer/x/KeyboardMapping.java	22 May 2007 21:37:43 -
@@ -405,8 +405,12 @@
 
 if ((xMods & Input.SHIFT_MASK) != 0)
   mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
+if ((xMods & Input.META_MASK) != 0)
+  mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
 if ((xMods & Input.ALT_MASK) != 0)
   mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
+if ((xMods & Input.MOD5_MASK) != 0)
+  mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
 if ((xMods & Input.CONTROL_MASK) != 0)
   mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
 
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.5
diff -u -r1.5 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:45:13 -	1.5
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 21:37:43 -
@@ -48,6 +48,8 @@
 import java.awt.event.PaintEvent;
 import java.util.HashMap;
 
+import gnu.java.awt.EventModifier;
+
 import gnu.x11.Display;
 import gnu.x11.event.ButtonPress;
 import gnu.x11.event.ButtonRelease;
@@ -162,10 +164,15 @@
   awtWindow = (Window) windows.get(key);
   // Create and post the mouse event.
   int button = bp.detail();
+
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button >= 3)
+button = 0;
   drag = button;
 
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
  bp.event_x(), bp.event_y(),
  1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
@@ -174,11 +181,17 @@
   ButtonRelease br = (ButtonRelease) xEvent;
   key= new Integer(br.event_window_id);
   awtWindow = (Window) windows.get(key);
+
+  button = br.detail();
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button >= 3)
+button = 0;
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
  br.event_x(), br.event_y(),
- 1, false, br.detail());
+ 1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
   break;
 case MotionNotify.CODE:
@@ -297,6 +310,23 @@
 
   }
 
+  /** Translates an X button identifier to the AWT's MouseEvent modifier
+   *  mask. As the AWT cannot handle more than 3 buttons those return
+   *  0.
+   */
+  static int buttonToModifier(int button)
+  {
+switch (button)
+{
+  case 1:
+return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
+  case 2:
+return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
+  case 3:
+return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
+}
 
-}
+return 0;
+  }
 
+}



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: fix key events for X peers

2007-05-22 Thread Robert Schuster
Hi,
I was missing the keyboard part in my last patch. Here it is.

2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id for
key presses/releases.

Regards
Robert
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.4
diff -u -r1.4 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 17:54:43 -	1.4
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:40:57 -
@@ -241,6 +241,8 @@
   break;
 case KeyPress.CODE:
 case KeyRelease.CODE:
+  key = new Integer(((Input) xEvent).event_window_id);
+  awtWindow = (Window) windows.get(key);
   handleKeyEvent(xEvent, awtWindow);
   break;
 default:


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: XEventPump fix

2007-05-22 Thread Robert Schuster
Hi,
actually the changelog should read:

2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id instead of
Input.child_window_id for mouse presses/releases &
movement.

Sorry for the inconvenience.


Regards
Robert

Robert Schuster schrieb:
> Hi,
> the attached patch makes mouse events work again for the X peers (and
> prevent a NPE later).
> 
> Regards
> Robert
> 
> 2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>
> 
> * gnu/java/awt/peer/x/XEventQueue.java:
> (handleEvent): Use Input.event_window_id instead of
> Input.child_window_id for mouse & key presses/releases.
> 
> 
> 
> 
> Index: gnu/java/awt/peer/x/XEventPump.java
> ===
> RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
> retrieving revision 1.3
> diff -u -r1.3 XEventPump.java
> --- gnu/java/awt/peer/x/XEventPump.java   30 Apr 2007 20:30:56 -  
> 1.3
> +++ gnu/java/awt/peer/x/XEventPump.java   22 May 2007 17:41:57 -
> @@ -151,20 +151,19 @@
>  
>  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;
> +  key= new Integer(bp.event_window_id);
> +  awtWindow = (Window) windows.get(key);
>// 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(),
> @@ -173,6 +172,8 @@
>break;
>  case ButtonRelease.CODE:
>ButtonRelease br = (ButtonRelease) xEvent;
> +  key= new Integer(br.event_window_id);
> +  awtWindow = (Window) windows.get(key);
>drag = -1;
>MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
>   System.currentTimeMillis(), 0,
> @@ -182,6 +183,9 @@
>break;
>  case MotionNotify.CODE:
>MotionNotify mn = (MotionNotify) xEvent;
> +  key= new Integer(mn.event_window_id);
> +  awtWindow = (Window) windows.get(key);
> +
>MouseEvent mm;
>if (drag == -1)
>  {



signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: X Peers enhancement

2007-05-22 Thread Robert Schuster
Hi,
you forgot to commit the changelog entry. Did that for you.

Regards
Robert

Roman Kennke schrieb:
> 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
> 
> 
> 
> 
> 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 < 

[cp-patches] FYI: XEventPump fix

2007-05-22 Thread Robert Schuster
Hi,
the attached patch makes mouse events work again for the X peers (and
prevent a NPE later).

Regards
Robert

2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id instead of
Input.child_window_id for mouse & key presses/releases.
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.3
diff -u -r1.3 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	30 Apr 2007 20:30:56 -	1.3
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 17:41:57 -
@@ -151,20 +151,19 @@
 
 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;
+  key= new Integer(bp.event_window_id);
+  awtWindow = (Window) windows.get(key);
   // 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(),
@@ -173,6 +172,8 @@
   break;
 case ButtonRelease.CODE:
   ButtonRelease br = (ButtonRelease) xEvent;
+  key= new Integer(br.event_window_id);
+  awtWindow = (Window) windows.get(key);
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
  System.currentTimeMillis(), 0,
@@ -182,6 +183,9 @@
   break;
 case MotionNotify.CODE:
   MotionNotify mn = (MotionNotify) xEvent;
+  key= new Integer(mn.event_window_id);
+  awtWindow = (Window) windows.get(key);
+
   MouseEvent mm;
   if (drag == -1)
 {


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] Gnu classpath permission patch ?

2007-05-22 Thread David Daney

Pierre Parrend wrote:


 Hello,

 I am looking for a small and efficient java class project to program secure
java
application. The Gnu Classpath seems to be very efficient, but there seem to be
no java permission support. Is there some specific patch that would already be
available ?

Are you sure?  The last time I checked (about 30 seconds ago), there 
were quite a few Permission checks.


You can grep the source code for the strings "checkPermission" 
"checkRead", etc. to see that there are several places were we do the 
checks.


Is there a particular place that you believe a check is missing?

David Daney



[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);
+ 

[cp-patches] Gnu classpath permission patch ?

2007-05-22 Thread Pierre Parrend


 Hello,

 I am looking for a small and efficient java class project to program secure
java
application. The Gnu Classpath seems to be very efficient, but there seem to be
no java permission support. Is there some specific patch that would already be
available ?

thanks for the information,

Pierre 

-- 
Pierre Parrend
doctorant, moniteur
laboratoire CITI, 21, Av. Jean Capelle
69621 Villeurbanne Cedex
[EMAIL PROTECTED]
www.rzo.free.fr