diff options
| author | srdusr <[email protected]> | 2025-02-04 23:21:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-02-04 23:21:00 +0200 |
| commit | 31942ff440c6039b943b4975714dca25372f80c5 (patch) | |
| tree | 420fa5be87eb03fd3b898f3c86402380be3514cf /crates/wayland/src/state | |
| parent | dae1617a8b7ee7c40beb452046c5ec84e69931ee (diff) | |
| download | srdwm-31942ff440c6039b943b4975714dca25372f80c5.tar.gz srdwm-31942ff440c6039b943b4975714dca25372f80c5.zip | |
Fix CSD windows rendering with a wallpaper-visible gap at their corner
srdwm never read xdg_surface.set_window_geometry anywhere. A CSD
client (GTK4/Firefox) declares its real visible content as a sub-rect
inset within a larger buffer that also reserves an invisible shadow
margin - that margin stays reserved in the buffer even once the
tiled-state hint tells the client to stop drawing the shadow itself.
Every render path was positioning content at the client's raw buffer
origin instead of subtracting that declared offset, leaving the
margin's width/height as a gap with wallpaper visible through it at
the window's top-left corner. Confirmed by pixel-diffing the gap
against the real wallpaper at that exact screen position: an exact
match, ruling out "just the client's own dark theme."
Fixed in three places that have to move together: udev/render.rs and
winit/render.rs's content-positioning code, and sync_geometry's
space.map_element call. That last one matters as much as the other
two - it's what smithay's Space (and therefore click hit-testing)
reads, so a render-only fix would have traded a visible gap for an
invisible, same-size hit-test offset in the other direction. Also
applied to the new capture-workspace off-screen render for the same
reason.
This likely also explains real dropdown/context-menu misplacement (and
the clicks landing on the wrong spot) in CSD apps: popup positioning
anchors against the same window position this fix corrects.
Diffstat (limited to 'crates/wayland/src/state')
| -rw-r--r-- | crates/wayland/src/state/geometry.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/crates/wayland/src/state/geometry.rs b/crates/wayland/src/state/geometry.rs index a0d10fa..21cac8d 100644 --- a/crates/wayland/src/state/geometry.rs +++ b/crates/wayland/src/state/geometry.rs @@ -55,7 +55,24 @@ impl CompState { let size_changed = self.last_synced_size.insert(id, size) != Some(size); let mut moved = false; if let Some(w) = self.id_to_window.get(&id) { - self.space.map_element(w.clone(), (geom.x, geom.y + band), false); + // `w.geometry().loc` is the client's own `xdg_surface:: + // set_window_geometry` offset - a CSD client (GTK4/Firefox + // concretely) declares its real visible content as a sub-rect + // inset within a larger buffer that also reserves an invisible + // shadow margin, even once the tiled-state hint below has told + // it to skip drawing that shadow. `render_udev_frame`/ + // `winit/render.rs` both subtract this same offset from where + // they draw the window's content, specifically so the client's + // visible content lands at `geom.x, geom.y` instead of a + // shadow-margin's width/height short of it - `space` has to + // agree with that adjustment, not just rendering, or every + // click computed via `win_relative = pos - space_loc` would + // land `content_offset` short of whatever the user actually + // clicked on: rendering moves the content, hit-testing keeps + // routing against where the client's raw, unshifted buffer + // origin used to be. + let content_offset = w.geometry().loc; + self.space.map_element(w.clone(), (geom.x - content_offset.x, geom.y + band - content_offset.y), false); moved = true; if let Some(top) = w.toplevel() { // xdg-shell position is a purely compositor-side concept -- |