Summary: | Wayland-native apps get sent wrong modifier key data | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Renner03 |
Component: | input | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kde, nate, nicolas.fella |
Priority: | HI | ||
Version: | 6.1.1 | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/plasma/kwin/-/commit/374d8594931861ef7dfbed8eda5f8552aa4f825c | Version Fixed In: | 6.2.0 |
Sentry Crash Report: |
Description
Renner03
2024-07-14 19:32:19 UTC
Also happening with 5.27, so not a new behavior. What's suspicious and probably related: Using "Never" we first get wl_keyboard.key, then wl_keyboard.modifiers: [14: wl_keyboard] key: serial: 12960; time: 12368442; key: 37; state: 1 (pressed) sym: Control_L (65507), utf8: '' [14: wl_keyboard] modifiers: serial: 12961; group: 0 depressed: 00000004: Control latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 12962; time: 12372454; key: 37; state: 0 (released) sym: Control_L (65507), utf8: '' [14: wl_keyboard] modifiers: serial: 12963; group: 0 depressed: 00000000 latched: 00000000 locked: 00000000 Using other settings we get first wl_keyboard.modifiers, then wl_keyboard.key: [14: wl_keyboard] modifiers: serial: 13475; group: 0 depressed: 00000004: Control latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 13477; time: 12451531; key: 37; state: 1 (pressed) sym: Control_L (65507), utf8: '' [14: wl_keyboard] modifiers: serial: 13478; group: 0 depressed: 00000000 latched: 00000000 locked: 00000000 [14: wl_keyboard] key: serial: 13480; time: 12452327; key: 37; state: 0 (released) sym: Control_L (65507), utf8: '' https://wayland.app/protocols/wayland#wl_keyboard:event:key says > If this event produces a change in modifiers, then the resulting wl_keyboard.modifiers event must be sent after this event. Confirmed. Code in Xwayland is: keyboard->sendModifiers(xkb->modifierState().depressed, xkb->modifierState().latched, xkb->modifierState().locked, xkb->currentLayout()); // update global state keyboard->sendKey(event->nativeScanCode(), state, xwaylandClient); // to only xwayland that's clearly wrong, but it's not a super trivial fix either. A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6106 Cosmetic issue affecting non-default settings with a known workaround; lowering severity and priority. The Konsole issue is minor, but the root cause potentially affects a lot more apps in unknown ways What are other potential effects, in general terms? Any wayland app that acts on modifier keys to do stuff is being given wrong data and therefore could be broken with us at fault, which is why I set it high. But the bugzilla severity doesn't really matter long term, it's being fixed either way. Git commit 374d8594931861ef7dfbed8eda5f8552aa4f825c by David Edmundson. Committed on 24/07/2024 at 15:57. Pushed by davidedmundson into branch 'master'. xwayland: Only update keyboard modifers for XWayland's keys KeyboardInterface is a multiplexer, it has a global state to kwin that forwards events the single focussed window. XWayland also forwards events to clients, but uses the keyboard interface. It has some overloads that take a specific client, this was used for key events but not modifiers. The end result was not only that XWayland could miss a modifier update, but also that wayland clients would get modifier updates out of order. Key events must come first. M +56 -0 autotests/integration/x11keyread.cpp M +9 -0 src/wayland/keyboard.cpp M +1 -0 src/wayland/keyboard.h M +34 -3 src/xwayland/xwayland.cpp https://invent.kde.org/plasma/kwin/-/commit/374d8594931861ef7dfbed8eda5f8552aa4f825c Got it. Re-titling and re-raising priority, if only for the historical record's sake. |