diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-14 01:21:32 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-14 01:21:32 +0100 |
commit | f529b845ecd5d2f023ebb56b03afe086df6c21e2 (patch) | |
tree | dfcd320d70c26e879829779b6047789655429cb0 /SharedGraphics | |
parent | ef4e9860fdb013a5caf76dbd51b071914cb1588a (diff) | |
download | serenity-f529b845ecd5d2f023ebb56b03afe086df6c21e2.zip |
WindowServer: Convert entire API to be message-based.
One big step towards userspace WindowServer. :^)
Diffstat (limited to 'SharedGraphics')
-rw-r--r-- | SharedGraphics/Painter.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/SharedGraphics/Painter.cpp b/SharedGraphics/Painter.cpp index e70348f5ea..acc51b7a95 100644 --- a/SharedGraphics/Painter.cpp +++ b/SharedGraphics/Painter.cpp @@ -7,7 +7,7 @@ #ifdef USERLAND #include <LibGUI/GWidget.h> #include <LibGUI/GWindow.h> -#include <LibC/gui.h> +#include <LibGUI/GEventLoop.h> #include <LibC/stdio.h> #include <LibC/errno.h> #include <LibC/string.h> @@ -26,15 +26,13 @@ Painter::Painter(GraphicsBitmap& bitmap) Painter::Painter(GWidget& widget) : m_font(&widget.font()) { - GUI_WindowBackingStoreInfo backing; - int rc = gui_get_window_backing_store(widget.window()->window_id(), &backing); - if (rc < 0) { - perror("gui_get_window_backing_store"); - ASSERT_NOT_REACHED(); - } - m_backing_store_id = backing.backing_store_id; + GUI_ClientMessage request; + request.type = GUI_ClientMessage::Type::GetWindowBackingStore; + request.window_id = widget.window()->window_id(); + auto response = GEventLoop::main().sync_request(request, GUI_ServerMessage::DidGetWindowBackingStore); + m_backing_store_id = response.backing.backing_store_id; - m_target = GraphicsBitmap::create_wrapper(backing.size, backing.pixels); + m_target = GraphicsBitmap::create_wrapper(response.backing.size, response.backing.pixels); ASSERT(m_target); m_window = widget.window(); m_translation.move_by(widget.window_relative_rect().location()); @@ -55,11 +53,10 @@ Painter::~Painter() #ifdef USERLAND m_target = nullptr; if (m_backing_store_id) { - int rc = gui_release_window_backing_store(m_backing_store_id); - if (rc < 0) { - perror("gui_release_window_backing_store"); - ASSERT_NOT_REACHED(); - } + GUI_ClientMessage request; + request.type = GUI_ClientMessage::Type::ReleaseWindowBackingStore; + request.backing.backing_store_id = m_backing_store_id; + GEventLoop::main().post_message_to_server(request); } #endif } |