Skip to content

[0.30] Wayland: emit Occluded for the xdg-shell suspended state - #4710

Open
crmne wants to merge 1 commit into
rust-windowing:v0.30.xfrom
crmne:wayland-suspended-occluded-0.30
Open

crmne wants to merge 1 commit into
rust-windowing:v0.30.xfrom
crmne:wayland-suspended-occluded-0.30

Conversation

@crmne

@crmne crmne commented Sep 23, 2026 •

Copy link
Copy Markdown

Backport of #4709 to the 0.30 maintenance branch, where eframe/egui and many other applications still are: WindowEvent::Occluded(true/false) is emitted when the xdg-shell v6 suspended state is added or removed. Every configure still asks for a redraw, and winit never commits on the application's behalf.

CI on v0.30.x fails before compiling, as on the branch itself: cargo update -p syn --precise 2.0.114 is ambiguous now that syn 3 exists (see #4692).

  • Tested on all platforms changed (Wayland)
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

A compositor sends no frame callbacks to a surface it has suspended, for
example on a hidden workspace or while the outputs are off. Winit stopped
reporting this state as `WindowEvent::Occluded` in rust-windowing#3441, together with
the change that made the suspending configure ask for a redraw.

Emit `Occluded(true)` and `Occluded(false)` again when the `suspended`
state is added or removed. Winit still asks for a redraw after every
configure, including the suspending one, and never commits on the
application's behalf, so applications that ignore the event behave as
before.

Refs rust-windowing#3442
@crmne
crmne force-pushed the wayland-suspended-occluded-0.30 branch from a51e41b to e2cb6c0 Compare October 14, 2026 21:55
Xuepoo added a commit to bitty-terminal/bitty that referenced this pull request Oct 26, 2026
* [CTX-1605] build: vendor the winit Wayland Occluded patch

Vendor the exact crates.io winit 0.30.13 source (release commit e9809ef5) into vendor/winit and apply the upstream rust-windowing/winit#4710 v0.30.x backport (head e2cb6c08) unmodified: 5 files, +65/-10, zero fuzz, verified against the registry tree file by file.

Wire the tree through [patch.crates-io] with exclude = ["vendor/winit"], so the path crate never becomes an implicit workspace member and cargo fmt --all / clippy --workspace stay off upstream code. The Wayland backend now emits Occluded(true) when the xdg-shell v6 suspended state is set and Occluded(false) when it clears, which is the native edge the surface-visibility gate consumes for issue #2570. No other backend, public API, feature, or dependency changes; Cargo.lock keeps winit 0.30.13 and only loses the registry source and checksum.

No test is added inside the vendored tree: exercising the edge needs a live WlSurface and WindowConfigure, and any harness there would diverge the source from the upstream PR this record pins. The app-side Occluded gate test covers the consumed edge. Provenance, hunks, the upstream review caveat, the supply-chain result, and the update/exit plan live in vendor/winit/PATCHES.md.

* [CTX-1605] chore: wire vendored winit into lint, dependabot, gate notes

Ignore the exact upstream winit Markdown paths in markdownlint (README, FEATURES.md, docs/, src/changelog/) instead of reformatting vendored source; PATCHES.md stays linted. Tell Dependabot that winit is a patched path dependency it cannot bump, pointing at the PATCHES.md update procedure.

Update the #2570 occlusion comments and the one-shot Wayland triage line: the probe is now the fallback for compositors that never set xdg-shell v6 suspended, not the only Wayland source.

* [CTX-1605] fix(platform): clear the starve baseline on a native reveal

The vendored winit now delivers native Wayland `Occluded` edges. A redraw request that was outstanding when the surface suspended stayed in the probe, so the first `about_to_wait` after the native reveal re-read it as starvation and closed the gate again until the resume frame callback. Record a reveal by clearing `last_request` too; `redraw_seen` stays untouched because a reveal is not proof of a delivered frame.

Add the reviewer failing test (before the fix `starvation_edge` returned `Some(true)` after the native reveal). Dedupe the crash-report `Revealed` mark: a `Resized`/focus-driven synthetic reveal can precede the native `Occluded(false)` for the same transition, so the mark now follows the gate transition instead of the edge count.

* [CTX-1605] fix(ci): fail when winit resolves away from the vendored tree

A requirement bump re-resolves winit to the registry and cargo only warns that the patch was not used: the build stays green and the Wayland Occluded edge disappears. Add `just vendored-winit` (offline, no build) to `just check` and a shard-1 CI step: the lock must carry no source/checksum for winit, cargo metadata --locked must resolve it to vendor/winit, and the whole tree must match the digest pinned in PATCHES.md. The fixture test proves the registry-lock, out-of-tree-manifest, checksum-only, stale-digest, missing-digest, and missing-tree cases fail while the production state and a synthetic path-resolved graph pass.

Ignore winit in the Dependabot cargo update so the monthly grouped bump cannot silently undo the patch, and keep the actionable note in PATCHES.md.

PATCHES.md now records the tree digest and the exact recompute command, and the advisory coverage gap: path packages carry no registry source, so neither cargo audit nor cargo deny advisories matches RustSec ranges against the vendored tree (control test: a synthetic time 0.1.44 entry matches RUSTSEC-2020-0071 with a registry source and does not without one). It carries the deny.toml-aligned 2027-03-31 re-audit bound and a synthetic-lock audit snippet, corrects the cargo update wording, and points the update procedure at the digest and the gate. deny.toml points auditors at the same compensating controls.

* [CTX-1605] chore: keep the vendored patch bytes exempt from whitespace checks

The recorded #4710 diff must stay byte-identical to upstream (its SHA-256 is pinned in PATCHES.md); empty diff context lines carry a trailing space by definition, so `git diff --check` reports them if the file is ever touched. Mark the patch file with `-whitespace` and say why.

* [CTX-1605] docs: close the vendored-patch record gaps

F9: the tree digest deliberately excludes patches/, so editing the recorded diff alone passed the gate. `just vendored-winit` now also hashes the file named by the `Patch` row against `Patch SHA-256` and fails with both values; the fixture test mutates the diff and proves the failure while the tree digest still matches (and keeps the intact fixture passing).

F8: add the deterministic dedupe test next to the occlusion gate test: a sentinel Resized followed by Occluded(false) on an open gate leaves the lifecycle mark untouched, while the real Occluded(true) -> Occluded(false) transition still records revealed. It fails without the dedupe (left: revealed, right: resized) and passes with it.

F7: the exit plan now also removes the gate wiring (justfile recipes and the check entry, the CI step, the script with its test and fixtures, the .gitattributes line, and the dependabot ignore).

F6: the supply-chain bullet no longer claims no deny.toml edit: there is no policy change, only the CTX-1605 comment pointing at the advisory section. F10: the gate is no longer described as offline (it needs the local cargo index/cache), and the advisory snippet records that --no-fetch needs a populated ~/.cargo/advisory-db.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant