Skip to content

fix(xwayland): a prewarmed overlay stays unmapped and takes no input until its first show (#680) - #1505

Merged
Hona merged 1 commit into
devfrom
fix/680-xwayland-prewarm-overlay
Nov 23, 2026
Merged

Hona merged 1 commit into
devfrom
fix/680-xwayland-prewarm-overlay

Conversation

@Hona

@Hona Hona commented Nov 23, 2026

Copy link
Copy Markdown
Member

Fixes #680

What was wrong

On a Wayland compositor without layer-shell (GNOME), an overlay with prewarm: true and xwayland_input: true is backed by an override-redirect X11 window (crates/rune/src/platform/x11/xwayland.rs). XwaylandSurface::new mapped that window, stacked it above, set its input shape and asked for pointer events as soon as it was made. A prewarm makes the surface while the overlay is still hidden, and warm_frame then published the hit regions as its input shape. So the never-shown overlay took clicks (all of it for OverlayInput::All, its hit() regions for Regions). drain_hidden in crates/rune/src/overlay/draw.rs only drained layer surfaces, so those button events waited on the X connection and fired as presses at the first show.

What changed

  • XwaylandSurface::new creates the window unmapped, with NO_EVENT and an empty input shape.
  • A small state machine in crates/rune/src/overlay/xwayland.rs (SurfaceState, step) holds whether the surface is shown and which input it takes. While hidden, set_input records the choice and regions does nothing. Show drains queued events, applies the input mask and shape, maps the window above, and starts the socket watch.
  • show_fading calls XwaylandSurface::show (re-placing a prewarmed window first, as the window path does).
  • drain_hidden also drains a hidden XWayland surface.

Verification

  • New tests in crates/rune/src/overlay/xwayland_tests.rs cover the state machine: a new surface is hidden with no active input and no region publishing; show emits drain, input, map and watch in order; input set while hidden waits for show; a surface made without input or a waker stays click-through. With SurfaceState::new returning the old mapped-at-creation state, the tests fail.
  • cargo test -p rune -p rune-mermaid -p rune-kit --features rune-kit/markdown,rune-kit/mermaid overlay::: 65 passed.
  • cargo check -p rune -p rune-kit --tests for Linux aarch64: passes.
  • scripts/file-size.sh: no errors.
  • Not checked: a live GNOME Wayland session with XWayland. The X11 calls compile on Linux but did not run.

@Hona
Hona merged commit 816ad4c into dev Nov 23, 2026
1 check passed
@Hona
Hona deleted the fix/680-xwayland-prewarm-overlay branch November 23, 2026 05:45
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.

XWayland: a prewarmed overlay that was never shown takes clicks, and fires the ones on its hit regions as presses at its first show

1 participant