Skip to content

Forward Wayland modifier events to wlroots seat when nested#2273

Open
bjornmp wants to merge 1 commit into
ValveSoftware:masterfrom
bjornmp:fix/wayland-nested-modifier-forwarding
Open

Forward Wayland modifier events to wlroots seat when nested#2273
bjornmp wants to merge 1 commit into
ValveSoftware:masterfrom
bjornmp:fix/wayland-nested-modifier-forwarding

Conversation

@bjornmp

@bjornmp bjornmp commented Jul 21, 2026

Copy link
Copy Markdown

Summary

When gamescope runs nested on a Wayland compositor, it receives wl_keyboard.modifiers from the host compositor but previously only stored them locally. Key events were injected via a stub virtual keyboard with no modifier state, so clients (especially Xwayland apps) received key presses with modifier state 0x0.

This change forwards modifier events to the wlroots keyboard_group and injects keys through that keyboard, so the seat reports correct Shift/Ctrl/Alt state.

Fixes #1740
Fixes #2032

Root cause

Discussed in #1740: older Xwayland versions ran their own XKB state machine and masked this bug. Xwayland 24.1.5+ correctly expects the compositor to forward modifier state (xserver MR 1758), which exposed the issue in gamescope.

Test plan

  • gamescope -- konsole — Shift+letters produce capitals
  • War Thunder via gamescope on KDE Plasma Wayland (Xwayland 24.1.13) — Shift works for typing and game binds
  • Modifier forwarding works regardless of Xwayland version (correct compositor behavior)

Environment

  • openSUSE Tumbleweed, KDE Plasma 6.7 Wayland
  • Xwayland 24.1.13
  • gamescope built from master (976f7fc) with this patch

Made with Cursor

@bjornmp
bjornmp force-pushed the fix/wayland-nested-modifier-forwarding branch 2 times, most recently from af4a50a to 8f9e787 Compare July 21, 2026 00:35
When running nested on a Wayland compositor, gamescope received
wl_keyboard.modifiers from the host but only stored them locally.
Key events were injected through a virtual keyboard with no modifier
state, so Xwayland clients saw key presses with state 0x0.

Forward modifier updates to the keyboard group and inject keys through
that keyboard so the seat reports correct Shift/Ctrl/Alt state.

Fixes ValveSoftware#1740
Fixes ValveSoftware#2032

Co-authored-by: Cursor <cursoragent@cursor.com>
@bjornmp
bjornmp force-pushed the fix/wayland-nested-modifier-forwarding branch from 8f9e787 to 8d7e59d Compare July 21, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shift key combinations and Caps Lock not working inside Gamescope (Wayland + KDE, openSUSE) Unable to type uppercase letters in Wayland clients

1 participant