Search code examples
apiinputx11d

Windows API function equivalents (SetCursorPos, GetCursorPos, mouse_event, keybd_event ...) for Linux (X11)?


I was wondering if there were equivalents of the above mentioned functions for Linux (X11) - I can't seem to find them.


Solution

  • The Xlib functions you want are XQueryPointer() and XWarpPointer().

    I've had issues with these not always returning what one would expect. The XTest extension as mentioned above was able to suit my needs. In particular the library function XTestFakeRelativeMotionEvent() worked well for what I was doing. YMMV.