GNOME Bugzilla – Bug 634977
gtk+ doesn't respect monitor coordinates in multihead with tablet devices.
Last modified: 2018-02-10 03:20:39 UTC
Created attachment 174595 [details] [review] Patch to fix multihead tablet coordinates. When converting tablet valuator coordinates into screen coordinates, gdk currently uses the dimensions of the combined screen, rather than those of the individual monitor. On my machine, at least, the X-server sends monitor coordinates. This leads to broken tablet handling in many applications (gimp, inkscape, mypaint, etc) on multihead machines. I got to the bottom of it and created a patch that fixes it. It's a tiny, noninvasive patch, and it makes these applications usable on my machine.
I have been having this issue as well on version 2.24.7. I found this through another guy who also solved it this way from https://bbs.archlinux.org/viewtopic.php?id=142144 As an example of the problem for a hypothetical setup where there are two monitors both of a resolution of 100x100 set up side by side. X correctly constrains the full range of the tablet to coordinates 0,0 to 99,99 on display 1 and displays the mouse cursor at those coords. However gtk is giving xinput coordinates in the range 0,0 to 199,99. So if I try and draw on my tablet 3/4 of the way across and halfway up my X mouse cursor is correctly shown at 75,49 but gtk returns xinput coords of 150,49 which is outside of the window. If I draw on the left-hand side of the tablet it draws on the window but to the right of the mouse cursor, twice as far from the left edge than it should be. Additionally tracing a square on the tablet will incorrectly draw a rectangle twice as wide as it is high in the software. The patch here corrects this and my system now allows me to use my tablet correctly. I don't use other xinput software so can't test if the patch has any side effects elsewhere. A cursory glance of how it works seems to be correct though at least for side-by-side monitors. It takes the active monitor into account rather than the current approach of using the virtual screen coords directly. The current code will only work correctly in a single-monitor system or at least one where X only sees one monitor. The latter would still distort the tablets aspect ratio but the tablet drivers should have a setting that can correct for that part. The Wacom driver which seem to be the main one has two different mechanisms to correct for this.
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.