<AWT Dev> [8] Review request for 8027628: JWindow jumps to (0, 0) after mouse clicked

Oleg Pekhovskiy oleg.pekhovskiy at oracle.com
Fri Nov 8 00:00:18 PST 2013


Hi all,

please review the fix
http://cr.openjdk.java.net/~bagiras/8027628.1/
for
https://bugs.openjdk.java.net/browse/JDK-8027628

The issue affects all top-level windows. XConfigureEvent.x and 
XConfigureEvent.y fields
from ConfigureNotify event could have wrong values, e.g. when the window 
is resized by not moved.
That's why manual calculation was added.

This is explained in ICCCM, in "4.1.5. Configuring the Window" section:

"Advice to Implementors

Clients cannot distinguish between the case where a top-level window is 
resized and moved from the case where the window is resized but not 
moved, since a real ConfigureNotify event will be received in both 
cases. Clients that are concerned with keeping track of the absolute 
position of a top-level window should keep a piece of state indicating 
whether they are certain of its position. Upon receipt of a real 
ConfigureNotify event on the top-level window, the client should note 
that the position is unknown. Upon receipt of a synthetic 
ConfigureNotify event, the client should note the position as known, 
using the position in this event. If the client receives a KeyPress , 
KeyRelease , ButtonPress , ButtonRelease , MotionNotify , EnterNotify , 
or LeaveNotify event on the window (or on any descendant), the client 
can deduce the top-level window's position from the difference between 
the (event-x, event-y) and (root-x, root-y) coordinates in these events. 
Only when the position is unknown does the client need to use the 
TranslateCoordinates request to find the position of a top-level window."

Thanks,
Oleg


More information about the awt-dev mailing list