Created
April 19, 2020 01:55
-
-
Save schrmh/74c96ecc9f0d30bd37b68af4755be102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.x.org/releases/X11R7.5/doc/man/man3/XIWarpPointer.3.html | |
//https://www.x.org/releases/X11R7.5/doc/man/man3/XOpenDevice.3.html | |
//https://www.x.org/releases/X11R7.7/doc/libXi/inputlib.html | |
//http://osr507doc.sco.com/en/man/html.Xext/XTEST.Xext.html | |
//xinput: ⎜ ↳ mouse XTEST pointer id=16 [slave pointer (14)] | |
// -> 14 XIWarpPointer; 16 XOpenDevice | |
//gcc -lXi -lX11 -lXtst -o test BackgroundMouse.c | |
#include <X11/Xlib.h> | |
#include <X11/extensions/XInput2.h> | |
#include <X11/extensions/XTest.h> | |
int main (int argc, char *argv[]) | |
{ | |
int delta_x = 500, delta_y = 160; | |
Display *display = XOpenDisplay(0); | |
Window root = DefaultRootWindow(display); | |
XIWarpPointer(display, 14, None, root, 0, 0, 0, 0, delta_x, delta_y); | |
XDevice *device = NULL; | |
device = XOpenDevice(display, 16); | |
XTestFakeDeviceButtonEvent(display, device, 1, True, 0, 0, CurrentTime); | |
XTestFakeDeviceButtonEvent(display, device, 1, False, 0, 0, CurrentTime); | |
XCloseDisplay(display); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment