diff options
| author | srdusr <[email protected]> | 2025-05-23 01:48:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-05-23 01:48:00 +0200 |
| commit | c6bdc26541c4aa8d6594de0ba16a20504c44487a (patch) | |
| tree | aac0ed6c1d565b15f4e2a5e3cb52dcaef6b970a5 | |
| parent | 54195f079810410eb9456348e7e44d382d3c4d3f (diff) | |
| download | srdwm-c6bdc26541c4aa8d6594de0ba16a20504c44487a.tar.gz srdwm-c6bdc26541c4aa8d6594de0ba16a20504c44487a.zip | |
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.
| -rw-r--r-- | crates/wayland/src/winit/render.rs | 9 |
1 files changed, 8 insertions, 1 deletions
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::<i32, smithay::utils::Logical>::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 }; |