Repository navigation
fix(xwayland): a prewarmed overlay stays unmapped and takes no input until its first show (#680) - #1505
Merged
Conversation
…until its first show (#680)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #680
What was wrong
On a Wayland compositor without layer-shell (GNOME), an overlay with
prewarm: trueandxwayland_input: trueis backed by an override-redirect X11 window (crates/rune/src/platform/x11/xwayland.rs).XwaylandSurface::newmapped 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, andwarm_framethen published the hit regions as its input shape. So the never-shown overlay took clicks (all of it forOverlayInput::All, itshit()regions forRegions).drain_hiddenincrates/rune/src/overlay/draw.rsonly drained layer surfaces, so those button events waited on the X connection and fired as presses at the first show.What changed
XwaylandSurface::newcreates the window unmapped, withNO_EVENTand an empty input shape.crates/rune/src/overlay/xwayland.rs(SurfaceState,step) holds whether the surface is shown and which input it takes. While hidden,set_inputrecords the choice andregionsdoes nothing.Showdrains queued events, applies the input mask and shape, maps the window above, and starts the socket watch.show_fadingcallsXwaylandSurface::show(re-placing a prewarmed window first, as the window path does).drain_hiddenalso drains a hidden XWayland surface.Verification
crates/rune/src/overlay/xwayland_tests.rscover 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. WithSurfaceState::newreturning 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 --testsfor Linux aarch64: passes.scripts/file-size.sh: no errors.