From 2655062eb817b5d49ad6567a891cafb7170024ec Mon Sep 17 00:00:00 2001 From: tissoire Date: Fri, 21 Dec 2007 14:58:33 +0000 Subject: correction bug grab --- src/ivypointer.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') 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 # if HAVE_X11_EXTENSIONS_XTEST_H # include -//# 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); } -- cgit v1.1