8130471: [Regression] Test java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java fails
Reviewed-by: alexsch, serb
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java Wed Sep 16 10:11:14 2015 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java Wed Sep 16 10:16:16 2015 +0300
@@ -572,6 +572,14 @@
}
static int getModifiers(int state, int button, int keyCode) {
+ return getModifiers(state, button, keyCode, false);
+ }
+
+ static int getWheelModifiers(int state, int button) {
+ return getModifiers(state, button, 0, true);
+ }
+
+ private static int getModifiers(int state, int button, int keyCode, boolean isWheelMouse) {
int modifiers = 0;
if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
@@ -602,7 +610,7 @@
// ONLY one of these conditions should be TRUE to add that modifier.
if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){
//exclude wheel buttons from adding their numbers as modifiers
- if (!isWheel(XConstants.buttons[i])) {
+ if (!isWheelMouse || !isWheel(XConstants.buttons[i])) {
modifiers |= InputEvent.getMaskForButton(i+1);
}
}
@@ -715,9 +723,9 @@
if (button > XConstants.buttons[4]){
button -= 2;
}
- modifiers = getModifiers(xbe.get_state(),button,0);
if (!isWheel(lbutton)) {
+ modifiers = getModifiers(xbe.get_state(), button, 0);
MouseEvent me = new MouseEvent(getEventSource(),
type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y,
@@ -743,6 +751,7 @@
}
else {
+ modifiers = getWheelModifiers(xbe.get_state(), button);
if (xev.get_type() == XConstants.ButtonPress) {
MouseWheelEvent mwe = new MouseWheelEvent(getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen,
modifiers,