changeset 11000:ccdff6bcf8c1

8207372: Robot.mouseWheel not implemented correctly on Linux, Mac Reviewed-by: kcr Contributed-by: mike.ennen@gmail.com
author kcr
date Sat, 21 Jul 2018 07:17:24 -0700
parents b808531e08ea
children 21b47529863d
files modules/javafx.graphics/src/main/java/com/sun/glass/ui/GlassRobot.java modules/javafx.graphics/src/main/java/javafx/scene/robot/Robot.java modules/javafx.graphics/src/main/native-glass/gtk/GlassRobot.cpp modules/javafx.graphics/src/main/native-glass/mac/GlassRobot.m
diffstat 4 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.graphics/src/main/java/com/sun/glass/ui/GlassRobot.java	Fri Jul 20 18:30:38 2018 +0530
+++ b/modules/javafx.graphics/src/main/java/com/sun/glass/ui/GlassRobot.java	Sat Jul 21 07:17:24 2018 -0700
@@ -108,10 +108,11 @@
     public abstract void mouseRelease(MouseButton... buttons);
 
     /**
-     * Scrolls the mouse wheel by the specified amount. Positive {@code wheelAmt}s
-     * scroll up whereas negative scroll down.
+     * Scrolls the mouse wheel by the specified amount of wheel clicks. A positive
+     * {@code wheelAmt} scrolls the wheel towards the user (down) whereas negative
+     * amounts scrolls the wheel away from the user (up).
      *
-     * @param wheelAmt the (signed) amount to scroll the wheel
+     * @param wheelAmt the (signed) amount of clicks to scroll the wheel
      */
     public abstract void mouseWheel(int wheelAmt);
 
--- a/modules/javafx.graphics/src/main/java/javafx/scene/robot/Robot.java	Fri Jul 20 18:30:38 2018 +0530
+++ b/modules/javafx.graphics/src/main/java/javafx/scene/robot/Robot.java	Sat Jul 21 07:17:24 2018 -0700
@@ -224,8 +224,9 @@
     }
 
     /**
-     * Scrolls the mouse wheel by the specified amount of wheel clicks. Positive
-     * {@code wheelAmt} scrolls up whereas negative scrolls down.
+     * Scrolls the mouse wheel by the specified amount of wheel clicks. A positive
+     * {@code wheelAmt} scrolls the wheel towards the user (down) whereas negative
+     * amounts scrolls the wheel away from the user (up).
      *
      * @param wheelAmt the (signed) amount of clicks to scroll the wheel
      * @throws IllegalStateException if this method is called on a thread
--- a/modules/javafx.graphics/src/main/native-glass/gtk/GlassRobot.cpp	Fri Jul 20 18:30:38 2018 +0530
+++ b/modules/javafx.graphics/src/main/native-glass/gtk/GlassRobot.cpp	Sat Jul 21 07:17:24 2018 -0700
@@ -196,7 +196,7 @@
 
     Display *xdisplay = gdk_x11_get_default_xdisplay();
     int repeat = abs(amt);
-    int button = amt < 0 ? 5 : 4;
+    int button = amt < 0 ? 4 : 5;
     int i;
 
     checkXTest(env);
--- a/modules/javafx.graphics/src/main/native-glass/mac/GlassRobot.m	Fri Jul 20 18:30:38 2018 +0530
+++ b/modules/javafx.graphics/src/main/native-glass/mac/GlassRobot.m	Sat Jul 21 07:17:24 2018 -0700
@@ -375,7 +375,7 @@
     GLASS_ASSERT_MAIN_JAVA_THREAD(env);
     GLASS_POOL_ENTER
     {
-        CGEventRef newEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitPixel, 1, (int32_t)wheelAmt);
+        CGEventRef newEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 1, (int32_t)wheelAmt);
         CGEventPost(kCGHIDEventTap, newEvent);
         CFRelease(newEvent);
     }