fix(cua-driver): preserve X11 keyboard delivery and timing - #3709
Closed
steipete wants to merge 1 commit into
Closed
fix(cua-driver): preserve X11 keyboard delivery and timing#3709steipete wants to merge 1 commit into
steipete wants to merge 1 commit into
Conversation
Collaborator
|
Thanks again, Peter — this has landed on We used the current- The X11 regressions, ordinary CI, and exact-candidate Linux/Windows desktop matrices passed. We also completed macOS certification and confirmed its unrelated Electron background-text failure reproduces identically on the pre-change base. Closing this PR only because the credited replacement is merged. Thank you for the fix and the clear reproduction! |
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.
Summary
Linux X11 keyboard taps were buffered across the intended hold interval, so applications received key-down and key-up together. Background keyboard calls could also return success without delivering their final events when the short-lived input connection closed.
Flush key-down before the existing 10 ms delay in XTest key taps, targeted background key taps, and background text typing. Complete background delivery with a reply-bearing X11 request before closing the connection. Keep modifier ordering, target routing, focus, and existing delays intact.
Related work
Fixes #3708.
No RFC is required: this repairs existing Linux input behavior without changing a public SDK, CLI, MCP, protocol, or permission contract.
Compatibility and risk
The production change is limited to X11. macOS, Windows, and native Wayland input implementations are unchanged. The background completion query is read-only; tests verify another window keeps keyboard focus. A synchronization failure is returned instead of being reported as successful background delivery.
This does not add held-key support or guarantee that a 10 ms tap is observed by a game polling at 35 Hz. It restores the existing tap interval and event-delivery contract. Rollback is a revert of this commit.
Validation
Candidate:
df3b3b670(the committed source matches the tested working tree).On a disposable Ubuntu 26.04 x86_64 host with Rust 1.97.1 and isolated Xvfb:
xvfb-run -a cargo test -p platform-linux --test key_input_x11 --locked -- --ignored --nocapture --test-threads=1: 2 passed.cargo test -p platform-linux --lib --locked: 436 passed, 5 existing environment-dependent tests ignored.cargo fmt --all -- --checkandgit diff --check: passed.A separate concurrent native event receiver measured 9.568–10.662 ms arrival intervals across ten calls each to background key, coordinate-targeted key, and typing; all 60 events reached the target and sentinel focus stayed unchanged. These background measurements are diagnostic evidence, not timing assertions in CI, because synthetic XSendEvent timestamps are zero.
The Linux CI workflow explicitly runs the new isolated-X11 regressions. Ordinary PR CI and the repository's complete cross-platform desktop certification remain pending; this PR is submitted as a draft for maintainer review. No full-gameplay or downstream OpenClaw integration proof is claimed.
Contributor and release checks
fix(cua-driver)type.