JDK-8190898 : java.awt.Robot.mouseMove fails in the lastest Windows 10 Build 1709 on high resolution
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9.0.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86
  • Submitted: 2017-10-31
  • Updated: 2019-08-02
  • Resolved: 2018-02-06
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.19]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Used are two Dell P2415Q-0 at 3840x2160

A DESCRIPTION OF THE PROBLEM :
As soon as the robot class function mouseMove is used in the selected Windows 10 build the mouse will not be moved as expected.

In the previous build this issue did not exist. It might be related to display scaling changes in the hew build.

Test output, first number is requested, second received from MouseInfo class:
X: 0|0.0 Y: 0.0
X: 192|383.0 Y: 0.0
X: 384|385.0 Y: 0.0
X: 576|767.0 Y: 0.0
X: 768|769.0 Y: 0.0
X: 960|1151.0 Y: 0.0
X: 1152|1153.0 Y: 0.0
X: 1344|1535.0 Y: 0.0
X: 1536|1537.0 Y: 0.0
X: 1728|1919.0 Y: 0.0

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set the display to 3840x2160 and select a display scaling higher than 100%

Set the cursor to arbitrary positions on the screen using the mouseMove function. Check if the cursor is placed correctly.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The cursor should be places exactly at the location which was requested.
ACTUAL -
The cursor does not move to the correct position. Moreover if the same coordinate is used again the cursor will jump back to the previous position.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
	public static void main(String[] args) {
		Robot worker;
		try {
			worker = new Robot();
			for(int i = 0; i < 1920; i+= 192)
			{
				worker.mouseMove(i, 0);
				worker.delay(200);
				System.out.println("X: " + i + "|" + MouseInfo.getPointerInfo().getLocation().getX() + " Y: "  + MouseInfo.getPointerInfo().getLocation().getY());			
			}	
		} catch (AWTException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No workaround found so far.


Comments
I ran into this bug just today and filed JDK-8190898.
24-01-2018

Does it affect 9 GA?
08-11-2017

9.0.1 Windows 10 b1709 Two Dell monitors (3840x2160) Checked this on Windows 10 b1703 and Monitors with display configuration (1920x1080) and DPI scaled to 150% Verified with JDK 8u152 and 9 ea with following results (comparitive with scaled DPI): 8u152: >java MouseMoveTest X: 0|1920.0 Y: 0.0 X: 192|1920.0 Y: 0.0 X: 384|1920.0 Y: 0.0 X: 576|1920.0 Y: 0.0 X: 768|1920.0 Y: 0.0 X: 960|1920.0 Y: 0.0 X: 1152|1920.0 Y: 0.0 X: 1344|1920.0 Y: 0.0 X: 1536|1920.0 Y: 0.0 X: 1728|1920.0 Y: 0.0 High Resolution and DPI >java MouseMoveTest X: 0|1920.0 Y: 0.0 X: 192|1920.0 Y: 0.0 X: 384|1920.0 Y: 0.0 X: 576|1920.0 Y: 0.0 X: 768|1920.0 Y: 0.0 X: 960|1920.0 Y: 0.0 X: 1152|1920.0 Y: 0.0 X: 1344|2005.0 Y: 0.0 X: 1536|2899.0 Y: 781.0 X: 1728|2033.0 Y: 0.0 9.0.1: >java MouseMoveTest X: 0|1920.0 Y: 0.0 X: 192|1920.0 Y: 0.0 X: 384|1920.0 Y: 0.0 X: 576|1920.0 Y: 0.0 X: 768|1920.0 Y: 0.0 X: 960|1920.0 Y: 0.0 X: 1152|1920.0 Y: 0.0 X: 1344|2016.0 Y: 0.0 X: 1536|2304.0 Y: 0.0 X: 1728|2592.0 Y: 0.0 High resolution (DPI) >java MouseMoveTest X: 0|1920.0 Y: 0.0 X: 192|1920.0 Y: 0.0 X: 384|1920.0 Y: 0.0 X: 576|1083.0 Y: 22.0 X: 768|475.0 Y: 98.0 X: 960|613.0 Y: 0.0 X: 1152|922.0 Y: 0.0 X: 1344|3204.0 Y: 323.0 X: 1536|2095.0 Y: 691.0 X: 1728|2751.0 Y: 10.0 This still need to be checked with latest Windows build 1709 though.
08-11-2017