Open liuchengts opened 2 years ago
event are not restored to the x,y coordinates position correctly, they are not the actual coordinates of the current system.
I don't really understand what problem you are experiencing. What do you mean they are not the actual coordinates of the current system? Can you provide examples of x,y you received and the x,y you expected?
Do you know if this is a problem with Windows 10?
Have you tested with the latest snapshot?
event are not restored to the x,y coordinates position correctly, they are not the actual coordinates of the current system.
I don't really understand what problem you are experiencing. What do you mean they are not the actual coordinates of the current system? Can you provide examples of x,y you received and the x,y you expected?
Do you know if this is a problem with Windows 10?
Have you tested with the latest snapshot?
The coordinates of the version I am currently using are as follows:
<dependency>
<groupId>com.github.kwhat</groupId>
<artifactId>jnativehook</artifactId>
<version>2.2.1</version>
</dependency>
Problem Description:
When the system is windows 11 x64, the mouse x,y coordinate values obtained by [NativeMouseInputListener, NativeMouseWheelListener
] cannot move the mouse correctly when executed by the java built-in method new Robot().mouseMove(x,y). mouseMove(x,y)
method of java can't move the mouse to the position it was supposed to reach.
For example:
public void nativeMouseMoved(NativeMouseEvent e) {
logger.info(e.getX(),e.getY());
//Get the mouse x, y coordinate values
Robot robot = new Robot();
robot.mouseMove(e.getX(),e.getY());
//will not be able to restore the mouse to the preposition, and of course the reverse is also true
}
event are not restored to the x,y coordinates position correctly, they are not the actual coordinates of the current system.
I don't really understand what problem you are experiencing. What do you mean they are not the actual coordinates of the current system? Can you provide examples of x,y you received and the x,y you expected?
Do you know if this is a problem with Windows 10?
Have you tested with the latest snapshot?
Sorry, I'm not sure if it's a windows problem, I don't have this problem on other systems, but this problem appears on all windows around me
Environment: JDK version OpenJDK 11.0.8 Operating system win11 x64 Professional system Jnativehook version 2.2.0
On win11 x64 Professional system, the mouse x,y coordinates obtained in NativeMouseEvent event are not restored to the x,y coordinates position correctly, they are not the actual coordinates of the current system. But there is no such problem on macOS Bigsur.
Please note that this problem occurs in all nativeMouse* methods
Sample Code:
My temporary solution is to get the x, y coordinates of the mouse again after receiving this event with the following code