diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-23 17:53:11 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-23 17:53:11 +0200 |
commit | 24651f854c5e0bcc2ce13ed5b61f7c6e795f2160 (patch) | |
tree | f52f0f1a18933b1fc86292c8cbf37086d213568e /Userland/Libraries/LibGUI/Window.cpp | |
parent | da86f4e38414499357bce41b389adfd28a6e8fa6 (diff) | |
download | serenity-24651f854c5e0bcc2ce13ed5b61f7c6e795f2160.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 5dd3eb1ea9..5dbd41b5ea 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -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); +} + } |