aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortissoire2007-12-21 14:58:33 +0000
committertissoire2007-12-21 14:58:33 +0000
commit2655062eb817b5d49ad6567a891cafb7170024ec (patch)
treee1007d29b0aabde994cbd481c3be4c3c2dbd9fbe /src
parent8d5adfda136188fe487f408de9e7bd455ceaa235 (diff)
downloadivypointer-2655062eb817b5d49ad6567a891cafb7170024ec.zip
ivypointer-2655062eb817b5d49ad6567a891cafb7170024ec.tar.gz
ivypointer-2655062eb817b5d49ad6567a891cafb7170024ec.tar.bz2
ivypointer-2655062eb817b5d49ad6567a891cafb7170024ec.tar.xz
correction bug grab
Diffstat (limited to 'src')
-rw-r--r--src/ivypointer.c15
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);
}