commit 1fdeebd9f7c75e650c344922eb6e764707af3a20
parent 5d32737e4f0e89ae68d3d4d85743f70c177ce5b5
Author: wh1tepearl <whp@disroot.org>
Date: Wed, 23 Sep 2026 21:33:08 +0100
borders: damage old extents to prevent leftover border artifacts
Damaging the old extents ensures the previous border is properly
cleared when border_width changes (e.g. from 10px to 4px).
Without this, the old border remains visible until another damage
occurs.
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -1596,10 +1596,14 @@ void
compositor_view_set_border_width(struct compositor_view *view,
uint32_t outwidth, uint32_t inwidth)
{
+ pixman_box32_t old_extents;
+
if (view->border.outwidth == outwidth && view->border.inwidth == inwidth) {
return;
}
+ old_extents = view->extents;
+
view->border.outwidth = outwidth;
view->border.damaged_border1 = true;
@@ -1609,6 +1613,24 @@ compositor_view_set_border_width(struct compositor_view *view,
/* XXX: Damage above surface for transparent surfaces? */
update_extents(view);
+
+ /* Damage old extents to prevent leftover border artifacts */
+ if (view->visible &&
+ (old_extents.x1 != view->extents.x1 ||
+ old_extents.y1 != view->extents.y1 ||
+ old_extents.x2 != view->extents.x2 ||
+ old_extents.y2 != view->extents.y2)) {
+ pixman_region32_t old_region, new_region;
+
+ pixman_region32_init_with_extents(&old_region, &old_extents);
+ pixman_region32_init_with_extents(&new_region, &view->extents);
+ pixman_region32_subtract(&old_region, &old_region, &new_region);
+ pixman_region32_union(&compositor.damage, &compositor.damage,
+ &old_region);
+ pixman_region32_fini(&old_region);
+ pixman_region32_fini(&new_region);
+ }
+
update(&view->base);
}