Bug 450874

Summary: Plasma Wayland remaps virtual tablet input
Product: [Plasma] kwin Reporter: Naomi Calabretta <tony0000.ac>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, kde, nate, raghu, yumpusamongus+kde
Priority: NOR    
Version: 5.24.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description Naomi Calabretta 2022-02-26 11:21:53 UTC
SUMMARY
I am a pen display owner, and with the release of Plasma 5.24 I am looking to switch from x11 to Wayland.

During my tests I encountered problems with the userspace tablet driver I am using, which is OpenTabletDriver. I outlined them in detail in the project's GitHub issue tracker[1], believing it was a matter of "just adding support for Plasma Wayland" (and I suggested a couple of ways to do so), but turned out the developers felt it wasn't really their problem, since other Wayland implementations work well and they didn't feel the need to make a special use case just for Plasma.

Now, this could be the end of the story, but it really outlines a problem: KWin maps virtual tablet input as if it were a real tablet, therefore causing mapping problems for end users.

I don't know if the second problem is a bug to be reported on KDE bugzilla or just a shortcoming, but either way this is breaking my use case and for the time being I cannot really switch to Wayland; and I feel like other people who draw with the help of userspace drivers can also be held back by such thing.

I think there should be at least a setting in `kcm_tablet` that disables all internal mapping and "just accepts the input"; that, or a DBus call that the userspace driver can make, or (better) both things.

STEPS TO REPRODUCE
1. Use OpenTabletDriver as an userspace tablet driver / configuration solution
2. Try to actually use the tablet under the Wayland session
3. Notice that the output is not what you expected

OBSERVED RESULT
KWin maps the virtual tablet input as if it was a real tablet plugged in and using a kernel driver.

EXPECTED RESULT
KWin won't map input coming from a virtual input device by default.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Artix Linux, 5.24.2
(available in About System)
KDE Plasma Version: 5.24.2
KDE Frameworks Version:  5.91.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
[1]: https://github.com/OpenTabletDriver/OpenTabletDriver/issues/2083
Comment 1 David Edmundson 2022-02-26 11:32:52 UTC
I don't follow what you mean by " KWin maps virtual tablet input as if it were a real tablet"
Comment 2 Naomi Calabretta 2022-02-26 11:40:00 UTC
(In reply to David Edmundson from comment #1)
> I don't follow what you mean by " KWin maps virtual tablet input as if it
> were a real tablet"

As far as I know, the program I use has to use `uinput` to pass input events the way I want them to be to programs. Since `uinput` creates virtual input devices from the userspace, KWin seems to not be currently able to distinguish between them and real input devices. That was my point.
Comment 3 David Edmundson 2022-02-26 19:11:55 UTC
>KWin seems to not be currently able to distinguish between them and real input devices

Why do we need to distinguish them from real input devices. What's the user-facing impact of this?
Comment 4 Naomi Calabretta 2022-02-26 19:24:59 UTC
(In reply to David Edmundson from comment #3)
> What's the user-facing impact of this?

As I said, some users use third party programs to get their tablets working. When they do so, it's up to this program to map the handedness, orientation and input/output area of the tablet. Right now, this cannot properly function because `kcm_tablet` also provides handedness and orientation settings; but the most important user-facing impact of this is being unable to map the output to a certain display area, such as a window, a window region, or a region between two displays (if for some reason there's someone with this kinda use case). `kcm_tablet` doesn't support any of those use cases, and third party software like OpenTabletDriver usually factor in all the monitors' position, orientation and size to calculate display areas, X11-style, and therefore the input will be spit out in absolute coordinates relative to the total graphical real estate available to the user. When KWin maps this "absolute input" to be relative to just a display, things break and the user (me) gets really confused.
Comment 5 Bug Janitor Service 2022-03-13 04:35:19 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2022-10-19 02:29:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3070
Comment 7 Bug Janitor Service 2022-10-19 02:30:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1216
Comment 8 Raghavendra kamath 2023-09-16 09:02:12 UTC
I think this is similar to this bug report - https://bugs.kde.org/show_bug.cgi?id=457703 ?
Comment 9 Joshua Goins 2023-11-01 17:42:43 UTC
Git commit 36e7eaf13a92f432573f13439155009e6aa02d7b by Joshua Goins, on behalf of Aki Sakurai.
Committed on 01/11/2023 at 18:42.
Pushed by redstrate into branch 'master'.

Add option to map tablet to full desktop area.

Some users might want to map the tablet to full desktop area.

M  +12   -9    src/backends/libinput/connection.cpp
M  +11   -0    src/backends/libinput/device.cpp
M  +16   -0    src/backends/libinput/device.h

https://invent.kde.org/plasma/kwin/-/commit/36e7eaf13a92f432573f13439155009e6aa02d7b
Comment 10 Joshua Goins 2024-06-11 00:26:52 UTC
Git commit dbb517756b2fd0673c4c081a6c47113acda1f5cd by Joshua Goins, on behalf of Aki Sakurai.
Committed on 11/06/2024 at 00:17.
Pushed by redstrate into branch 'master'.

Add option to map tablet to full desktop area.

M  +13   -2    kcms/libkwindevices/inputdevice.cpp
M  +12   -1    kcms/libkwindevices/inputdevice.h
M  +24   -1    kcms/tablet/kcmtablet.cpp
M  +3    -2    kcms/tablet/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/dbb517756b2fd0673c4c081a6c47113acda1f5cd