Bug 437777

Summary: cursor acts weird between QT/GTK if graphics tablet is connected
Product: [Plasma] kwin Reporter: Alexander <alexander.reimelt>
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, nate
Priority: NOR Keywords: wayland-only
Version First Reported In: 5.21.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: gtk3-demo --run=cursors

Description Alexander 2021-05-28 13:16:15 UTC
I have a graphics tablet without a screen (Wacom Intuos) so it's important I always see the correct cursor. If I use the pen to move the cursor over a Qt application it gets hidden if on GTK application it gets shown. Since I don't have a screen correct input becomes impossible.

But GTK is borked as well. I press a button on the pen for example lasso selection , the cursor stays the same and only changes to the expected cursor after the action is complete. The cursor is always one action behind for some reason. It's fine with regular mouse input.

EXPECTED RESULT
GTK: show the matching cursor for the pen input
Qt: show the cursor

Operating System: openSUSE Tumbleweed 20210524
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Kernel Version: 5.12.4-1-default
OS Type: 64-bit
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon RX 5700
Comment 1 Nate Graham 2021-05-28 18:50:47 UTC
This would either be a bug in GTK itself, or in KWin's cursor handling. However I strongly suspect GTK itself. Please report it upstream first https://gitlab.gnome.org/GNOME/gtk/-/issues/.

If they insist it's not their fault, we can re-investigate this here.

Thanks!
Comment 2 Alexander 2021-05-28 21:10:21 UTC
But what about the cursor disappearing on Qt applications? It is needed in order to be usable.
Comment 3 Nate Graham 2021-06-01 15:17:21 UTC
Since you're on Wayland, there's a chance that KWin could be at fault here.
Comment 4 Alexander 2021-06-02 18:23:03 UTC
let's see what the Gnome devs have to say:
https://gitlab.gnome.org/GNOME/gtk/-/issues/3998

added a Video on the GTK issue
Comment 5 Alexander 2021-06-03 11:24:25 UTC
Created attachment 138969 [details]
gtk3-demo --run=cursors

The Gnome developer suspects this is a Kwin bug because it isn't reproducible on his Gnome desktop. More info is in the GTK issue.

I made a new demo video with `gtk3-demo --run=cursors`.
After minimizing OBS I switched to the pen and the cursor disappeared on screen but is still visible in the recording for some reason. That's why I wiggle the cursor in the first seconds.

Also see how the task list preview stays open even after I started using the pen and disappeared with the notification? This is because kwin only hides the mouse cursor and doesn't sync to the pen cursor. The mouse still rests on the task list. The notification stole the focus from the preview and the same thing can happen to krunner. These are two other bugs just in the first seconds of the video.
Comment 6 Alexander 2021-06-12 10:50:02 UTC
With Plasma 5.22.0 I finally have a cursor (cross hair) on qt applications. The GTK experience hasn't changed.
Comment 7 Aleix Pol 2021-06-15 01:12:12 UTC
I can reproduce some weirdness, I'll have to take a look.
Comment 8 Bug Janitor Service 2021-07-02 22:08:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1142
Comment 9 Alexander 2021-07-03 08:34:01 UTC
Does this fix the look of the cursor or the desync between mouse and pen cursor?
Comment 10 Aleix Pol 2021-07-04 15:14:04 UTC
This will show the cursor as the client (GTK or otherwise) offers it.
Comment 11 Aleix Pol 2021-07-05 13:26:42 UTC
Git commit 0a1a4d362b7fcc3374730db639074056919300c9 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 05/07/2021 at 13:23.
Pushed by apol into branch 'master'.

tablet: Update the cursor as the surface changes

The tablet protocol offers us the cursor in a surface. This patch makes
sure we connect to the surface so that we can also refresh the
representation if the client submits a change.

M  +41   -11   src/input.cpp

https://invent.kde.org/plasma/kwin/commit/0a1a4d362b7fcc3374730db639074056919300c9