[PATCH 1 of 2] Added flag to mark a peer to clear its background with an new paintevent. This gives target implementations better control when peers need to clear their background

Ingo Proetel proetel at aicas.de
Thu Apr 21 00:36:14 PDT 2011


# HG changeset patch
# User Ingo Proetel <proetel at aicas.de>
# Date 1303371341 -7200
# Node ID 033a795ade9cd0e361267719079384ab0d84fdf6
# Parent  5f7eafa98597dfb14967164eb3fd1a554c5a23ab
Added flag to mark a peer to clear its background with an new paintevent. This gives target implementations better control when peers need to clear their background.

diff -r 5f7eafa98597 -r 033a795ade9c src/share/classes/sun/awt/peer/cacio/CacioComponentPeer.java
--- a/src/share/classes/sun/awt/peer/cacio/CacioComponentPeer.java	Wed Apr 20 11:40:07 2011 +0200
+++ b/src/share/classes/sun/awt/peer/cacio/CacioComponentPeer.java	Thu Apr 21 09:35:41 2011 +0200
@@ -619,7 +619,6 @@
             // laid out correctly.
             swingComponent.validate();
         }
-        needsClearBackground = true;
     }
 
     public void setEnabled(boolean enable) {
@@ -797,4 +796,13 @@
     boolean isLayouting() {
         return false;
     }
+
+    /**
+     * Mark this peer so that the next paint event clears the background.
+     */
+    public void clearBackground()
+    {
+      needsClearBackground = true;
+    }
+
 }
diff -r 5f7eafa98597 -r 033a795ade9c src/share/classes/sun/awt/peer/cacio/CacioEventPump.java
--- a/src/share/classes/sun/awt/peer/cacio/CacioEventPump.java	Wed Apr 20 11:40:07 2011 +0200
+++ b/src/share/classes/sun/awt/peer/cacio/CacioEventPump.java	Thu Apr 21 09:35:41 2011 +0200
@@ -174,16 +174,25 @@
         postEvent(source, ev);
 
     }
-
+    
     protected final void postPaintEvent(CacioComponent source, int x, int y,
-                                        int width, int height) {
-
+                                        int width, int height, boolean paintBackground) {
+        if (paintBackground)
+        {
+          ((CacioComponentPeer) source).clearBackground();
+        }
+        
         PaintEvent ev = PaintEventDispatcher.getPaintEventDispatcher()
               .createPaintEvent(source.getAWTComponent(), x, y, width, height);
         postEvent(source, ev);
 
     }
-
+    
+    protected final void postPaintEvent(CacioComponent source, int x, int y,
+                                        int width, int height) {
+        postPaintEvent(source, x, y, width, height, false);
+    }
+    
     protected final void postFocusEvent(CacioComponent source, int id,
                                         boolean temporary,
                                         CacioComponent opposite) {



More information about the caciocavallo-dev mailing list