diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ivypointer.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ivypointer.c b/src/ivypointer.c index 984ec43..e6b6f37 100644 --- a/src/ivypointer.c +++ b/src/ivypointer.c @@ -31,8 +31,8 @@ # include <X11/keysymdef.h> # if HAVE_X11_EXTENSIONS_XTEST_H # include <X11/extensions/XTest.h> -//# else -//# error The XTest extension is required to build xtest +# else +# error The XTest extension is required to build xtest # endif # if HAVE_X11_EXTENSIONS_XINERAMA_H // Xinerama.h may lack extern "C" for inclusion by C++ @@ -98,14 +98,13 @@ openDisplay(const char* displayName) // verify the availability of the XTest extension int majorOpcode, firstEvent, firstError; -#if HAVE_X11_EXTENSIONS_XTEST_H if (!XQueryExtension(display, XTestExtensionName, &majorOpcode, &firstEvent, &firstError)) { printf("XTEST extension not available"); XCloseDisplay(display); return NULL; } -#endif + XTestGrabControl(display, True); #if HAVE_XKB_EXTENSION { m_xkb = false; @@ -163,25 +162,25 @@ int valid(float x, float y) { void fakeMouseButton(const unsigned int xButton, Bool press) { -#if HAVE_X11_EXTENSIONS_XTEST_H if (xButton != 0) { XTestFakeButtonEvent(display, xButton, press ? True : False, 0); XFlush(display); } -#endif } void fakeMouseMove(int x, int y) { - XWarpPointer(display, None, RootWindow(display, 0), 0, 0, 0, 0, x, y); + XTestFakeMotionEvent(display, DefaultScreen(display), x, y, CurrentTime); + //XWarpPointer(display, None, RootWindow(display, 0), 0, 0, 0, 0, x, y); XFlush(display); } void fakeMouseRelativeMove(int dx, int dy) { - XWarpPointer(display, None, None, 0, 0, 0, 0, dx, dy); + XTestFakeRelativeMotionEvent(display, dx, dy, CurrentTime); + //XWarpPointer(display, None, None, 0, 0, 0, 0, dx, dy); XFlush(display); } |