gpui_linux: Fix X11 keyboard state synchronization#53903
Merged
SomeoneToIgnore merged 2 commits intomainfrom Apr 16, 2026
Merged
gpui_linux: Fix X11 keyboard state synchronization#53903SomeoneToIgnore merged 2 commits intomainfrom
SomeoneToIgnore merged 2 commits intomainfrom
Conversation
This was referenced Apr 14, 2026
Closed
SomeoneToIgnore
approved these changes
Apr 16, 2026
AzureZee
added a commit
to AzureZee/gpuix
that referenced
this pull request
Apr 17, 2026
AzureZee
added a commit
to AzureZee/gpuix
that referenced
this pull request
Apr 17, 2026
G36maid
pushed a commit
to G36maid/zed
that referenced
this pull request
Apr 29, 2026
) Closes zed-industries#49329 This area has regressed a few times across zed-industries#34514, zed-industries#35361, and zed-industries#44234. The problem is that we were still mixing XKB client-side and server-side state handling on the same `xkb::State`. On X11, `XkbStateNotify` already keeps the client state synchronized. But the key event path was still doing two extra things on the shared `state.xkb`: - calling `update_key()` - rewriting the same state from `KeyPress` / `KeyRelease.state` The libxkbcommon X11 docs say that `XkbStateNotify` is the more accurate source of truth for X11 clients and that there is no need to call `xkb_state_update_key()` once the client state is synchronized. This follows the libxkbcommon X11 client model more closely by keeping persistent state notify-driven and using event-local state only for lookup. This PR fixes that by: - removing the remaining `update_key()` calls from X11 `KeyPress` / `KeyRelease` - keeping the long-lived `state.xkb` driven only by `XkbStateNotify` and keymap notifications - creating a temporary event-local `xkb::State` for per-event lookup I also added regression tests around the historical bugs in this area: - zed-industries#14282: Caps Lock / Neo 2 regressions from the earlier X11 fixes - zed-industries#31193: German key resolution - zed-industries#26468: `space` with Cyrillic and Czech layouts / non-locked layout groups - zed-industries#40678: macro-style shifted input like `Shift+]` Release Notes: - Fixed issue on Linux X11 where you coundn't input space key in some cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49329
This area has regressed a few times across #34514, #35361, and #44234. The problem is that we were still mixing XKB client-side and server-side state handling on the same
xkb::State.On X11,
XkbStateNotifyalready keeps the client state synchronized. But the key event path was still doing two extra things on the sharedstate.xkb:update_key()KeyPress/KeyRelease.stateThe libxkbcommon X11 docs say that
XkbStateNotifyis the more accurate source of truth for X11 clients and that there is no need to callxkb_state_update_key()once the client state is synchronized. This follows the libxkbcommon X11 client model more closely by keeping persistent state notify-driven and using event-local state only for lookup.This PR fixes that by:
update_key()calls from X11KeyPress/KeyReleasestate.xkbdriven only byXkbStateNotifyand keymap notificationsxkb::Statefor per-event lookupI also added regression tests around the historical bugs in this area:
spacewith Cyrillic and Czech layouts / non-locked layout groupsShift+]Release Notes: