Skip to content

fix(wlroots): recover input emulation after bounded output stalls - #526

Draft
Rand01ph wants to merge 1 commit into
feschber:mainfrom
Rand01ph:fix/wlroots-output-recovery
Draft

Rand01ph wants to merge 1 commit into
feschber:mainfrom
Rand01ph:fix/wlroots-output-recovery

Conversation

@Rand01ph

Copy link
Copy Markdown

When the wlroots Wayland output socket remains blocked, input events are currently discarded while the sending machine can remain captured. In our macOS → Hyprland setup, a temporary stall could leave emulation disabled until an explicit re-enable, making subsequent edge crossings fail.

This patch drains compositor replies, retries flush asynchronously for up to 500ms, and returns a distinct error if output remains blocked. The daemon sends Leave to its peers, destroys the old devices, and rebuilds emulation after two seconds. Recovery is limited to three attempts per rolling minute. Initialization, permission and protocol errors still require explicit re-enabling. Old handles and queued input are discarded before recovery; stale key presses are not replayed.

This is based on current main (f1b96bd), which already includes #491. It does not include or require #473, change the wire protocol, add production dependencies, or contain machine-specific SSH supervision.

Validation:

  • Three daemon unit tests cover stale-input draining, immediate termination during the recovery wait, and the recovery budget.
  • A recording-backend test verifies key-up and modifier reset are emitted before virtual devices are destroyed on termination.
  • Two isolated real-Wayland fault-injection runs passed on Hyprland: a Unix-socket proxy pauses reads for 1200ms on the test connection only; the backend transitions Enabled → Disabled → Enabled and accepts new zero-distance motion. No keys/buttons are injected, and the compositor/user applications are not paused. The reproducible harness is in tests/wayland-recovery and requires Python only for testing.
  • Linux affected-crate clippy with -D warnings, daemon library clippy, formatting and whitespace checks passed.
  • The recovery logic running on the older fix(macos): prevent bidirectional capture loops #473-based local build handled two real 500ms stalls during normal cross-screen use. The current-main version here was independently tested as described above.

Draft boundaries: the compositor-side cause of the intermittent stalls is not established; this makes failure and recovery bounded, rather than claiming to fix Hyprland itself. Full cross-platform workspace CI and longer idle/resume testing remain pending. In particular, this is not a proven lock-screen-specific bug.

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