<AWT Dev> [8] Review request for 7026679 There is no MouseClicked event after MousePressed & MouseReleased events

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Thu May 30 02:13:54 PDT 2013


Hello,

Could you review the fix:
   bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7026679
   webrev: http://cr.openjdk.java.net/~alexsch/7026679/webrev.00

This is the direct fix proposed in the issue.

XWindow keep track of button press-releases within the 
mouseButtonClickAllowed bitmask. The problem is it's per-window field. 
With JComboBox some events comes to XContentWindow some into XFramePeer 
due to the specifics of this component - it opens extra toplevel window 
for the dropdown.
E.g. MOUSE_PRESS comes to XContentWindow and update its 
mouseButtonClickAllowed version with proper value (say 512 - left 
button). But MOUSE_RELEASE comes to XFramePeer which 
mouseButtonClickAllowed value is 0.
Later on it checks for its state in XWindow.handleMousePressRelease:
             if ((type == XConstants.ButtonRelease) &&
                 ((mouseButtonClickAllowed & 
XConstants.buttonsMask[lbutton]) != 0) ) // No up-button in the drag-state
             {
                    <construct and post a CLICK_EVENT>

But unfortunately it's value is 0 instead of 512 so we just skip 
MOUSE_CLICKED creation.
It seems that making this variable static is reasonable approach to keep 
the state of the mouse.


Thanks,
Alexandr.



More information about the awt-dev mailing list