JDK-4421515 : Need changes to new InputEvent modifier APIs
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.2.0,1.3.1,1.4.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_2000
  • CPU: generic,x86
  • Submitted: 2001-03-04
  • Updated: 2001-08-08
  • Resolved: 2001-08-08
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 Availabitlity Release.

To download the current JDK release, click here.
1.4.0 beta2Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Based on  a Design Review meeting held between Swing and AWT, the 
following changes were recommended:  

The CHANGED mask values should be removed.  

A new modifer, ALT_GRAPH_DOWN should be added.  

Extensive documentation should be added to explain how to use the new APIs, 
with examples.  

Here is a list of places where the CHANGED mask is used.  

echawkes@jano:/net/jano/export/disk03/awt/echawkes/jdk14-52/src( 99 )% findref -skipdir SCCS BUTTON | grep CHANGED
./share/classes/java/awt/event/InputEvent.java(125):     public static final int BUTTON1_CHANGED_MASK = 1 << 13;
./share/classes/java/awt/event/InputEvent.java(130):     public static final int BUTTON2_CHANGED_MASK = 1 << 14;
./share/classes/java/awt/event/InputEvent.java(135):     public static final int BUTTON3_CHANGED_MASK = 1 << 15;
./share/classes/java/awt/event/MouseEvent.java(345):    if ((modifiers & BUTTON1_CHANGED_MASK) != 0) {
./share/classes/java/awt/event/MouseEvent.java(347):    } else if ((modifiers & BUTTON2_CHANGED_MASK) != 0) {
./share/classes/java/awt/event/MouseEvent.java(349):    } else if ((modifiers & BUTTON3_CHANGED_MASK) != 0) {
./share/classes/java/awt/event/MouseEvent.java(431):            modifiers |= BUTTON1_CHANGED_MASK;
./share/classes/java/awt/event/MouseEvent.java(437):            modifiers |= BUTTON2_CHANGED_MASK;
./share/classes/java/awt/event/MouseEvent.java(443):            modifiers |= BUTTON3_CHANGED_MASK;

./solaris/native/sun/awt/canvas.c(755):         return java_awt_event_InputEvent_BUTTON1_CHANGED_MASK
./solaris/native/sun/awt/canvas.c(758):         return java_awt_event_InputEvent_BUTTON2_CHANGED_MASK
./solaris/native/sun/awt/canvas.c(761):         return java_awt_event_InputEvent_BUTTON3_CHANGED_MASK
./solaris/classes/sun/awt/motif/MMouseDragGestureRecognizer.java(73):         InputEvent.BUTTON1_CHANGED_MASK | 
./solaris/classes/sun/awt/motif/MMouseDragGestureRecognizer.java(74):         InputEvent.BUTTON2_CHANGED_MASK | 
./solaris/classes/sun/awt/motif/MMouseDragGestureRecognizer.java(75):         InputEvent.BUTTON3_CHANGED_MASK |
./win32/native/sun/windows/awt_Choice.cpp(190):     if (id == java_awt_event_MouseEvent_MOUSE_PRESSED && !(modifiers & java_awt_event_InputEvent_BUTTON1_CHANGED_MASK)) {
./win32/native/sun/windows/awt_Choice.cpp(194):     if (id == java_awt_event_MouseEvent_MOUSE_RELEASED && !(modifiers & java_awt_event_InputEvent_BUTTON1_CHANGED_MASK)) {
./win32/native/sun/windows/awt_Component.cpp(1958):         modifiers |= java_awt_event_InputEvent_BUTTON1_CHANGED_MASK;
./win32/native/sun/windows/awt_Component.cpp(1961):         modifiers |= java_awt_event_InputEvent_BUTTON3_CHANGED_MASK;
./win32/native/sun/windows/awt_Component.cpp(1964):         modifiers |= java_awt_event_InputEvent_BUTTON2_CHANGED_MASK;
./win32/classes/sun/awt/windows/WMouseDragGestureRecognizer.java(69):         InputEvent.BUTTON1_CHANGED_MASK |

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2

EVALUATION Commit to fix in Merlin-beta (need to finalize new merlin APIs before beta is released). eric.hawkes@eng 2001-03-04 See Comments for a long email containing my summary of the issue. It sounds as though the solution people want is a new constructor for MouseEvent with a new field: button. Fortunately, we already have an excellent getter method for this field: MouseEvent.getButton() eric.hawkes@eng 2001-04-11 We decided to add a new ctor to InputEvent, MouseEvent, and KeyEvent containing a field for the DOWN modifers. The MouseEvent ctor will also need a field for the button that initiated the event (replaces the CHANGED masks). We'll also need a getter method for the new field that carries the DOWN modifers. When we do this, we'll need to update the docs about the new and old modifiers. The docs should also warn developers that not all mice have three buttons, and that they should write code that provides an alternate way of emulating three button mice. (This task is for Sharon, with help from us.) eric.hawkes@eng 2001-04-13