From c6bdc26541c4aa8d6594de0ba16a20504c44487a Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Fri, 23 May 2025 01:48:00 +0200 Subject: Clamp the winit backend's own CSD margin offset to non-negative too Same fix as the udev backend's matching content-position code: a real CSD shadow margin (dwindow.geometry().loc) is never negative, but a live Firefox window was observed reporting loc = (-10, -10) despite sync_geometry's tiled-state hint telling it to reserve no margin at all. This path (rounded_content_element, a live GLES shader rendering the client's own texture directly, not a separate pre-shifted buffer) doesn't have the udev backend's double-application bug, but it shares the same single-subtraction call and so needed the same clamp. --- crates/wayland/src/winit/render.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/wayland/src/winit/render.rs b/crates/wayland/src/winit/render.rs index f4cb7af..6f5f600 100644 --- a/crates/wayland/src/winit/render.rs +++ b/crates/wayland/src/winit/render.rs @@ -408,7 +408,14 @@ impl WaylandPlatform { // invisible shadow margin) was never subtracted, so // that margin's worth of gap showed through at this // window's top-left corner. - let content_offset = dwindow.geometry().loc; + // + // Clamped to non-negative, same as that same call site's + // own fix: a real shadow margin is never negative, but a + // live Firefox window was observed reporting + // `loc = (-10, -10)` - subtracting that raw value would + // shift content away from the border instead of into it. + let raw_offset = dwindow.geometry().loc; + let content_offset = smithay::utils::Point::::from((raw_offset.x.max(0), raw_offset.y.max(0))); let pos = (geom.x - content_offset.x, geom.y + band - content_offset.y); let rounded = rounded_corners_enabled.then_some(self.state.rounded_corners_program.as_ref()).flatten().and_then(|program| { let corners = if w.decorated { crate::rounded_corners::RoundedCorners::BOTTOM_ONLY } else { crate::rounded_corners::RoundedCorners::ALL }; -- cgit v1.2.3