Summary: | RemoteDesktop.NotifyKeyboardKeysym doesn't use correct keyboard layout to calculate keycode | ||
---|---|---|---|
Product: | [Plasma] xdg-desktop-portal-kde | Reporter: | Aroun <kde> |
Component: | general | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | accounts+kde, airmailsteam, aleixpol, andrew.g.r.holmes, jgrulich, mk.mateng, nate, theconfuzzleddude |
Priority: | NOR | ||
Version: | 6.1.0 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Aroun
2024-06-23 05:41:49 UTC
@Nate Graham, although the steps to reproduce are with KDE Connect, the bug is experienced in relation to xdg-desktop-portal-kde, unrelated to KDE Connect or to Android. See for example https://github.com/keepassxreboot/keepassxc/pull/10905#issuecomment-2171362215 : > The only issue I’m having is that when I switch keyboard layout, the autotype changes. > On my default fr oss layout it types correctly. Changing to fr bepo_afnor or us intl types wrong characters. > It is actually pressing the same keys on the keyboard, but now they have different characters. The previous product selection was correct. The bug is in the desktop portal implementation, and should be handled there. Can you show where the bug is in our portal implementation? And maybe also update the title to describe the problem more fully? I'm the person implementing the aforementioned auto-type feature in KeepassXC. I've tracked down the source of the issue to the Xkb class in src/waylandintegration.cpp, it seems like the implementer got mixed up between the client and server. The keymap is correctly obtained through the `keyboard_keymap` event, and a state is created from that keymap. At the start of `keycodeFromKeysym`, the layout is attempted to be obtained from the state through calling `xkb_state_serialize_layout`. However, as the desktop portal is acting as a XKB client here, it is supposed to be tracking the state itself, and the `xkb_state_serialize_layout` is for server applications to send the layout to clients. Because the desktop portal is using a default state, without tracking anything, this will always return the first defined layout in the keymap, meaning regardless of what layouts are configured, the first layout in the defined order will determine what keys are pressed to produce a symbol (with obviously terrible results if you use a non qwerty layout). The correct implementation doesn't require an `xkb_state` to be created at all. Rather, the `keyboard_modifiers` event should be implemented, which I believe is called by the display server whenever the group (aka layout) is changed, and that value can then be passed to the rest of the `keycodeFromKeysym` function Typing from KDE connect on android over to Plasma wayland, messes with the capitalisation of the letters. If caps lock on the PC is on, all the letters sent from KDE connect appear as upper case and vice versa if caps lock is off. The expected behaviour would be to have the correct letter typed with the case being sent by KDE connect. This breaks typing passwords from my password manager on the phone since they are case sensitive --- Not sure if it belongs here or if should be a separate bug (if it is, happy to make one) |