Hi,

Calling cairo_clip() actually manipulates the surface which means we
need to lock ComponentGraphics when setClip() is called. We can also
query X once for XRender support and then just reuse the result.

2006-07-09  Mark Wielaard  <[EMAIL PROTECTED]>

    * gnu/java/awt/peer/gtk/ComponentGraphics.java
    (hasXRenderExtension): New static final boolean field.
    (getComponentGraphics): Use hasXRenderExtension.
    (setClip): Override method for locking.

This fixes the occasional "Xlib: unexpected async reply (sequence
0x69f9)!" error I got with the jfreechart demo when resizing the window.

Committed,

Mark
Index: gnu/java/awt/peer/gtk/ComponentGraphics.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,v
retrieving revision 1.18
diff -u -r1.18 ComponentGraphics.java
--- gnu/java/awt/peer/gtk/ComponentGraphics.java	19 Jun 2006 11:51:43 -0000	1.18
+++ gnu/java/awt/peer/gtk/ComponentGraphics.java	9 Jul 2006 21:55:32 -0000
@@ -62,6 +62,8 @@
  */
 public class ComponentGraphics extends CairoGraphics2D
 {
+  private static final boolean hasXRenderExtension = hasXRender();
+
   private GtkComponentPeer component;
   protected long cairo_t;
 
@@ -175,7 +177,7 @@
    */
   public static Graphics2D getComponentGraphics(GtkComponentPeer component)
   {
-    if( hasXRender() )
+    if( hasXRenderExtension )
       return new ComponentGraphics(component);
 
     Rectangle r = component.awtComponent.getBounds();
@@ -402,5 +404,18 @@
       }
   }
 
+  public void setClip(Shape s)
+  {
+    lock();
+    try
+      {
+	super.setClip(s);
+      }
+    finally
+      {
+	unlock();
+      }
+  }
+
 }
 

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

Reply via email to