mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibGUI: Add Widget::repaint() to force an immediate repaint
In most situations, Widget::update() is preferable, since that allows us to coalesce repaints and avoid redundant work, reducing system load. However, there are some cases where you really want a paint to happen right away, to make sure that the user has a chance to see a short-lived visual state.
This commit is contained in:
@@ -1204,4 +1204,14 @@ void Window::set_modified(bool modified)
|
||||
WindowServerConnection::the().async_set_window_modified(m_window_id, modified);
|
||||
}
|
||||
|
||||
void Window::flush_pending_paints_immediately()
|
||||
{
|
||||
if (!m_window_id)
|
||||
return;
|
||||
if (m_pending_paint_event_rects.is_empty())
|
||||
return;
|
||||
MultiPaintEvent paint_event(move(m_pending_paint_event_rects), size());
|
||||
handle_multi_paint_event(paint_event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user