Fix a few cases of stuck keybinds#2269
Open
matte-schwartz wants to merge 3 commits into
Open
Conversation
wlserver_process_hotkeys resolved the keysym from the current xkb state on both press and release. If a modifier is released before the key, the release resolves to a different sym than the press inserted. For example press Shift and the semicolon key to get colon, then release Shift, then release the key to get semicolon. The erase then misses and colon stays in the pressed set forever. Triggers match on exact set equality, so this one phantom sym leaves the pressed set unable to equal the Shift+Tab and Ctrl+Shift+Tab menu triggers, and every keyboard binding stays dead until the session is restarted. Remember the sym each key resolved to at press time and erase it on release, deriving the pressed sym set from that map. Key the map by device as well as keycode so the physical keyboard and the virtual keyboard used for emulated input do not share a keycode namespace. When two keycodes normalize to the same sym, only a release that actually drops the sym ends a binding, so a release that leaves the sym held does not match and get swallowed.
A VT switch suspends libinput while keys are held, so their releases are delivered to the other VT and never erase the map entry. The stale sym then breaks exact set hotkey matching until the same keys are pressed and released again. Clear the pressed set on session deactivate.
The volume and power keys skip wlserver_process_hotkeys and route straight to the root server when it has an input surface. A key pressed while no such surface existed was recorded in the pressed set, and its release then took the bypass and never erased it. The stale sym breaks exact set hotkey matching for every binding. Erase the entry when taking the bypass.
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.
Ran into a few different cases where our keybinds would die in gamescope-session until a restart, finally had a chance to track down where they were coming from.