Preserve IME ordering: forwarded key presses create an outstanding re… - #9153
Open
daym wants to merge 1 commit into
Open
Preserve IME ordering: forwarded key presses create an outstanding re…#9153daym wants to merge 1 commit into
daym wants to merge 1 commit into
Conversation
…sponse count; text-input state/done snapshots wait behind those keys; later keys wait behind queued state. Previously, Sway was letting zwp_input_method_v2.done advance the IM serial while a key already forwarded through zwp_input_method_keyboard_grab_v2.key could still answer with a commit using the older serial. wlroots then rejected that commit per protocol.
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.
…sponse count; text-input state/done snapshots wait behind those keys; later keys wait behind queued state.
Previously, Sway was letting zwp_input_method_v2.done advance the IM serial while a key already forwarded through zwp_input_method_keyboard_grab_v2.key could still answer with a commit using the older serial. wlroots then (correctly) rejected that commit per protocol.
I had had programs lose some (like 10%) letters I typed when I typed fast. I had suspected my fingers, my keyboard hardware etcetc. But no, it was just an entirely predictable problem with message handling.
This fixes the problem by making Sway preserve the ordering between input-method keyboard grab keys and input-method done events. Forwarded key presses create an outstanding response count. Text-input state updates are snapshotted and queued behind outstanding key presses. If another key arrives while state is queued, the key is queued behind that state, so sequences such as K1, S1, K2, S2 are delivered to the input method as K1, then S1, then K2, then S2. A key response is considered observed when Sway receives either an input_method.commit or a same-client virtual-keyboard key press, which is the observable path used when the input method forwards an unhandled key instead of committing text.
See bug report #9154 , which this fixes.