Skip to content

Fix a few cases of stuck keybinds#2269

Open
matte-schwartz wants to merge 3 commits into
ValveSoftware:masterfrom
matte-schwartz:stop-dropping-my-keybinds
Open

Fix a few cases of stuck keybinds#2269
matte-schwartz wants to merge 3 commits into
ValveSoftware:masterfrom
matte-schwartz:stop-dropping-my-keybinds

Conversation

@matte-schwartz

Copy link
Copy Markdown
Collaborator

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.

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.
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.

1 participant