Bug 475704 - Stylus button that should send a right-click instead does nothing
Summary: Stylus button that should send a right-click instead does nothing
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: master
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6, wayland
Depends on:
Blocks:
 
Reported: 2023-10-16 16:35 UTC by Nate Graham
Modified: 2024-02-26 09:10 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
sudo libinput record (114.30 KB, text/x-log)
2023-10-16 16:35 UTC, Nate Graham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2023-10-16 16:35:59 UTC
Created attachment 162351 [details]
sudo libinput record

Plasma 6 git master, Wayland, 200% scale.

My 2-in-1 laptop has a garaged pen with two buttons. 

The button farther from the tip middle-clicks when pressed.

The button closest to the tip does nothing when pressed, but it should do a right-click. I tested in the following apps:
- Dolphin
- Kate
- Gedit
- Firefox
- Discord
- Plasma

So it seems like a general input handling issue, rather than a bug in specific apps or toolkits.

I'm attaching a log from `sudo libinput record`.
Comment 1 Nicolas Fella 2023-10-16 18:44:14 UTC
Cannot reproduce with my Wacom tablet and any of the listed apps.

The behavior for which of the two buttons on the stylus is inconsistent between apps, but that's up to the app to decide
Comment 2 Nate Graham 2023-10-23 16:47:32 UTC
Results of some testing today on Plasma 6 Wayland and X11:


All Qt apps tested, both Wayland and X11
========================================
- tip left-clicks everything
- first button does nothing
- second button middle-clicks


GTK apps
========
GIMP on Wayland and X11:
- tip left-clicks everything
- first button does nothing
- second button middle-clicks


Gedit on Wayland:
- tip left-clicks on some UI elements, does nothing for others (e.g. menu items in popup menus)
- first button does nothing
- second button right-clicks

Gedit on X11:
- tip left-clicks everything
- first button does nothing
- second button middle-clicks


GNOME Text Editor on Wayland
- tip left-clicks everything
- first button does nothing
- second button right-clicks

GNOME Text Editor on X11
- tip left-clicks everything
- first button does nothing
- second button middle-clicks


Firefox on Wayland:
- tip left-clicks everything
- first button does nothing
- second button right-clicks

Firefox on X11
- tip left-clicks everything
- first button does nothing
- second button does nothing
Comment 3 David Redondo 2024-02-23 10:51:40 UTC
I am not in expert in this so take the following with some caveats.

I have tested this with a Pen with two buttons: They generate BTN_STYLUS and BTN_STYLUS2. These are mapped everywhere to middle and right click respectively and that what I see on Plasma.
I've checked QtWayland, GTK, X11 evdev, wacom and libinput drivers, as well as Xwayland.
So I am confused  a bit that you are seeing different behavior between X11 and Wayland and sometimes different buttons ,did you configure the x driver somehow?

In your log I see no actual button press but BTN_TOOL_PEN and BTN_TOOL_RUBBER, I think your first button actually switches the "tool" that your pen represents from pen to eraser instead of being a button button. That's why it doesn't do anything in any app.
Comment 4 Nate Graham 2024-02-23 21:36:47 UTC
So you're saying my pen is being a bit special? 😅 Maybe what we need is a way to re-map pen buttons not just to keyboard shortcuts, but mouse buttons. That's tracked by 469232 already.

Another issue is that when my pen enters this eraser mode, there's no cursor change to signal this so that I know it's not just broken. Let's use the bug report to track that.
Comment 5 Nicolas Fella 2024-02-23 21:43:20 UTC
Please don't recycle bug reports for something different than originally reported. Bugreport ids aren't scarce, we can afford a new one, and it makes things confusing for future readers
Comment 6 Nate Graham 2024-02-23 21:46:08 UTC
Ok
Comment 7 Nate Graham 2024-02-23 21:56:02 UTC
See Bug 481737 and Bug 481738.
Comment 8 David Redondo 2024-02-26 09:10:44 UTC
> So you're saying my pen is being a bit special? 

I think its common-ish