Skip to content

fix(wayland): share layer-shell registry and bound globals per display - #2628

Merged
Hona merged 1 commit into
devfrom
fix/wayland-shared-layer-globals
Nov 27, 2026
Merged

Hona merged 1 commit into
devfrom
fix/wayland-shared-layer-globals

Conversation

@Hona

@Hona Hona commented Nov 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Share one wl_registry and one bound proxy per singleton Wayland global (wl_compositor, zwlr_layer_shell_v1, wp_cursor_shape_manager_v1, zwp_text_input_manager_v3, xdg_activation_v1) and per requested wl_output across every layer-shell overlay on the same wl_display (crates/rune/src/platform/layer_shell/globals.rs, crates/rune/src/platform/layer_shell_machine/globals_pool.rs).
  • Retain a lightweight SharedGlobalsHandle on OverlayCore so single-overlay apps (no persistent bar) keep the shared globals alive across hide/show cycles without creating a new wl_registry or re-binding wl_compositor, while releasing all shared globals cleanly once the last holder drops (or evicting on fatal display error).
  • Keep wl_seat bound per surface (released on drop) and track shared inner-queue drains (DrainTracker) so sibling LayerSurface and PendingActivationToken queues never miss has_pending_events() after a peer drains libwayland's shared C queue.
  • Handle wl_registry.global_remove to release cached wl_output and optional manager proxies immediately when removed.

Fixes #2455

Verification

  • Ran cargo check -p rune --lib, cargo test -p rune --lib layer_shell_machine (45 passed, including 4 new cross-platform globals_pool tests), and bash scripts/file-size.sh (0 errors, 0 folder-shape issues) locally on Windows.
  • Added mock-compositor Wayland tests in crates/rune/src/platform/layer_shell/globals_tests.rs (showing_and_hiding_binds_no_global_again_with_or_without_wl_fixes, peer_surface_reports_pending_events_after_sibling_drains_shared_connection, global_remove_releases_cached_output_and_rebinds_replacement); verified Linux compilation via CI check. Live Wayland compositor hardware (such as niri) was not run locally.

@Hona
Hona merged commit f2b645f into dev Nov 27, 2026
1 of 2 checks passed
@Hona
Hona deleted the fix/wayland-shared-layer-globals branch November 27, 2026 14:52
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: every show of a layer overlay makes a wl_registry and binds wl_compositor again, and neither goes away

1 participant