From 035522591f7ce1e8c2b8f1fd07740446fc20d91b Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Wed, 19 Oct 2022 00:23:25 +0300 Subject: [PATCH] hopefully improve behavior when widgets overlap --- src/Widget.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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();