1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:57:35 +00:00

LibGUI+WindowServer: Coalesce paints and resizes on the client side.

Only process paint and resize events on the GUI client side if those events
have the latest up-to-date window size. This drastically reduces async
overdraw during interactive resize.
This commit is contained in:
Andreas Kling 2019-04-10 15:39:28 +02:00
parent 0ac55f2c38
commit 55811f233f
5 changed files with 50 additions and 13 deletions

View file

@ -438,10 +438,8 @@ void WSClientConnection::handle_request(const WSAPIDidFinishPaintingNotification
auto& window = *(*it).value;
if (!window.has_painted_since_last_resize()) {
if (window.last_lazy_resize_rect().size() == request.rect().size()) {
window.set_has_painted_since_last_resize(true);
WSMessageLoop::the().post_message(window, make<WSResizeEvent>(window.last_lazy_resize_rect(), window.rect()));
}
window.set_has_painted_since_last_resize(true);
WSMessageLoop::the().post_message(window, make<WSResizeEvent>(window.rect(), window.rect()));
}
WSWindowManager::the().invalidate(window, request.rect());
}

View file

@ -106,9 +106,6 @@ public:
bool has_alpha_channel() const { return m_has_alpha_channel; }
void set_has_alpha_channel(bool value) { m_has_alpha_channel = value; }
void set_last_lazy_resize_rect(const Rect& rect) { m_last_lazy_resize_rect = rect; }
Rect last_lazy_resize_rect() const { return m_last_lazy_resize_rect; }
bool has_painted_since_last_resize() const { return m_has_painted_since_last_resize; }
void set_has_painted_since_last_resize(bool b) { m_has_painted_since_last_resize = b; }
@ -150,7 +147,6 @@ private:
RetainPtr<GraphicsBitmap> m_last_backing_store;
int m_window_id { -1 };
float m_opacity { 1 };
Rect m_last_lazy_resize_rect;
Size m_size_increment;
Size m_base_size;
Retained<GraphicsBitmap> m_icon;

View file

@ -613,10 +613,6 @@ bool WSWindowManager::process_ongoing_window_resize(const WSMouseEvent& event, W
m_resize_window->set_rect(new_rect);
if (m_resize_window->has_painted_since_last_resize()) {
m_resize_window->set_has_painted_since_last_resize(false);
#ifdef RESIZE_DEBUG
dbgprintf("[WM] I'm gonna wait for %s\n", new_rect.to_string().characters());
#endif
m_resize_window->set_last_lazy_resize_rect(new_rect);
WSMessageLoop::the().post_message(*m_resize_window, make<WSResizeEvent>(old_rect, new_rect));
}
return true;