commit 1fdeebd

wh1tepearl  ·  2026-09-23 20:33:08 +0000 UTC
parent 5d32737
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.
1 files changed,  +22, -0
+22, -0
 1@@ -1596,10 +1596,14 @@ void
 2 compositor_view_set_border_width(struct compositor_view *view,
 3                                  uint32_t outwidth, uint32_t inwidth)
 4 {
 5+	pixman_box32_t old_extents;
 6+
 7 	if (view->border.outwidth == outwidth && view->border.inwidth == inwidth) {
 8 		return;
 9 	}
10 
11+	old_extents = view->extents;
12+
13 	view->border.outwidth = outwidth;
14 	view->border.damaged_border1 = true;
15 
16@@ -1609,6 +1613,24 @@ compositor_view_set_border_width(struct compositor_view *view,
17 	/* XXX: Damage above surface for transparent surfaces? */
18 
19 	update_extents(view);
20+
21+	/* Damage old extents to prevent leftover border artifacts */
22+	if (view->visible &&
23+	    (old_extents.x1 != view->extents.x1 ||
24+	     old_extents.y1 != view->extents.y1 ||
25+	     old_extents.x2 != view->extents.x2 ||
26+	     old_extents.y2 != view->extents.y2)) {
27+		pixman_region32_t old_region, new_region;
28+
29+		pixman_region32_init_with_extents(&old_region, &old_extents);
30+		pixman_region32_init_with_extents(&new_region, &view->extents);
31+		pixman_region32_subtract(&old_region, &old_region, &new_region);
32+		pixman_region32_union(&compositor.damage, &compositor.damage,
33+		                      &old_region);
34+		pixman_region32_fini(&old_region);
35+		pixman_region32_fini(&new_region);
36+	}
37+
38 	update(&view->base);
39 }
40