Top level windows that use BufferStrategy (either via X11/XDBE or GLX) cannot
be resized by the user without garbage appearing in the window.
This has been a problem since 1.4.0 (when BufferStrategy and XDBE support was
added), but is now also an issue in Tiger with the OpenGL pipeline. Various
tutorials and code samples for BufferStrategy have recommended that the
developer call setResizable(false) on a top-level that uses BufferStrategy,
but that workaround only masks this bug. Users should most definitely be able
to resize multibuffered windows without seeing those artifacts.
I spent some time tracking down the source of the problem and peppering printf's
throughout the AWT code. I determined that whenever a window (either single
or doublebuffered) is resized, the ConfigureNotify event is detected and
propagated correctly at the native layer. In both cases the
MWindowPeer.handleResize() method is correctly invoked, but it appears that
in the doublebuffered case, the COMPONENT_RESIZED event is not dispatched
properly. This means we never go into the MComponentPeer.setBounds() method
and therefore never recreate the SurfaceData and all the other stuff that
should be taking place on a window resize event. I've seen similar behavior
with XAWT, but I did not track down the code path for XAWT (I assume it's
I think most of the work for this bug falls on the AWT side, as there are
problems with resize event notification in the multibuffered case. However, the
fix will also most likely require changes to 2D code, in how we restore the
VolatileImage that represents the backbuffer when the window is resized. We
will have to work together to find an appropriate fix to this issue.
Compile and run the attached testcase (XformMB.java). Then once the frame
is realized, attempt to resize the window, and you should see very ugly and
noticeable flickering inside the window.