diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-20 17:37:28 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-20 17:38:51 +0200 |
commit | 7234900f61fdcb0f13b3555749d1590ea0b0b1d8 (patch) | |
tree | 00104d5d392be8482a26a92c5fd1e47b01b38e58 /Servers | |
parent | 7efd61fcf5b6b993cb8a142c8bf84ec7c2de16b5 (diff) | |
download | serenity-7234900f61fdcb0f13b3555749d1590ea0b0b1d8.zip |
WindowServer+LibGUI: Coalesce multiple client paints into GMultiPaintEvents.
This allows GWindow to paint up to 32 separate rects before telling the
WindowServer to flip the buffers. Quite a bit smoother. :^)
Diffstat (limited to 'Servers')
-rw-r--r-- | Servers/WindowServer/WSClientConnection.cpp | 3 | ||||
-rw-r--r-- | Servers/WindowServer/WSEvent.h | 8 | ||||
-rw-r--r-- | Servers/WindowServer/WSEventLoop.cpp | 9 |
3 files changed, 13 insertions, 7 deletions
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp index b5eef4cae8..f8f2fb13f7 100644 --- a/Servers/WindowServer/WSClientConnection.cpp +++ b/Servers/WindowServer/WSClientConnection.cpp @@ -515,7 +515,8 @@ void WSClientConnection::handle_request(const WSAPIDidFinishPaintingNotification return; } auto& window = *(*it).value; - WSWindowManager::the().invalidate(window, request.rect()); + for (auto& rect : request.rects()) + WSWindowManager::the().invalidate(window, rect); } void WSClientConnection::handle_request(const WSAPIGetWindowBackingStoreRequest& request) diff --git a/Servers/WindowServer/WSEvent.h b/Servers/WindowServer/WSEvent.h index 4ab2369dcd..c2d96f8821 100644 --- a/Servers/WindowServer/WSEvent.h +++ b/Servers/WindowServer/WSEvent.h @@ -595,19 +595,19 @@ private: class WSAPIDidFinishPaintingNotification final : public WSAPIClientRequest { public: - explicit WSAPIDidFinishPaintingNotification(int client_id, int window_id, const Rect& rect) + explicit WSAPIDidFinishPaintingNotification(int client_id, int window_id, const Vector<Rect, 32>& rects) : WSAPIClientRequest(WSEvent::APIDidFinishPaintingNotification, client_id) , m_window_id(window_id) - , m_rect(rect) + , m_rects(rects) { } int window_id() const { return m_window_id; } - Rect rect() const { return m_rect; } + const Vector<Rect, 32>& rects() const { return m_rects; } private: int m_window_id { 0 }; - Rect m_rect; + Vector<Rect, 32> m_rects; }; enum class MouseButton : byte { diff --git a/Servers/WindowServer/WSEventLoop.cpp b/Servers/WindowServer/WSEventLoop.cpp index d56a8ab839..4a5340f1c4 100644 --- a/Servers/WindowServer/WSEventLoop.cpp +++ b/Servers/WindowServer/WSEventLoop.cpp @@ -199,9 +199,14 @@ void WSEventLoop::on_receive_from_client(int client_id, const WSAPI_ClientMessag post_event(client, make<WSAPIInvalidateRectRequest>(client_id, message.window_id, rects)); break; } - case WSAPI_ClientMessage::Type::DidFinishPainting: - post_event(client, make<WSAPIDidFinishPaintingNotification>(client_id, message.window_id, message.window.rect)); + case WSAPI_ClientMessage::Type::DidFinishPainting: { + Vector<Rect, 32> rects; + ASSERT(message.rect_count <= 32); + for (int i = 0; i < message.rect_count; ++i) + rects.append(message.rects[i]); + post_event(client, make<WSAPIDidFinishPaintingNotification>(client_id, message.window_id, rects)); break; + } case WSAPI_ClientMessage::Type::GetWindowBackingStore: post_event(client, make<WSAPIGetWindowBackingStoreRequest>(client_id, message.window_id)); break; |