Skip to content

Wayland: add WindowAttributesWayland::with_csd_fallback to opt out of client-side decoration fallback - #4724

Open
benedikt-weyer wants to merge 1 commit into
rust-windowing:masterfrom
benedikt-weyer:wayland-opt-out-csd-fallback
Open

benedikt-weyer wants to merge 1 commit into
rust-windowing:masterfrom
benedikt-weyer:wayland-opt-out-csd-fallback

Conversation

@benedikt-weyer

Copy link
Copy Markdown

Summary

On Wayland, when a window requests server-side decoration but the
compositor responds DecorationMode::Client, winit always falls back to
drawing 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 to
true (today's behavior, so this is non-breaking). Setting it to false
skips creating the fallback frame entirely: a Client decoration-mode
response then simply means the window has no decoration, instead of
triggering winit's own drawn one.

Changes

  • winit-wayland/src/lib.rs: new WindowAttributesWayland::csd_fallback
    field (default true) and with_csd_fallback builder method, alongside
    the existing prefer_csd field/builder.
  • winit-wayland/src/window/{mod.rs,state.rs}: thread csd_fallback
    through to WindowState, mirroring how prefer_csd is threaded today.
  • winit-wayland/src/window/state/configure.rs: AND self.csd_fallback
    into the existing fallback-frame-creation condition.
  • winit-wayland/src/popup.rs: pass true for popups (unaffected either
    way, 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-adwaita
  • cargo check -p winit --features x11,wayland
  • cargo +nightly fmt -p winit-wayland -- --check
  • cargo +nightly fmt -- --check (whole workspace)

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant