mouse
mouse copied to clipboard
The mouse position is incorrect
Description
Point x, y returned by mouse.hook beyond the actual boundary on windows system. For example, suppose my screen resolution is 1920x1080, when mouse move quickly to the left of screen, x will be negative, and move to the bottom of screen, y will greater than 1080.
Platform and pynput version
WIndows 10, mouse 0.7.1.
To Reproduce
import mouse
mouse.hook(lambda event: print(event.x, event.y))
mouse.wait()
The following code to get the mouse position will return the correct coordinates:
pt = POINT()
ctypes.windll.user32.GetCursorPos(ctypes.byref(pt))
I searched for similar questions: https://stackoverflow.com/questions/12242907/get-x-lparam-gives-negative-value
I'm not good at C, according to the answer above, is the pt field of _MSLLHOOKSTRUCT structure should be a reference?