<Swing Dev> [PATCH] DefaultDesktopPane fix
roman.kennke at aicas.com
Thu Feb 26 12:09:42 PST 2009
> >>> I found a problem in DefaultDesktopPane. Dragging in fast mode does not
> >>> work correctly (at least not on all platforms) if the pane is obscured
> >>> by another heavyweight. Graphics.copyArea() isn't guaranteed to work
> >>> correctly in this case.
> >> This looks like a bug to me,
> >> could you please provide a small test case to illustrate this problem
> >> with Graphics.copyArea()?
> > I don't know if it's actually reproducable with X11 or Windows (I think
> > it's reproducable with _some_ X implementation, just not with X.org).
> > But this behaviour is actually specified:
> > <<If a portion of the source rectangle lies outside the bounds of the
> > component, or is obscured by another window or component, copyArea will
> > be unable to copy the associated pixels.>>
> I didn't know about that, thanks for the information
> The spec says that Graphics.copyArea() alway works this way,
Yeah, it sounds like this, but I don't think this is the case. My
interpretation is that this part of the spec accounts for limitations of
_some_ platforms and actually means 'we cannot guarantee that copyArea
works in such situations'. On platforms that draw windows directly on
the screen framebuffer, it is practically impossible (or at least
insanely complicated) to perform a copyArea on obscured parts of the
window. However, many modern windowing systems don't actually draw on
the screen framebuffer, but instead, each window has its own buffer and
all drawing is performed on that. Of course, when each window has its
own buffer, it's easy to perform a correct copyArea, even when the
window is obscured.
> just to be on the safe side could you please make a test
> to check is the problem can be reproducible with JInternalFrames
> on Windows or Linux?
> Something like dragging an internal frame
> under an "always-on-top" heavyweight?
Yeah, I did implement exactly that. However, it doesn't seem to be a
problem on my X server (Fedora 10 w/ or w/o compiz). I can reproduce the
problem on a DirectFB based graphics implementation though. A screenshot
is available here:
What you see there is two heavyweight frames (don't be confused by their
look: it's based on Caciocavallo and actually decorated by Swing - there
is no such thing as windows or decorations in DirectFB). One frame is
always-on-top of the other, and the 'lower' frame contains a
JInternalFrame. When I drag this internal frame to the left, it actually
copies whatever is on the framebuffer, in this case parts of the 'upper'
Attached you find the testcase. Maybe you can reproduce it on Windows or
some other platform. But I hope that you will agree that with copyArea()
not guaranteed to work reliable in this situation we need to check if
the window is obscured and take action if it is (or if it cannot be
determined) - just like we do in JViewport.
> any other tests are also welcome
> It is always better to have a clear test case before fixing a problem
Sure. Let's hope you can reproduce the problem with the attached
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 553 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20090226/9c3e214e/attachment.bin
More information about the swing-dev