Request for review: 7154048 [macosx] At least drag twice, the toolbar can be dragged to the left side. (original) (raw)
Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Wed Apr 18 08:40:54 PDT 2012
- Previous message: [8] Review request for 7149062: [macosx] dock menu don't show available frames
- Next message: Request for review: 7154048 [macosx] At least drag twice, the toolbar can be dragged to the left side.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Please review a fix for CR 7154048. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7154048
webrev: http://cr.openjdk.java.net/~alexsch/7154048/webrev.00/
Let's see the following test case:
- Frame contains two components JLabel and JButton
- The JLabel component has a mouse listener mousePressed: create a Window under the mouse click mouseDragged: drag the created window mouseReleased: close the Window
- A user clicks on the JLabel component, drags the mouse to the JButton component and releases the mouse button
The current JDK 8 implementation shows the following events on Mac OS X:
mouse pressed: javax.swing.JLabel mouse exited: javax.swing.JLabel mouse entered: javax.swing.JLabel mouse dragged: javax.swing.JLabel mouse exited: javax.swing.JLabel mouse entered: javax.swing.JButton mouse dragged: javax.swing.JLabel mouse exited: javax.swing.JButton mouse entered: Drag Window mouse exited: Drag Window mouse entered: javax.swing.JButton mouse released: javax.swing.JButton
There are several issues:
- The window does not receive the mouse entered event when it is created under the mouse
- There are JLabel exited/JButton entered events during the window dragging
- JLabel does not receive the mouse released event
The fix synthesizes the mouse entered/exited events manually if they are not received.
The entered/exited events synthesizing is added to setFrame, toFront, toBack, and zoom methods of the AWTWindow and CWrapper classes.
There is an option to add the events synthesizing to the windowDidResize notification. However this notification is sent when a window size is changed in both cases, programmatically and when user is resized the window. So in a lot of case there is no need for the our use case events generation.
The LWWindowPeer class is updated to not generate extra mouse enter/exit events during the mouse dragging.
Tho automated tests are added.
Thanks, Alexandr.
- Previous message: [8] Review request for 7149062: [macosx] dock menu don't show available frames
- Next message: Request for review: 7154048 [macosx] At least drag twice, the toolbar can be dragged to the left side.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]