After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324562 - XInput events are at incorrect xy-coordinates
XInput events are at incorrect xy-coordinates
Status: RESOLVED DUPLICATE of bug 142536
Product: gtk+
Classification: Platform
Component: Backend: X11
2.8.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-12-20 03:55 UTC by Denis Auroux
Modified: 2006-03-17 21:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
script to test for this bug. (2.43 KB, text/plain)
2006-01-22 20:27 UTC, Toon Verstraelen
Details

Description Denis Auroux 2005-12-20 03:55:12 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.
Comment 1 Denis Auroux 2005-12-20 04:02:27 UTC
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).
Comment 2 Toon Verstraelen 2006-01-22 20:27:26 UTC
Created attachment 57871 [details]
script to test for this bug.
Comment 3 Toon Verstraelen 2006-01-22 20:27:59 UTC
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.
Comment 4 Toon Verstraelen 2006-01-22 20:31:05 UTC
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
Comment 5 Beech Horn 2006-02-24 17:18:47 UTC
Soluton for linuxwacom on http://bugzilla.gnome.org/show_bug.cgi?id=331171
Comment 6 Robert Ögren 2006-03-17 21:10:36 UTC
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 ***