hopefully improve behavior when widgets overlap

This commit is contained in:
hippoz 2022-10-19 00:23:25 +03:00
parent 854e7d1d74
commit 035522591f
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -149,6 +149,11 @@ void Widget::handle_repaint_rect(RepaintRectEvent &event) {
cr->save(); 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 // 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()); painter.rounded_rectangle(m_rect, m_style->border_radius());
cr->clip(); cr->clip();