mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
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.
This commit is contained in:
parent
ea6678b7b3
commit
a9e60fc800
4 changed files with 10 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue