Repository navigation
Conversation
When input emulation fails, the emulation task logs the error and waits for a request to enable it again. Only the GUI and the CLI send one, so emulation stays off until someone does it by hand, and the sending side releases capture because the receiver reports emulation as disabled. Start emulation again after 250 ms, 500 ms, 1 s, 2 s, 5 s, 10 s and 30 s, then stop and wait for a request as before. A request to enable emulation skips the wait and starts the delays over, as does a session that ran for at least 10 seconds before it failed. Do not restart on its own when the user cancelled the permission prompt, since the prompt would come back every time. Expose that check as `InputEmulationError::cancelled_by_user`. Refs feschber#193
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.
Refs #193.
When input emulation fails, the emulation task logs
input emulation exited: ...and waits for a request to enable it again. Only the GUI and the CLI (enable-emulation) send one, so emulation stays off until someone does it by hand. While it is off, the receiving side drops incoming events, and the sending side seesemulation_active = falseand releases capture.This starts emulation again after an error, with growing delays, and stops after a few attempts.
In #193 the maintainer wanted to avoid a loop that keeps re-enabling emulation and failing, for example when the compositor is gone, and said some sort of timeout makes sense for recoverable errors. A user suggested 1 s, 10 s, 30 s and then stop. The schedule below is in that spirit.
Behaviour
InputEmulationError::cancelled_by_useris new and public, because the check was only available insideinput-emulation.Choices
I picked a default for each. The alternatives are listed so the call can go the other way.
1. How long to keep trying
2. A cancelled permission prompt
3. What the GUI shows during retries
4. A refused
SendInputon Windows (#516)Testing
Unit tests cover the delay schedule, and the wait: it ends after the delay, a request to enable ends it early, terminate ends it, and other requests are ignored.
cargo fmt,cargo clippy --workspace --all-targets --all-featuresandcargo test --workspacepass.The restart loop itself is not covered. It needs a backend that can be made to fail, and the dummy backend never fails. I have not tried it against a real compositor or on Windows.
Related and overlapping
EmulationTaskinsrc/emulation.rs. Whichever merges second needs a rebase.