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 784009 - Wacom pen calibration does not properly fix cursor offset
Wacom pen calibration does not properly fix cursor offset
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Wacom
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Carlos Garnacho
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-06-20 17:54 UTC by Jason Gerecke
Modified: 2017-07-05 21:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mutter: backends: Correct argument order of *_set_tablet_area (2.48 KB, patch)
2017-06-20 19:51 UTC, Jason Gerecke
none Details | Review
mutter: backends/native: Interpret tablet padding as being input-centric (2.46 KB, patch)
2017-06-20 19:53 UTC, Jason Gerecke
committed Details | Review
g-c-c: Use axis rather than padding in calibration calculations (9.39 KB, patch)
2017-06-20 19:54 UTC, Jason Gerecke
rejected Details | Review
g-c-c: wacom: Correct order of area calibration values (1.67 KB, patch)
2017-06-20 23:31 UTC, Jason Gerecke
committed Details | Review
mutter: backends/x11: Account for non-zero device origin when setting tablet area (3.55 KB, patch)
2017-06-20 23:32 UTC, Jason Gerecke
committed Details | Review
wacom: Drop old_axes from calibration API (11.95 KB, patch)
2017-06-30 19:30 UTC, Carlos Garnacho
committed Details | Review

Description Jason Gerecke 2017-06-20 17:54:54 UTC
When a Wacom tablet is calibrated through GNOME Control Center, the cursor offset is not properly corrected. Using the calibration utility can even make the offset noticeably worse in some cases. It appears that issues in both g-c-c and Mutter are to blame: the former saves incorrect data into gsettings and the latter may incorrectly apply whatever settings have been saved.
Comment 1 Jason Gerecke 2017-06-20 19:51:25 UTC
Created attachment 354116 [details] [review]
mutter: backends: Correct argument order of *_set_tablet_area
Comment 2 Jason Gerecke 2017-06-20 19:53:11 UTC
Created attachment 354117 [details] [review]
mutter: backends/native: Interpret tablet padding as being input-centric
Comment 3 Jason Gerecke 2017-06-20 19:54:17 UTC
Created attachment 354118 [details] [review]
g-c-c: Use axis rather than padding in calibration calculations
Comment 4 Carlos Garnacho 2017-06-20 20:46:57 UTC
Comment on attachment 354116 [details] [review]
mutter: backends: Correct argument order of *_set_tablet_area

Hmm, this one doesn't look right... According to the setting description at https://git.gnome.org/browse/gsettings-desktop-schemas/tree/schemas/org.gnome.desktop.peripherals.gschema.xml.in#n117 :

"(Values are) Respectively applied to left,right,top and bottom sides"

And I see mutter is consistent with this:
https://git.gnome.org/browse/mutter/tree/src/backends/meta-input-settings-private.h#n89
https://git.gnome.org/browse/mutter/tree/src/backends/x11/meta-input-settings-x11.c#n602
https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-input-settings-native.c#n446

I'm not saying it was the most brilliant idea to change argument order in the new setting, but probably means it's g-c-c which is doing it backwards.
Comment 5 Carlos Garnacho 2017-06-20 20:50:56 UTC
Comment on attachment 354117 [details] [review]
mutter: backends/native: Interpret tablet padding as being input-centric

Looks good! Thanks for tracking this down.
Comment 6 Jason Gerecke 2017-06-20 23:11:13 UTC
(In reply to Carlos Garnacho from comment #4)
> 
> I'm not saying it was the most brilliant idea to change argument order in
> the new setting, but probably means it's g-c-c which is doing it backwards.

Ah, had no idea the order changed as well. I'll whip up an alternate patch.
Comment 7 Jason Gerecke 2017-06-20 23:31:26 UTC
Created attachment 354128 [details] [review]
g-c-c: wacom: Correct order of area calibration values

Alternative version of the argument order correction patch. Applies to g-c-c instead of mutter.
Comment 8 Jason Gerecke 2017-06-20 23:32:56 UTC
Created attachment 354129 [details] [review]
mutter: backends/x11: Account for non-zero device origin when setting  tablet area

Another small correction for X11 I just noticed...
Comment 9 Carlos Garnacho 2017-06-29 22:00:00 UTC
Comment on attachment 354129 [details] [review]
mutter: backends/x11: Account for non-zero device origin when setting  tablet area

Thanks, I hadn't noticed the small delta.
Comment 10 Carlos Garnacho 2017-06-29 22:01:51 UTC
Comment on attachment 354128 [details] [review]
g-c-c: wacom: Correct order of area calibration values

That is consistent with the schema format.
Comment 11 Carlos Garnacho 2017-06-30 19:30:48 UTC
Created attachment 354748 [details] [review]
wacom: Drop old_axes from calibration API

The calibration utility was modified in cf408c27b0 to return unitless
padding measurements instead of axis values for storage in gsettings.
Unfortunately, the code still assumes in some places that it is working
with axes rather than paddings. This causes subtle math errors that
result in undesired cursor offsets after the calibration is applied.

Fortunately, this can be simplified, since tablet area is always reset
to the default state before starting calibration, we are sure that the
value will remain constant. Since both axes are in the same 0..1 scale,
calibration code doesn't need to swap X/Y back and forth to calculate
each axis scale.

Additionally, the code to get the calibrated axis values has been moved
into its own function along with a new function that returns padding
values suitable for consumption by g-c-c. All calculations are performed
internally in the 0..1 range.

https://bugzilla.gnome.org/show_bug.cgi?id=784009

Co-Authored-By: Carlos Garnacho <carlosg@gnome.org>
Comment 12 Carlos Garnacho 2017-06-30 19:39:05 UTC
I picked your patch and changed it so it keeps using 0..1 ranges, as far as I could test the end result is just the same, but please confirm it fixes the calibration oddities you were seeing :)

Your second patch (the one marked a-c-n) still applies on top.
Comment 13 Jason Gerecke 2017-06-30 21:33:36 UTC
Review of attachment 354748 [details] [review]:

This patch looks solid to me and appears to work fine. All the "precalib" related code from main.c could also be removed, but that could easily be ignored or done in a later patch.
Comment 14 Carlos Garnacho 2017-07-03 11:43:22 UTC
(In reply to Jason Gerecke from comment #13)
> Review of attachment 354748 [details] [review] [review]:
> 
> This patch looks solid to me and appears to work fine. All the "precalib"
> related code from main.c could also be removed, but that could easily be
> ignored or done in a later patch.

Hmm, thinking twice about it, the calibrator test doesn't touch up settings, so it may actually have other applied calibration than the default. That said, I much prefer having cleaner code than catering for a feature in a noinst app that is clearly oriented to non-users, I wonder how much people found/used the xorg.conf.d snippet producing feature :).

I filed bug #784473 to follow up with that anyway.
Comment 15 Carlos Garnacho 2017-07-03 12:37:14 UTC
Comment on attachment 354129 [details] [review]
mutter: backends/x11: Account for non-zero device origin when setting  tablet area

Pushed attachment #354129 [details] to mutter master/gnome-3-24
Comment 16 Jason Gerecke 2017-07-05 20:52:01 UTC
Review of attachment 354118 [details] [review]:

Just to be clear: this patch has been superseded by attachment 354748 [details] [review].
Comment 17 Carlos Garnacho 2017-07-05 21:56:10 UTC
I think everything is pushed now :).

Attachment 354118 [details] pushed as 978ccdc - wacom: Correct order of area calibration values
Attachment 354748 [details] pushed as 50b39dc - wacom: Drop old_axes from calibration API