fix(linux): repair X11 overlay after display changes#2354
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f222afbdc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
the fix appears to address the hotplug defect, but some fixes needed to tighten the diff before merge: preserve the existing |
|
@injaneity Addressed all four cleanup requests in
Validation: rustfmt; |
|
one remaining lifecycle race before merge:
please make shutdown disconnect the receiver before releasing waiters and add a deterministic regression covering registration during teardown. |
7b5f623 to
2b86978
Compare
|
@injaneity Addressed the lifecycle race in rebased head The branch is now rebased onto current Teardown now transfers ownership of the command receiver into
This closes both sides of the race: registrations before waiter release are swept, while registrations afterward cannot enqueue and cancel their own waiter. The regression inserts registration exactly after disconnect and before release; inside that hook it first proves Validation on the rebased tree: rustfmt; |
|
thanks for your effort! one remaining follow-up from my end: please gate the periodic z-order reassertion on using |
Summary
BadWindowraceFixes #2350.
Follow-up to #2331.
Why this is separate from #2331
#2331 fixed initial XShape safety and removed the continuous full-root render loop. Its X11 overlay still snapshots the root dimensions once, discards X11 events, and blocks indefinitely on the command channel when all cursors are quiescent.
That leaves a long-lived overlay stale after monitor hotplug or root resize. On the reported GNOME/Xorg system, the stale root-sized overlay was strongly correlated with an opaque black surface after both displays reconnected.
This patch repairs the deterministic geometry/lifecycle gap. The exact GNOME/Xorg shape-exposure mechanism remains field-only and is not claimed as deterministically reproduced.
Safety behavior
Before
ConfigureWindow, the repair path sets both XShape input and bounding regions to empty and checks each request. It uploads replacement pixels while the overlay remains hidden, then installs the checked cursor-local shape last.A pinned target can disappear after its liveness probe but before the unchecked z-order
ConfigureWindowreaches X11. The event path recovers only a coreConfigureWindowBadWindownaming a non-overlay resource, then lets the next z-order tick fall back to no sibling. An overlay-windowBadWindow,BadMatch, PutImage failure, or any other asynchronous server error remains fatal: the owner thread exits, drops the X11 connection/window, releases active animation waiters, and marks the X11 renderer unavailable instead of leaving an unsafe overlay or a hung caller.After resize, normal tile rendering restores either:
No full-root pixel buffer or full-root paint path is restored.
Validation
Automated:
cargo fmt --all -- --checkcargo test -p platform-linux --lib --locked— 151 passedcargo test -p cursor-overlay --locked— 12 passedcargo test --workspace --no-run --lockedcargo build -p cua-driver --lockedgit diff --checkIsolated A/B harness (never used the live display):
:109hosted resizable Xephyr:110428d7aa, SHA-2566b33fb6798d14e20e32fbc8e2bb91965e81ef39ae333bbe2d0748999cee9907a): root changed 1280×1024 → 1024×768, but overlay remained stale at 1280×1024No actionable findings.No actionable findings.send_command_for(CursorKey, OverlayCommand) -> ()contract with a compile-time regression test, removes the unused geometry-update result, renames the event/error classifier and drain path, and refreshes render-loop documentation; independent exact-diff re-review:No actionable findings.No actionable findings.Xephyr preserved #2331's empty shape and therefore did not reproduce the opaque-black GNOME/Xorg symptom; it did deterministically reproduce the stale-geometry defect fixed here.