Skip to content

feat(overlay): Wayland toplevel fallback without layer-shell or XWayland, and degraded-capability reporting (#20) - #2197

Merged
opencodejr[bot] merged 1 commit into
devfrom
bot/issue-20
Nov 25, 2026
Merged

opencodejr[bot] merged 1 commit into
devfrom
bot/issue-20

Conversation

@opencodejr

@opencodejr opencodejr Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #20.

What changed

  • Fallback chain. On Wayland an overlay now tries layer-shell, then XWayland, then a new undecorated, transparent xdg toplevel (crates/rune/src/overlay/toplevel.rs). Overlays that used to go Unavailable on GNOME now get a surface: no XWayland, KeyPolicy::OnDemand, or pointer input without OverlayOptions::xwayland_input.
  • Toplevel behaviour.
    • It carries the app's id (with_name), so the dock groups it with the app instead of listing it alone.
    • Its appearance comes from preferences::window_dark, the same helper ordinary windows use.
    • Wayland can't hide a toplevel, so hide_window destroys it and drops its hidden images, as for a layer surface. The next show makes a new one.
    • Its input region is all or nothing (set_cursor_hittest): empty for OverlayInput::None, the whole surface otherwise. It's set on creation and again in apply_input.
  • Capability report. OverlayCapabilities gains placement, always_on_top and click_through. A crate-private OverlayCapabilities::placed(..) builds them as Supported for every existing backend (layer-shell, XWayland, X11, macOS, Windows). The toplevel reports placement and always_on_top as Unsupported, and click_through too under OverlayInput::Regions. Capture exclusion, global pointer and nonactivating keys are also Unsupported there. overlay-lab already prints OverlayCreated { capabilities }, so the new fields appear in its output.
  • Docs. Updated the edge-overlay section of crates/rune/README.md and the module docs; added changelog/unreleased/2026-11-25-wayland-overlay-toplevel-fallback.md.

Compatibility

Code that builds OverlayCapabilities as a struct literal needs the new fields. I found none in this repository; the changelog notes it. The compositor may focus the toplevel when it appears (nonactivating_keys is Unsupported).

Testing

  • cargo check -p rune --all-targets is clean.
  • cargo clippy -p rune --lib --tests adds no new kinds of warning. The new .unwrap() on the capabilities lock gets the same unwrap_used warning as the existing locks in these files.
  • Tests were linked against the system's runtime libxkbcommon.so.0 through RUSTFLAGS="-L <dir>", because its dev package isn't installed here. With RUNE_ALLOW_NO_GPU=1:
    • cargo test -p rune --lib toplevel: both new tests in toplevel_tests.rs pass.
    • cargo test -p rune --lib overlay: 134 passed.
    • A full cargo test -p rune --lib run on the first version of this patch: 3122 passed, 1 failed. The failure (el::tx::rects::tests::a_handler_reads_a_row_it_removes_where_it_stood) fails the same way without this change. Not re-run after the review fixes.
  • cargo check -p rune --lib --target x86_64-unknown-freebsd: the cfg error the review found (portal_appearance missing on non-Linux Unix) is gone. One error is left (commit_generation in window/host/stepping.rs); it fails the same way without this change.

Not verified

No overlay example has been seen on GNOME Wayland, or on any real compositor. The issue's "Done when" check (an overlay shows on GNOME and the capability report says what's missing) still needs a manual run of overlay-lab on GNOME Wayland. That should cover an OnDemand picker and a Regions pill, and check that a prewarmed toplevel stays off screen until its first visible frame.

Closes #20

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.

Wayland: toplevel fallback for overlays without layer-shell (GNOME)

0 participants