summaryrefslogtreecommitdiff
path: root/Widgets/Widget.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-12 19:39:48 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-12 19:39:48 +0200
commit6f9e0e3876a60562fdc20496767ebf17cbb89f02 (patch)
tree939943819f0ea51a9f33fe2f033114f620e2de1f /Widgets/Widget.cpp
parent74aa4d53453843280413cb3a12b274c322c0cbf7 (diff)
downloadserenity-6f9e0e3876a60562fdc20496767ebf17cbb89f02.zip
After moving a window, try to repaint a bit less.
Only repaint windows that intersect either the old or the new rect. Also only repaint those rects in the root widget.
Diffstat (limited to 'Widgets/Widget.cpp')
-rw-r--r--Widgets/Widget.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Widgets/Widget.cpp b/Widgets/Widget.cpp
index f5a66e79f1..a742ba6461 100644
--- a/Widgets/Widget.cpp
+++ b/Widgets/Widget.cpp
@@ -23,6 +23,11 @@ void Widget::setWindowRelativeRect(const Rect& rect)
update();
}
+void Widget::repaint(const Rect& rect)
+{
+ event(*make<PaintEvent>(rect));
+}
+
void Widget::event(Event& event)
{
switch (event.type()) {
@@ -94,7 +99,7 @@ void Widget::update()
if (m_hasPendingPaintEvent)
return;
m_hasPendingPaintEvent = true;
- EventLoop::main().postEvent(this, make<PaintEvent>());
+ EventLoop::main().postEvent(this, make<PaintEvent>(rect()));
}
Widget::HitTestResult Widget::hitTest(int x, int y)