Bug 500032 - The "Legacy X11 App Support" setting does not work correctly with a different keyboard layout!
Summary: The "Legacy X11 App Support" setting does not work correctly with a different...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: xwayland (other bugs)
Version First Reported In: 6.3.1
Platform: unspecified Linux
: HI major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-13 21:34 UTC by Жора Змейкин
Modified: 2025-05-28 23:06 UTC (History)
8 users (show)

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


Attachments
Demonstration (1.35 MB, video/mp4)
2025-02-13 21:34 UTC, Жора Змейкин
Details
Demonstration №2 (3.10 MB, video/mp4)
2025-02-19 19:50 UTC, Roman
Details
Demonstration 3 (2.14 MB, video/mp4)
2025-02-20 15:44 UTC, cuberbug
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Жора Змейкин 2025-02-13 21:34:12 UTC
Created attachment 178323 [details]
Demonstration

SUMMARY
The bug only appears when using a different keyboard layout (e.g., Russian). If you select any option other than "Never", XWayland apps continue to receive all keystrokes. The bug does not appear on the English layout.

STEPS TO REPRODUCE
1. Open System Settings, go to Application Permissions → Legacy X11 App Support
2. Set it to "Only Meta, Control, Alt and Shift keys"
3. In Keyboard, add a new layout (for example, Russian)
4. Open Konsole and enter: xinput test-xi2 --root
5. Switch to the English layout and try to type something. The command will not output anything
6. Switch to a different keyboard layout and try to type something. The command will start outputting your keystrokes.

OBSERVED RESULT
Keystrokes are sent to XWayland applications

SOFTWARE/OS VERSIONS
Operating System: ALT Regular KDE
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.7.2
Kernel Version: 6.13.2-6.13-alt1 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-5200U CPU @ 2.20GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 5500

ADDITIONAL INFORMATION
I'm attaching a video demonstration. I consider this a rather serious bug that slightly compromises security and interferes with some virtual machines (for example, VMware Workstation intercepts all keystrokes even when its window is out of focus).
Comment 1 Nate Graham 2025-02-19 15:21:32 UTC
Thanks for the screen recording and the detailed steps to reproduce. Nonetheless, when I follow your steps, everything works fine with both keyboard layouts.
Comment 2 Жора Змейкин 2025-02-19 19:17:26 UTC
(In reply to Nate Graham from comment #1)
> Nonetheless, when I follow your steps, everything works fine with both

This is strange. Maybe the issue does not appear in Plasma 6.3 and Frameworks 6.11. I tested this bug on a system with Russian localization and both Russian and English keyboard layouts.

Anyway, I will ask others to test it—perhaps more details will emerge. Thank you for testing!
Comment 3 Roman 2025-02-19 19:50:48 UTC
Created attachment 178607 [details]
Demonstration №2
Comment 4 Roman 2025-02-19 20:10:30 UTC
Hi. The comment is written using DeepL Translate
I found this issue when using vmware which is running through XWayland, video Demonstration #2 attached. Note these points as to why the problem may not be reproducible:
- It doesn't seem to work if you explicitly click on some window other than vmware. On my system, the focus follows the cursor
- In vmware, input must be captured, i.e. Ctrl+Alt cannot be pressed. 
- it doesn't work on English layout
- Sometimes it doesn't work and I don't know why.

Also:
- Only the letters themselves are transferred, special characters, numbers and space are not transferred to Xwayland
- The problem goes away completely if I set “Allow legacy X11 apps to read keystrokes typed in all apps” to “Never”

Information about my system
Operating System: Arch Linux with CachyOS repos
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.12.13-1-cachyos-lts (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7530U with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: Zenbook UM3402YAR_UM3402YA
System Version: 1.0
Comment 5 idk 2025-02-20 08:50:01 UTC
hi! I was able to reproduce the bug too. the bug only appears on a layout other than English (in my case, Russian)

my system:
Operating System: EndeavourOS 
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.2-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × Intel® Xeon® CPU E5-2640 v3 @ 2.60GHz
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 470 Graphics
Comment 6 cuberbug 2025-02-20 15:44:49 UTC
Created attachment 178640 [details]
Demonstration 3
Comment 7 cuberbug 2025-02-20 15:57:27 UTC
Hello! I was also able to reproduce the error that occurs with keyboard layouts other than English. A demonstration can be seen in the attached file: https://bugsfiles.kde.org/attachment.cgi?id=178640

---

Operating System: Arch Linux 
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.3-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31.2 ГиБ of RAM
Graphics Processor: NVIDIA GeForce GTX 1660 SUPER
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B550 AORUS ELITE V2
Comment 8 Lenzoid 2025-05-27 19:05:06 UTC
Wow, can reproduce it here. Only in the Russian keyboard layout all keystrokes entered in Wayland are seen by xinput while they shouldn't. Just in case it might be useful I will describe in more detail what I done.

- Plasma "6.5-dev" git-master 
- Keyboard layouts English US and German, then I added a third, Russian. 
- Assigned Hotkeys to each of them.
- In Settings "Allow legacy X11 apps to read keystrokes typed in all apps: Only Meta, Control, Alt and Shift Keys
- Start in Konsole: xinput test-xi2 --root
- Start Kate, type something in each Keyboard layout. 

In the Russian layout all keystrokes are seen while they really shouldn't. The order in which the keyboard layouts are added didn't matter for me, Russian is always affected. In German and English layout it works as expected.

I agree from a security perspective alone this is concerning and higher priority may be justified.

Operating System: Arch Linux 
KDE Plasma Version: 6.4.80
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.0
Kernel Version: 6.14.7-arch2-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700X3D 8-Core Processor
Memory: 32 GiB of RAM (31.3 GiB usable)
Graphics Processor: NVIDIA GeForce RTX 2070 SUPER
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7B85
System Version: 1.0
Comment 9 Nate Graham 2025-05-28 00:14:51 UTC
That sounds concerning indeed. Raising priority.
Comment 10 Bug Janitor Service 2025-05-28 08:14:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7696
Comment 11 Vlad Zahorodnii 2025-05-28 08:34:54 UTC
Git commit 68e2fc1a32beab64c072d14a14efc60f36d8a04a by Vlad Zahorodnii.
Committed on 28/05/2025 at 08:17.
Pushed by vladz into branch 'master'.

xwayland: Fix leaking normal key presses with keyboard layouts other than English

When using a keyboard layout that's not English, QXkbCommon will report
a unicode character code for the key code.

In order to address that, this change makes the input sniffing code
filter out any key with code less than 0x01000000.

Key codes are split in two parts: 0-0x01000000: regular keys (there is
strong correlation with Unicode codes); and 0x01000000-...: other
custom keys, e.g. F1, Escape, Enter, etc.

M  +93   -220  src/xwayland/xwayland.cpp

https://invent.kde.org/plasma/kwin/-/commit/68e2fc1a32beab64c072d14a14efc60f36d8a04a
Comment 12 Vlad Zahorodnii 2025-05-28 08:54:04 UTC
Git commit 5c7d2de59d6afda320feab9c08a2dd3c4cbc728a by Vlad Zahorodnii.
Committed on 28/05/2025 at 08:36.
Pushed by vladz into branch 'Plasma/6.3'.

xwayland: Fix leaking normal key presses with keyboard layouts other than English

When using a keyboard layout that's not English, QXkbCommon will report
a unicode character code for the key code.

In order to address that, this change makes the input sniffing code
filter out any key with code less than 0x01000000.

Key codes are split in two parts: 0-0x01000000: regular keys (there is
strong correlation with Unicode codes); and 0x01000000-...: other
custom keys, e.g. F1, Escape, Enter, etc.


(cherry picked from commit 68e2fc1a32beab64c072d14a14efc60f36d8a04a)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>

M  +93   -220  src/xwayland/xwayland.cpp

https://invent.kde.org/plasma/kwin/-/commit/5c7d2de59d6afda320feab9c08a2dd3c4cbc728a
Comment 13 Vlad Zahorodnii 2025-05-28 09:00:17 UTC
Git commit bee5b147735a2a558fa40e65be1b8b91f470da38 by Vlad Zahorodnii.
Committed on 28/05/2025 at 08:35.
Pushed by vladz into branch 'Plasma/6.4'.

xwayland: Fix leaking normal key presses with keyboard layouts other than English

When using a keyboard layout that's not English, QXkbCommon will report
a unicode character code for the key code.

In order to address that, this change makes the input sniffing code
filter out any key with code less than 0x01000000.

Key codes are split in two parts: 0-0x01000000: regular keys (there is
strong correlation with Unicode codes); and 0x01000000-...: other
custom keys, e.g. F1, Escape, Enter, etc.


(cherry picked from commit 68e2fc1a32beab64c072d14a14efc60f36d8a04a)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>

M  +93   -220  src/xwayland/xwayland.cpp

https://invent.kde.org/plasma/kwin/-/commit/bee5b147735a2a558fa40e65be1b8b91f470da38