srdusr
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-03-20 16:37:00 +0200
committersrdusr <[email protected]>2025-03-20 16:37:00 +0200
commit9f7744698128d7effb234eb9021b67707db3f721 (patch)
treef62968f90279e0f1a7ee8b9b414f013547ebd69b
parent22775f37f0adfff50f4750b657892fb33e1b2ec4 (diff)
downloadsrdwm-9f7744698128d7effb234eb9021b67707db3f721.tar.gz
srdwm-9f7744698128d7effb234eb9021b67707db3f721.zip
Fix border strips staying sized for a window's previous geometry
apply_geometry and restore - the Platform callbacks core's toggle_ maximize/apply_snap_zone/restore_window drive for a pure geometry change - only called sync_geometry, never redraw_decoration_buffer. The cached border-strip/titlebar bitmaps (self.border_top_decorations, self.border_bottom_decorations, self.decorations) size themselves from effective_frame, which can differ from w.geometry alone once a CSD client's own invisible shadow margin is involved (see that function's own doc comment) - but nothing here rebuilt them right when this callback changed w.geometry. The next rebuild only happened whenever this window's client next committed a frame or some other, unrelated trigger reached redraw_decoration_buffer, not reliably right away. Confirmed live: maximizing then restoring a Chrome window left its border strips sized for the maximized frame while its real content had already settled back to the smaller restored size, immediately and permanently until some later trigger happened to catch it up - a real, visible gap between content and border on the far (east/south) edges, a different bug from the half-pixel corner seam fixed separately in blend_corner_pixel. Both apply_geometry and restore now also call redraw_decoration_buffer right after sync_geometry, in both the udev and winit backends.
-rw-r--r--crates/wayland/src/udev/platform.rs21
-rw-r--r--crates/wayland/src/winit/nested_platform.rs5
2 files changed, 26 insertions, 0 deletions
diff --git a/crates/wayland/src/udev/platform.rs b/crates/wayland/src/udev/platform.rs
index 2868f15..96d5cf2 100644
--- a/crates/wayland/src/udev/platform.rs
+++ b/crates/wayland/src/udev/platform.rs
@@ -629,6 +629,25 @@ impl Platform for UdevPlatform {
fn apply_geometry(&mut self, window: srdwm_core::WindowId, _geometry: srdwm_core::Rect) -> PlatformResult<()> {
self.state.sync_geometry(window);
+ // `redraw_decoration_buffer` sizes the cached border-strip/titlebar
+ // bitmaps from `effective_frame`, which (see that function's own
+ // doc comment) can differ from `w.geometry` alone once a CSD
+ // client's own invisible shadow margin enters the picture. Without
+ // this, the bitmap stays sized from whatever it was last built at
+ // - correct right up until this specific call changes `w.geometry`
+ // (`toggle_maximize`/`apply_snap_zone`, the two core-side callers of
+ // this callback) - and the *next* rebuild only happens whenever
+ // this window's own client next commits (`protocols/compositor.rs`'s
+ // per-commit call) or something else unrelated triggers one, not
+ // reliably right away. Confirmed live: maximizing then restoring a
+ // Chrome window left its border strips sized for the *maximized*
+ // frame while its real content had already settled back to the
+ // smaller restored size, immediately and permanently until some
+ // later unrelated trigger (a fresh commit) happened to catch it up
+ // - a real, visible gap between content and border on the far
+ // edges, not the half-pixel seam `blend_corner_pixel`'s own fix
+ // addressed.
+ self.state.redraw_decoration_buffer(window);
Ok(())
}
@@ -660,6 +679,8 @@ impl Platform for UdevPlatform {
fn restore(&mut self, window: srdwm_core::WindowId) -> PlatformResult<()> {
self.state.sync_geometry(window);
+ // See `apply_geometry`'s own doc comment - same gap, same fix.
+ self.state.redraw_decoration_buffer(window);
Ok(())
}
diff --git a/crates/wayland/src/winit/nested_platform.rs b/crates/wayland/src/winit/nested_platform.rs
index 330ef91..316b1b5 100644
--- a/crates/wayland/src/winit/nested_platform.rs
+++ b/crates/wayland/src/winit/nested_platform.rs
@@ -102,6 +102,10 @@ impl Platform for WaylandPlatform {
fn apply_geometry(&mut self, window: WindowId, geometry: srdwm_core::Rect) -> PlatformResult<()> {
let _ = geometry;
self.state.sync_geometry(window);
+ // See `udev/platform.rs`'s own `apply_geometry` doc comment - same
+ // gap (the cached border/titlebar bitmap only rebuilds on a commit,
+ // focus change, or a few specific paths, not this one), same fix.
+ self.state.redraw_decoration_buffer(window);
Ok(())
}
@@ -126,6 +130,7 @@ impl Platform for WaylandPlatform {
fn restore(&mut self, window: WindowId) -> PlatformResult<()> {
self.state.sync_geometry(window);
+ self.state.redraw_decoration_buffer(window);
Ok(())
}