JDK-5003166 : REG:Mouse button not validated before bringing up the drop-down menu for choice
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0,6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_redhat_9.0,solaris_9
  • CPU: x86,sparc
  • Submitted: 2004-02-25
  • Updated: 2005-12-01
  • Resolved: 2005-03-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b29Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
When we click the mouse on the choice component it must validate which mouse button is clicked before showing the drop-down menu. This is not happening in tiger on Linux. The drop-down menu is always shown regardless of which mouse button is clicked. Typically it must show the drop-down menu only when left mouse button is clicked. This works fine on all the previous releases such as 1.4, 1.4.1 and 1.4.2. It works fine on other platforms. 

I have attached a sample test. Execute the sample test on any linux platform. Click the middle / right mouse button on choice. If you see the drop-down menu, bug is reproduced.

I tested with Tiger-beta2-b39 on Linux RedHat 9 and JDS (Mercury).

Comments
SUGGESTED FIX *** /net/awt64-1/export1/dav/mustang5//webrev/src/solaris/classes/sun/awt/X11/XChoicePeer.java- ?O^ i'A'O` 3 13:02:45 2005 --- /net/awt64-1/export1/dav/mustang5//webrev/src/solaris/classes/sun/awt/X11/XChoicePeer.java ?O^ i'A'O` 3 13:02:45 2005 *** 274,283 **** --- 274,289 ---- } } public void mousePressed(MouseEvent e) { dragStartIdx = helper.getSelectedIndex(); + /* + * fix for 5003166: a Choice on XAWT shouldn't react to any + * mouse button presses except left. This involves presses on + * Choice but not on opened part of choice. + */ + if (e.getButton() == MouseEvent.BUTTON1){ if (unfurled) { // Press on unfurled Choice. Highlight the item under the cursor, // but don't send item event or set the text on the button yet unfurledChoice.trackMouse(e); } *** 287,296 **** --- 293,303 ---- unfurledChoice.toFront(); firstPress = true; unfurled = true; } } + } public void mouseReleased(MouseEvent e) { if (unfurled) { if (mouseInSB) { unfurledChoice.trackMouse(e); *** 337,349 **** --- 344,365 ---- firstPress = false; dragStartIdx = -1; } public void mouseDragged(MouseEvent e) { + /* + * fix for 5003166. On Motif user are unable to drag + * mouse inside opened Choice if he drags the mouse with + * different from LEFT mouse button ( e.g. RIGHT or MIDDLE). + * This fix make impossible to drag mouse inside opened choice + * with other mouse buttons rather then LEFT one. + */ + if ( e.getModifiers() == MouseEvent.BUTTON1_MASK ){ dragging = true; unfurledChoice.trackMouse(e); } + } // Stolen from TinyChoicePeer public Dimension getMinimumSize() { // TODO: move this impl into ListHelper? FontMetrics fm = getFontMetrics(target.getFont()); ###@###.### 2005-03-05 12:54:25 GMT
05-03-2005

EVALUATION Name: osR10079 Date: 02/26/2004 XChoicePeer doesn't check which button pressed before bringing up drop-down list. ###@###.### Feb 26, 2004 ====================================================================== Name: ssR10077 Date: 02/29/2004 This is the bug in XAWT ChoicePeer implementation. ====================================================================== The problem in how we implemented XChoicePeer.mouseDragged() and mousePressed() methods. There were no difference between button pressed by user. ###@###.### 2005-03-05 12:54:25 GMT
05-03-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
21-08-2004