Bug 482847 - Additional mouse button bindings no longer work since commit bf1ce854748bfd2433c336a9ee972883cb8617ab
Summary: Additional mouse button bindings no longer work since commit bf1ce854748bfd24...
Status: ASSIGNED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: master
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-03-08 10:37 UTC by Prajna Sariputra
Modified: 2024-04-20 23:19 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prajna Sariputra 2024-03-08 10:37:00 UTC
SUMMARY
With Plasma 6.1 from git master, I noticed that the bindings I have set up for the additional buttons on my mouse no longer work, they just end up doing the default action bound to them. In my case the buttons are recognized by libinput as `BTN_EXTRA (276)` and `BTN_SIDE (275)`.

If I revert the part of commit bf1ce854748bfd2433c336a9ee972883cb8617ab (Make it possible to build KWin without libxcb) that applies to the buttonrebinds plugin then the bindings work again, and reverting KWin to the commit before that also works.

In the system logs, these messages appeared when I pressed the mouse buttons (two of these messages appear for every button press):

> kwin_wayland[42047]: kwin_buttonrebinds: Could not convert QKeySequence("Meta+G") syms:  QList(285212743) to keycode
> kwin_wayland[42047]: kwin_buttonrebinds: Could not convert QKeySequence("Meta+G") syms:  QList(285212743) to keycode
> kwin_wayland[42047]: kwin_buttonrebinds: Could not convert QKeySequence("Alt+F1") syms:  QList(150994992) to keycode
> kwin_wayland[42047]: kwin_buttonrebinds: Could not convert QKeySequence("Alt+F1") syms:  QList(150994992) to keycode



STEPS TO REPRODUCE
1. Have a mouse with extra buttons that can be configured via the "Re-bind Additional Mouse Buttons..." page in the Mouse KCM (mine is just a random "gaming" mouse I picked up in a nearby store, with two side buttons)
2. Set up a binding for one of those mouse buttons (I used Meta+G and Alt+F1 for the desktop grid and app launcher)
3. Press the mouse button with the binding

OBSERVED RESULT
The button acts as if no binding was set and just performs the default action (for me the buttons act like forward and back buttons of some sort out of the box).

EXPECTED RESULT
The keyboard shortcut bound to the button should be triggered.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.8-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 Bug Janitor Service 2024-03-10 21:17:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5409
Comment 2 fanzhuyifan 2024-03-10 21:25:32 UTC
Two issues here: 

1. We need to remove the modifiers. This is handled by the the MR above.
2. QXkbCommon::toKeysym sometimes only returns one key sym even when there are multiple matching key syms. (https://github.com/qt/qtbase/blob/dev/src/gui/platform/unix/qxkbcommon.cpp#L455)
E.g., the Qt::Key_Delete maps to both XKB_KEY_Delete and XKB_KEY_Clear, but QXkbCommon::toKeysym only returns XKB_KEY_Clear...
I will try to upstream a patch for that
Comment 4 fanzhuyifan 2024-03-14 21:48:56 UTC
Git commit 6c4551ff46b1b2ed26dd3d3ab5601da8dd2cb19d by Yifan Zhu.
Committed on 14/03/2024 at 21:37.
Pushed by fanzhuyifan into branch 'master'.

plugins/buttonrebinds: remove modifiers before keysym conversion

QXkbCommon::toKeysym can't handle modifiers in key.

M  +1    -1    src/plugins/buttonrebinds/buttonrebindsfilter.cpp

https://invent.kde.org/plasma/kwin/-/commit/6c4551ff46b1b2ed26dd3d3ab5601da8dd2cb19d
Comment 6 Bug Janitor Service 2024-04-20 23:19:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5628