GNOME Bugzilla – Bug 324562
XInput events are at incorrect xy-coordinates
Last modified: 2006-03-17 21:10:36 UTC
Please describe the problem: If a GdkDeviceAxis describing the x or y axis of an input device has a non-zero minimum value, then the translation of axis values to xy-coordinates for XInput events is incorrect. The culprit is the function gdk_input_translate_coordinates() in gdk/x11/gdkinput-x11.c: in the code of that function, axis_out[i] = x_offset + x_scale * axis_data[x_axis]; should be fixed to axis_out[i] = x_offset + x_scale * (axis_data[x_axis] - gdkdev->axes[x_axis].min_value); and similarly for the y axis. Steps to reproduce: 1. configure an XInput device driver to have non-zero minimum xy-axis values 2. open any GTK+ XInput-aware app (e.g. Gimp) and enable the extension input events in that app 3. watch the app get confused as the XInput events occur at xy-coordinates completely different from those of the corresponding Core Pointer events (in Gimp, you end up painting at some place other than where the pointer is). Actual results: The xy-coordinates of the GdkEvent structure are filled in incorrectly due to a bug in gdk_input_translate_coordinates() in gdk/x11/gdkinput-x11.c. Expected results: The xy-coordinates of the GdkEvent structure for the extension input event should be obtained by mapping linearly the range [min_value, max_value] to the entire screen (or window, depending on how the device is configured). Currently, the range [0, max_value - min_value] is mapped to the screen, instead. Does this happen every time? Yes. Other information: See http://www-math.mit.edu/~auroux/software/XINPUT-AXES-ISSUES for a more detailed discussion of this bug, a related bug in the linuxwacom driver, how this is important in the context of stylus calibration and display rotation on Tablet PCs, and proposed bugfixes and workarounds.
Another related issue is that, as far as I know, the GdkDeviceAxis settings don't get updated when the range of an XInput device happens to change during the execution of a Gdk/Gtk+ application; this is a problem if performing display rotation on a Tablet PC while the application is running. (That seems harder to fix; see the previously mentioned URL for a discussion of this, too).
Created attachment 57871 [details] script to test for this bug.
I've written a small test case for this problem in pygtk, to make sure it can be easily confirmed without relying on complex software as the gimp or inkscape. The script is attached and is called bug.py. To test the problem with a wacom board: $ xsetwacom set stylus TopX 1000 $ xsetwacom set stylus BottomX 3000 $ xsetwacom set stylus TopX 1000 $ xsetwacom set stylus BottomX 3000 $ python bug.py stylus Replace stylus with your device name. When you draw with your mouse, you will see that the points are painted in green at the hotspot of your cursor. When drawing with the stylus, the points are drawn in red completely not at the hotspot of the cursor. To restore your stylus settings, use wacomcpl.
I have reproduced the bug with the following versions of software and drivers: linux-2.6.14 (gentoo-sources-2.6.14-r5) linuxwacom-0.7.2 gnome-2.12.2 gtk-2.8.10
Soluton for linuxwacom on http://bugzilla.gnome.org/show_bug.cgi?id=331171
The GTK+ part of this was recently fixed, see bug #142536. As said above, there is also a bug in the linuxwacom driver. Please open a new report for the issue mentioned in comment #1 if you think it's important. *** This bug has been marked as a duplicate of 142536 ***