JDK-8041463 : Mouse speed is reset to default
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u55,8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2014-04-16
  • Updated: 2018-05-24
  • Resolved: 2018-05-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]  (Windows 7 x64).
However, I assume *ANY* windows version will be ok.

EXTRA RELEVANT SYSTEM CONFIGURATION :
Not relevant

A DESCRIPTION OF THE PROBLEM :
When java.awt.Robot class is used to move system mouse cursor, occasionally it resets the mouse move speed to default.

This happens because windows implementation of Robot, \jdk\src\windows\native\sun\windows\awt_Robot.cpp doesn't check if a call to SystemParametersInfo(SPI_GETMOUSESPEED, 0, &oldSpeed,0) succeeds. As oldSpeed variable is initialized by 10 (default value), the next call (      bResult = SystemParametersInfo(SPI_SETMOUSESPEED, 0, (PVOID)oldSpeed,
                                     SPIF_SENDCHANGE);
) will rewrite the actual value to 10.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) You need to configure mouse speed which is not default, i.e. slower or faster
2) Move a mouse to any coordinates by calling java.awt.Robot#mouseMove

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Mouse speed is not affected by this call
ACTUAL -
Mouse speed is reset to default

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
import java.awt.*;

/**
 * Created by dgalimov on 16.04.14.
 */
public class Main {

    public static void main(String[] args) throws AWTException, InterruptedException {
        while (true) {
            Point currentLocation = MouseInfo.getPointerInfo().getLocation();
            new Robot().mouseMove(currentLocation.x, currentLocation.y);
            Thread.sleep(1);
        }
    }
}

---------- END SOURCE ----------


Comments
Will be fixed as part of JDK-8196030
24-05-2018