diff --git a/src/Widget.cpp b/src/Widget.cpp index 1a02d5c..27fc3e7 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -149,6 +149,11 @@ void Widget::handle_repaint_rect(RepaintRectEvent &event) { cr->save(); + // clip to the event's invalidation rectangle. this is because widgets tend to also draw things like text, + // which sometimes goes outside the invalidation rectangle + painter.rounded_rectangle(event.box(), 0); + cr->clip(); + // clip this widget. this ensures that the background fill or children won't overflow the bounds of it painter.rounded_rectangle(m_rect, m_style->border_radius()); cr->clip();