diff --git a/WindowServer/WSClientConnection.cpp b/WindowServer/WSClientConnection.cpp index 847e565f27..a2412fd384 100644 --- a/WindowServer/WSClientConnection.cpp +++ b/WindowServer/WSClientConnection.cpp @@ -65,6 +65,13 @@ void WSClientConnection::post_message(GUI_ServerMessage&& message) m_process->gui_events().append(move(message)); } +RetainPtr WSClientConnection::create_bitmap(const Size& size) +{ + if (!m_process) + return nullptr; + return GraphicsBitmap::create(*m_process, size); +} + void WSClientConnection::on_message(WSMessage& message) { if (message.is_client_request()) { diff --git a/WindowServer/WSClientConnection.h b/WindowServer/WSClientConnection.h index 8eda8159d6..e40e6b2090 100644 --- a/WindowServer/WSClientConnection.h +++ b/WindowServer/WSClientConnection.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -23,9 +24,7 @@ public: static WSClientConnection* ensure_for_client_id(int client_id); void post_message(GUI_ServerMessage&&); - - // FIXME: Remove. - Process* process() { return m_process.ptr(); } + RetainPtr create_bitmap(const Size&); int client_id() const { return m_client_id; } WSMenuBar* app_menubar() { return m_app_menubar.ptr(); } diff --git a/WindowServer/WSWindow.cpp b/WindowServer/WSWindow.cpp index 0992bd08eb..d09d1498e8 100644 --- a/WindowServer/WSWindow.cpp +++ b/WindowServer/WSWindow.cpp @@ -2,7 +2,6 @@ #include "WSWindowManager.h" #include "WSMessage.h" #include "WSMessageLoop.h" -#include "Process.h" #include WSWindow::WSWindow(WSMenu& menu) @@ -44,23 +43,19 @@ void WSWindow::set_rect(const Rect& rect) Rect old_rect; { WSWindowLocker locker(*this); - - Process* process = nullptr; auto* client = WSClientConnection::from_client_id(m_client_id); - if (client) - process = client->process(); - - if (!process && !m_menu) + if (!client && !m_menu) return; if (m_rect == rect) return; old_rect = m_rect; m_rect = rect; if (!m_backing || old_rect.size() != rect.size()) { - if (process) - m_backing = GraphicsBitmap::create(*process, m_rect.size()); if (m_menu) m_backing = GraphicsBitmap::create_kernel_only(m_rect.size()); + else if (client) + m_backing = client->create_bitmap(m_rect.size()); + } } WSWindowManager::the().notify_rect_changed(*this, old_rect, rect);