SetMouse(x, y [, windowPtrOrScreenNumber][, mouseid][, detachFromMouse=0])

Position the mouse cursor on the screen.

The cursor position (x,y) is “local” to the screen, i.e. relative to the
origin of the screen if a screen number is supplied, or relative to the
origin of a screen on which a supplied onscreen window is displayed.
Otherwise it’s “global”, i.e. relative to the origin of the main screen
(Screen 0). It is advisable to specify an onscreen window handle for
proper handling of Retina displays on macOS if you use backwards
compatibility mode.

On Linux with X11, the optional ‘mouseid’ parameter allows to select
which of potentially multiple cursors should be repositioned. On OS/X and
Windows this parameter is silently ignored.

On OSX, the optional ‘detachFromMouse’ parameter, if set to 1 instead of
its default value of zero, will detach mouse cursor movements from mouse
movements. The cursor will be frozen in place and can only be moved via
SetMouse(), but no longer via mouse movements. On Linux and Windows this
parameter is currently silently ignored.

On Linux with the Wayland backend, this function does nothing.

The delay between a call to SetMouse and when GetMouse will report the
new mouse cursor position is not known. GetMouse seems to report the new
position immediately, but we have no guarantee that it always will.


See Also: GetMouse, GetClicks

Path   Retrieve current version from GitHub | View changelog