Skip to content

fix(wayland): distinguish unplugged output from layer surface close and skip gone displays - #2632

Merged
Hona merged 1 commit into
devfrom
fix/wayland-unplugged-output-overlay
Nov 27, 2026
Merged

Hona merged 1 commit into
devfrom
fix/wayland-unplugged-output-overlay

Conversation

@Hona

@Hona Hona commented Nov 27, 2026

Copy link
Copy Markdown
Member

Fixes #2453.

Summary

  • Distinguish an unplugged Wayland output from a compositor surface close:
    • readiness::State now moves to Closing and emits Effect::SendCloseSync when zwlr_layer_surface_v1.closed arrives, sending a wl_display.sync roundtrip on the layer surface's queue.
    • LayerSurface tracks its output global name via layer_shell_machine::output::SurfaceOutput (pinned when created with an explicit output_id, or following wl_surface.enter / wl_surface.leave via SharedGlobals::bind_all_outputs + OutputGlobal user data when created without an output—remembering the output it is on now or left last).
    • If the surface's wl_output global disappears (wl_registry.global_remove) before the sync's wl_callback.done—or without closed ever arriving—readiness ends with CloseKind::OutputGone; otherwise wl_callback.done ends it with CloseKind::Closed.
    • OverlayCore::layer_output_gone hides and drops the layer surface without marking the overlay Unavailable, recording OverlayHandle::failure, or firing on_availability. Plain compositor closes and display connection errors continue to fail as before.
  • Prevent a show() aimed at a gone display from landing on another output:
    • resolve_wayland_output returns WaylandOutputTarget::Gone when DisplayTarget::Id or DisplayTarget::Native(NativeDisplayId::Wayland(_)) is no longer connected, and LayerSurface::new returns Err(NewError::OutputGone) if the requested wl_output is absent from SharedGlobals or removed during initial configure wait.
    • OverlayCore::prepare stops on LayerOutcome::OutputGone without falling back to an unbound output, XWayland, or toplevel, and reports no failure.

Verification

  • Verified locally on Windows (cargo check -p rune, cargo test -p rune --lib layer_shell_machine — 49 passed, cargo test -p rune --lib overlay:: — 191 passed).
  • Added Linux mock-compositor socket-pair tests in crates/rune/src/platform/layer_shell/output_tests.rs covering post-close sync, global_remove before/after closed, global_remove without closed, wl_surface.enter/leave output tracking, gone-output LayerSurface::new, and drop cleanup while closing.
  • Linux CI checks compilation of the Wayland code; live Wayland compositor hardware (Hyprland / niri) was not run locally.

@Hona
Hona force-pushed the fix/wayland-unplugged-output-overlay branch from 460bba2 to 52ad42e Compare November 27, 2026 15:14
@Hona
Hona merged commit d11d23d into dev Nov 27, 2026
2 checks passed
@Hona
Hona deleted the fix/wayland-unplugged-output-overlay branch November 27, 2026 15:15
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: an unplugged output reads as a failed layer surface, and a re-show lands on another output

1 participant