fix(astro-menu): clip card bloom so corners stop poking out of the rounded border

bordered()'s glow re-strokes the rounded ring at widths up to border+22, so half
of each stroke falls outside the ring path. GTK clips a DrawingArea to its own
square allocation: along the straight edges that trims the outward spill to
nothing, but inside each corner the square patch between the arc and the widget
corner is still in-allocation and got painted solid accent red — square corners
peeking out from behind every rounded card border.

Clip the glow passes to the ring's outer silhouette (the widget rect rounded by
radius + border/2, exactly where the crisp stroke's outer edge runs) so the
bloom only reads inward. Crisp stroke and fill are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-07-22 23:13:29 +02:00
parent 78971fd9d8
commit 042103f131
1 changed files with 13 additions and 0 deletions

View File

@ -49,11 +49,24 @@ def _make_draw(border: int, radius: int, color, fill_bg: bool, glow: bool):
inset = border / 2 inset = border / 2
r, g, b = color r, g, b = color
if glow: if glow:
# The bloom strokes are up to 24px wide, so half of each spills OUTWARD
# past the ring. GTK clips a DrawingArea to its own (square) allocation,
# which along the straight edges trims that spill to nothing but inside
# each corner leaves the whole square patch outside the arc painted —
# solid red corners poking out from behind the rounded border. Clip the
# glow to the ring's own outer silhouette (the widget rect rounded by
# radius + inset, i.e. exactly where the crisp stroke's outer edge runs)
# so the bloom only ever reads inward and the card keeps a clean rounded
# outline.
cr.save()
_rounded_rect(cr, 0, 0, w, h, radius + inset)
cr.clip()
for extra_w, alpha in _GLOW_LAYERS: for extra_w, alpha in _GLOW_LAYERS:
_rounded_rect(cr, inset, inset, w - border, h - border, radius) _rounded_rect(cr, inset, inset, w - border, h - border, radius)
cr.set_source_rgba(r, g, b, alpha) cr.set_source_rgba(r, g, b, alpha)
cr.set_line_width(border + extra_w) cr.set_line_width(border + extra_w)
cr.stroke() cr.stroke()
cr.restore()
_rounded_rect(cr, inset, inset, w - border, h - border, radius) _rounded_rect(cr, inset, inset, w - border, h - border, radius)
if fill_bg: if fill_bg:
cr.set_source_rgba(*FILL_COLOR, FILL_ALPHA) cr.set_source_rgba(*FILL_COLOR, FILL_ALPHA)