8145784: [PIT] closed/java/awt/Robot/SpuriousMouseEvents/SpuriousMouseEvents.java fails
authorssadetsky
Tue, 12 Jan 2016 18:02:07 +0300
changeset 35668 21c2a1c93810
parent 35667 ed476aba94de
child 35669 9ff296647fde
8145784: [PIT] closed/java/awt/Robot/SpuriousMouseEvents/SpuriousMouseEvents.java fails Reviewed-by: alexsch, serb
jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Mon Jan 11 17:51:54 2016 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Tue Jan 12 18:02:07 2016 +0300
@@ -31,6 +31,7 @@
 import sun.awt.SunToolkit;
 import sun.awt.UNIXToolkit;
 import sun.awt.X11GraphicsConfig;
+import sun.awt.X11GraphicsEnvironment;
 
 class XRobotPeer implements RobotPeer {
 
@@ -64,7 +65,14 @@
 
     @Override
     public void mouseMove(int x, int y) {
-        mouseMoveImpl(xgc, xgc.scaleUp(x), xgc.scaleUp(y));
+        X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
+                GraphicsEnvironment.getLocalGraphicsEnvironment();
+        if(x11ge.runningXinerama()) {
+            Rectangle sb = xgc.getBounds();
+            mouseMoveImpl(xgc, xgc.scaleUp(x + sb.x), xgc.scaleUp(y + sb.y));
+        } else {
+            mouseMoveImpl(xgc, xgc.scaleUp(x), xgc.scaleUp(y));
+        }
     }
 
     @Override