Pointer jumps after warping when using Coordinate Transformation Matrix on a relative device
Submitted by Jason Gerecke
Assigned to Peter Hutterer @whot
Description
If a relative input device (e.g. mouse, Wacom puck) has its "Coordinate Transformation Matrix" property set to a non-identity matrix and a program warps the pointer position, the pointer is initially warped to the correct location but then jumps to a different location as soon as the device is moved.
For instance, if I run the following commands on my system, the xdotool
invocation (which uses XWarpPointer internally) will cause the pointer to jump to (1000, 100) on the screen. Once the mouse is moved, however, the pointer then immediately jumps to (500, 100) plus the motion delta.
$ xinput set-float-prop "DELL DELL USB Laser Mouse" "Coordinate Transformation Matrix" 0.5 0 0 0 1 0 0 0 1
$ xdotool mousemove 1000 100
This is not an issue with xdotool, as it can be reproduced with other software using XWarpPointer, including the most trivial:
/* gcc warp.c -lX11 -o warp */
#include <X11/Xlib.h>
#include <X11/Xatom.h>
int main()
{
Display *dpy = XOpenDisplay(0);
Window root = XRootWindow(dpy, 0);
XWarpPointer(dpy, None, root, 0, 0, 0, 0, 1000, 100);
XSync(dpy, False);
return 0;
}
Interestingly, it appears that the pointer jump only occurs if the events immediately before and after the XWarpPointer call both come from the the same input device. If a second mouse is connected to the system, the pointer jump does not seem to occur if the first is moved, the pointer warped, and then the second moved. Oddly, this appears to even be true if both devices have a non-identity Matrix.