wayland/tablet-tool: Fix stylus input with HiDPI scaling
After upgrading to GNOME 3.34 I noticed that the stylus input events were mapped to the screen incorrectly. This issue was only present in a Wayland session, and only if I set the screen scale to something else than 100%. In my default setup I use Wayland with 200% screen scale, which resulted in the stylus getting mapped to only 1/4 of the screen. Pressing in the lower right corner would draw in the middle of the screen. (Xournal++ in Fullscreen)
I bisected the changes in mutter and figured out that commit 75cffd0e ("shaped-texture: Implement ClutterContent") is the first one showing this behaviour. Using some GTK debugging output I hunted down the problem further, to the meta_wayland_tablet_tool_get_relative_coordinates function. To me it seems that since 75cffd0e the input to that function is already scaled correctly, and gets scaled a second time. Removing the duplicated scaling restored the normal behaviour in all screen scale configurations.
I am rather unfamiliar with the inner workings of mutter and the pull request process for GNOME projects, so my apologies if I missed something.
Information about my setup where I got the bug and tested the fix
- Surface Book 2
- Fedora 31 Beta
- Xournal++ 1.0.10 (flatpak)