[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] [patch] fix memory image source handling in GTK peers
From: |
Thomas Fitzsimmons |
Subject: |
[cp-patches] [patch] fix memory image source handling in GTK peers |
Date: |
Mon, 25 Jul 2005 21:56:16 -0400 |
Hi,
This patch does three things:
- implements GtkComponentPeer.repaint timed repaints properly
- implements GtkComponentPeer.updateCursorImmediately
- fixes handling of memory image sources in GtkImageConsumer
I committed this to mainline. This patch gets the Cortado applet closer
to working out-of-the-box on GNU Classpath.
Tom
2005-07-25 Thomas Fitzsimmons <address@hidden>
* gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaint): Implement
timed repaint.
(updateCursorImmediately): Implement.
(RepaintTimerTask): New class.
* gnu/java/awt/peer/gtk/GtkImageConsumer.java (imageComplete):
Don't remove consumer if source is a MemoryImageSource.
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.88
diff -u -r1.88 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java 14 Jul 2005 22:07:02 -0000
1.88
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 26 Jul 2005 01:50:52 -0000
@@ -70,6 +70,8 @@
import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
import java.awt.peer.ComponentPeer;
+import java.util.Timer;
+import java.util.TimerTask;
public class GtkComponentPeer extends GtkGenericPeer
implements ComponentPeer
@@ -372,8 +374,28 @@
if (x == 0 && y == 0 && width == 0 && height == 0)
return;
- q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
- new Rectangle (x, y, width, height)));
+ Timer t = new Timer();
+
+ t.schedule(new RepaintTimerTask(x, y, width, height), tm);
+ }
+
+ private class RepaintTimerTask extends TimerTask
+ {
+ private int x, y, width, height;
+
+ RepaintTimerTask(int x, int y, int width, int height)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public void run()
+ {
+ q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
+ new Rectangle (x, y, width, height)));
+ }
}
public void requestFocus ()
@@ -586,7 +608,8 @@
public void updateCursorImmediately ()
{
-
+ if (awtComponent.getCursor() != null)
+ setCursor(awtComponent.getCursor());
}
public boolean handlesWheelScrolling ()
Index: gnu/java/awt/peer/gtk/GtkImageConsumer.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java,v
retrieving revision 1.3
diff -u -r1.3 GtkImageConsumer.java
--- gnu/java/awt/peer/gtk/GtkImageConsumer.java 2 Jul 2005 20:32:12 -0000
1.3
+++ gnu/java/awt/peer/gtk/GtkImageConsumer.java 26 Jul 2005 01:50:52 -0000
@@ -45,6 +45,7 @@
import java.awt.image.ImageConsumer;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
+import java.awt.image.MemoryImageSource;
import java.util.Hashtable;
import java.util.Vector;
@@ -70,7 +71,10 @@
public synchronized void imageComplete (int status)
{
- source.removeConsumer(this);
+ // we need to reuse the pixel cache for memory image sources since
+ // a memory image's backing array can be updated "live".
+ if (!(source instanceof MemoryImageSource))
+ source.removeConsumer(this);
target.setImage(width, height, pixelCache, properties);
}
- [cp-patches] [patch] fix memory image source handling in GTK peers,
Thomas Fitzsimmons <=