summaryrefslogtreecommitdiff
path: root/LibGUI/GWindow.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-20 07:56:48 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-20 07:59:19 +0100
commita9e60fc80068af8ee3ef293d1287ab71f98197f2 (patch)
tree275ea475f8c74021838a5d300060e451c6580607 /LibGUI/GWindow.cpp
parentea6678b7b321295024a34167c32b4b801f57311d (diff)
downloadserenity-a9e60fc80068af8ee3ef293d1287ab71f98197f2.zip
LibGUI: Only redraw the dirty rect in GWidget.
There is some trouble here with the asynchronous nature of WindowServer and the single per-window backing store we're drawing into. If we start repainting a widget with a pending invalidation, that invalidation might get flushed by the WindowServer mid-paint.
Diffstat (limited to 'LibGUI/GWindow.cpp')
-rw-r--r--LibGUI/GWindow.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index 93d2dd9c54..53899e45ec 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -102,12 +102,12 @@ void GWindow::event(GEvent& event)
if (!m_main_widget)
return;
auto& paint_event = static_cast<GPaintEvent&>(event);
- if (paint_event.rect().is_empty()) {
- m_main_widget->paintEvent(*make<GPaintEvent>(m_main_widget->rect()));
- } else {
- m_main_widget->event(event);
- }
- int rc = gui_invalidate_window(m_window_id, nullptr);
+ auto rect = paint_event.rect();
+ if (rect.is_empty())
+ rect = m_main_widget->rect();
+ m_main_widget->event(*make<GPaintEvent>(rect));
+ GUI_Rect gui_rect = rect;
+ int rc = gui_invalidate_window(m_window_id, &gui_rect);
ASSERT(rc == 0);
}