Wayland: add WindowAttributesWayland::with_csd_fallback to opt out of client-side decoration fallback - #4724
Open
benedikt-weyer wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
On Wayland, when a window requests server-side decoration but the
compositor responds
DecorationMode::Client, winit always falls back todrawing its own client-side decoration frame (
AdwaitaFrame/FallbackFrame).Some applications draw no titlebar/CSD of their own and want the
compositor's xdg-decoration negotiation to be the sole authority over
whether the window is decorated at all — for them, the automatic CSD
fallback means an unwanted title bar appears even when the compositor
intentionally declines to decorate (e.g. a compositor exposing a
user-level toggle for its own server-side decoration).
This adds
WindowAttributesWayland::with_csd_fallback(bool), defaulting totrue(today's behavior, so this is non-breaking). Setting it tofalseskips creating the fallback frame entirely: a
Clientdecoration-moderesponse then simply means the window has no decoration, instead of
triggering winit's own drawn one.
Changes
winit-wayland/src/lib.rs: newWindowAttributesWayland::csd_fallbackfield (default
true) andwith_csd_fallbackbuilder method, alongsidethe existing
prefer_csdfield/builder.winit-wayland/src/window/{mod.rs,state.rs}: threadcsd_fallbackthrough to
WindowState, mirroring howprefer_csdis threaded today.winit-wayland/src/window/state/configure.rs: ANDself.csd_fallbackinto the existing fallback-frame-creation condition.
winit-wayland/src/popup.rs: passtruefor popups (unaffected eitherway, since popups never create this frame — kept for signature parity).
winit/src/changelog/unreleased.md: changelog entry.Test plan
cargo check -p winit-wayland --features sctk-adwaitacargo check -p winit --features x11,waylandcargo +nightly fmt -p winit-wayland -- --checkcargo +nightly fmt -- --check(whole workspace)changelogmodule if knowledge of this change could be valuable to users🤖 Generated with Claude Code