diff options
Diffstat (limited to 'src/x11workaround.cpp')
-rw-r--r-- | src/x11workaround.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/x11workaround.cpp b/src/x11workaround.cpp new file mode 100644 index 0000000..c093362 --- /dev/null +++ b/src/x11workaround.cpp @@ -0,0 +1,23 @@ +#include "x11workaround.h" + + +void movePointer(int x, int y) { + bool result; + int root_x, root_y, win_x, win_y; + unsigned int mask_return; + Display* dpy = XOpenDisplay(0); + Window root = DefaultRootWindow(dpy); + Window window_returned; + result = XQueryPointer(dpy, root, &window_returned, &window_returned, &root_x, &root_y, &win_x, &win_y, &mask_return); + if (result != true) { + fprintf(stderr, "No mouse found.\n"); + return; + } + XWarpPointer(dpy, None,root, 0, 0, 0, 0, root_x - x ,root_y - y); + XFlush(dpy); +} + +void wiggle() { + movePointer(5, 5); + movePointer(-5, -5); +} |