From c05c25de07c1c0825ae3265914668e861fdaa792 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 20 Mar 2026 20:17:07 -0700 Subject: [PATCH] winit/wayland: Allow setting size on same axis as anchors Layer shell allows anchoring to to all edges and setting a size, in which case a surface should be centered. --- winit/src/platform_specific/wayland/event_loop/state.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winit/src/platform_specific/wayland/event_loop/state.rs b/winit/src/platform_specific/wayland/event_loop/state.rs index 3c37a4a2b5..47184f3425 100644 --- a/winit/src/platform_specific/wayland/event_loop/state.rs +++ b/winit/src/platform_specific/wayland/event_loop/state.rs @@ -923,12 +923,12 @@ impl SctkState { _ = self.id_map.insert(wl_surface.id(), id.clone()); let mut size = size.unwrap_or((None, None)); if anchor.contains(Anchor::BOTTOM.union(Anchor::TOP)) { - size.1 = None; + size.1 = size.1.map(|x| x.max(1)); } else { size.1 = Some(size.1.unwrap_or(1).max(1)); } if anchor.contains(Anchor::LEFT.union(Anchor::RIGHT)) { - size.0 = None; + size.0 = size.0.map(|x| x.max(1)); } else { size.0 = Some(size.0.unwrap_or(1).max(1)); }