Repository navigation
fix(cua-driver): wait for EIS to acknowledge libei input before replying - #4880
Merged
Merged
Conversation
The libei worker replied as soon as input requests were flushed to the socket. A flush is not delivery: the caller's focus guard could restore the user's window while the compositor still had the input queued, and the input then landed in the wrong app. After each input command, send ei_connection.sync and reply only when EIS answers its callback, which it does after processing every earlier request. If no answer comes within 5 s, fail with "delivery is unknown" instead of reporting success. WaitReady and failed commands reply immediately as before. Ported from T3 Code's Linux patch to Cua Driver 0.34.0 (pingdotgg/t3code#16975, MIT, Copyright (c) 2026 T3 Tools Inc.). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What
On GNOME and KDE Wayland, portal input goes through the libei worker (
wayland/libei.rs). The worker replied to the caller once the input requests had been flushed to the socket. A flush is not delivery.with_focused_windowactivates the target, sends input, then restores the user's window. If the compositor had not yet processed the queued input when the restore happened, the input could land in whichever app was restored.Now, after each input command (click, move, scroll, type, key, key sequence, drag), the worker:
ei_connection.syncand flushes;done. EIS sends that only after processing every earlier request on the connection;EIS did not acknowledge input within 5s; delivery is unknownif nodonearrives in 5 s, andEIS connection unavailable for input acknowledgementif there is no connection object.WaitReadyand commands that already failed reply immediately, as before. Callers wait up to 20 s for a reply, so the 5 s window fits inside it. The event loop dispatches every 20 ms, so expiry is checked promptly.Behaviour change to note: on a compositor that is slow to process input, a call that used to report success optimistically can now return the "delivery is unknown" error. That is the intended trade: the result now reflects what the compositor confirmed.
Credit
Ported verbatim from T3 Code's Linux patch to Cua Driver 0.34.0: pingdotgg/t3code#16975,
patches/cua-driver-linux/0.34.0.patch. T3 Code is MIT-licensed, Copyright (c) 2026 T3 Tools Inc. T3 validated it live on GNOME (their installed build 2757). The THIRD_PARTY_NOTICES row comes with #4877 and is extended once that merges.Testing
libei.rsis behind theportal-inputfeature.CI: Rust Linux unitcompiles it (cargo check -p cua-driver --features portal-input), but the default unit run does not include it.Linear: CUA-1237 (tracking CUA-1233)
🤖 Generated with Claude Code