8234107: Several AWT modal dialog tests failing on Linux after JDK-8231991
authorneugens
Fri, 15 Nov 2019 09:27:50 +0100
changeset 59190 88ddd6943a06
parent 59189 b5cdba232fca
child 59191 1e8bbeb86204
8234107: Several AWT modal dialog tests failing on Linux after JDK-8231991 Summary: Fix off by one in wheel detection logic Reviewed-by: prr
src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java
src/java.desktop/unix/classes/sun/awt/X11/XConstants.java
--- a/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java	Thu Nov 14 15:13:29 2019 -0800
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java	Fri Nov 15 09:27:50 2019 +0100
@@ -1032,8 +1032,8 @@
         int buttonState = 0;
         buttonState = xbe.get_state() & XConstants.ALL_BUTTONS_MASK;
 
-        boolean isWheel = (theButton != XConstants.MouseWheelUp ||
-                           theButton != XConstants.MouseWheelDown);
+        boolean isWheel = (theButton == XConstants.MouseWheelUp ||
+                           theButton == XConstants.MouseWheelDown);
 
         // don't give focus if it's just the mouse wheel turning
         if (!isWheel) {
--- a/src/java.desktop/unix/classes/sun/awt/X11/XConstants.java	Thu Nov 14 15:13:29 2019 -0800
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XConstants.java	Fri Nov 15 09:27:50 2019 +0100
@@ -208,8 +208,8 @@
 
     // those should probably be wrapped in a method or such
     // as it may be possible to remap them via x11 configuration files
-    public static final int MouseWheelUp = buttons[4];
-    public static final int MouseWheelDown = buttons[5];
+    public static final int MouseWheelUp = buttons[3];
+    public static final int MouseWheelDown = buttons[4];
 
     /* Notify modes */