SUGGESTED FIX
--- old/src/windows/classes/sun/awt/windows/WWindowPeer.java 2008-03-06 14:40:09.000000000 +0300
+++ new/src/windows/classes/sun/awt/windows/WWindowPeer.java 2008-03-06 14:40:09.000000000 +0300
@@ -688,4 +688,12 @@
((DataBufferInt)backBuffer.getData().getDataBuffer()).getData(),
backBuffer.getWidth(), backBuffer.getHeight());
}
+
+ public void handleEvent(AWTEvent e) {
+ if (!isOpaque && e.getID() == PaintEvent.UPDATE) {
+ updateWindow(null);
+ } else {
+ super.handleEvent(e);
+ }
+ }
}
|
EVALUATION
The reason it doesn't work is that non-opaque windows apparently don't
get expose events (on XP, at least), so there are no native repaint
events sent to them, ever. And there's a bug in WComponentPeer which expects
a native paint event to reset "paintPending" state to false
(which is set to true when the component is resized),
which never happens for non-opqaue windows. So paintArea.paint()
is never called, and thus paint() is never called as well.
But even if it was called, it won't help because the painting code
for AWT components doesn't seem to call updateWindow().
One way to force updateWindow to be called is to change the transparency
of the window - then WWindowPeer.updateWindow is called -
and that paints the window to a BufferedImage which is then uploaded
to the window.
The following hack help with this problem:
------- WComponentPeer.java -------
*** /tmp/sccs.003236 Fri Feb 29 16:52:19 2008
--- WComponentPeer.java Fri Feb 29 16:51:04 2008
***************
*** 9,14 ****
--- 9,15 ----
import java.awt.*;
import java.awt.peer.*;
import java.awt.image.VolatileImage;
+ import sun.awt.AWTAccessor;
import sun.awt.RepaintArea;
import sun.awt.CausedFocusEvent;
import sun.awt.image.SunVolatileImage;
***************
*** 302,307 ****
--- 303,315 ----
case PaintEvent.UPDATE:
// Skip all painting while layouting and all UPDATEs
// while waiting for native paint
+ if (target instanceof Window) {
+ Window w = (Window)target;
+ if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
+ ((WWindowPeer)w.getPeer()).updateWindow(null);
+ return;
+ }
+ }
if (!isLayouting && ! paintPending) {
paintArea.paint(target,shouldClearRectBeforePaint());
}
|