diff options
Diffstat (limited to 'Userland/Services/WindowServer')
4 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index aa1c756fa3..8975e76ccc 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -987,4 +987,10 @@ void ClientConnection::did_become_responsive() set_unresponsive(false); } +OwnPtr<Messages::WindowServer::GetScreenBitmapResponse> ClientConnection::handle(const Messages::WindowServer::GetScreenBitmap&) +{ + auto& bitmap = Compositor::the().front_bitmap_for_screenshot({}); + return make<Messages::WindowServer::GetScreenBitmapResponse>(bitmap.to_shareable_bitmap()); +} + } diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ClientConnection.h index 6ee7fe7456..51b84e7b82 100644 --- a/Userland/Services/WindowServer/ClientConnection.h +++ b/Userland/Services/WindowServer/ClientConnection.h @@ -167,6 +167,7 @@ private: virtual OwnPtr<Messages::WindowServer::GetMouseAccelerationResponse> handle(const Messages::WindowServer::GetMouseAcceleration&) override; virtual OwnPtr<Messages::WindowServer::SetScrollStepSizeResponse> handle(const Messages::WindowServer::SetScrollStepSize&) override; virtual OwnPtr<Messages::WindowServer::GetScrollStepSizeResponse> handle(const Messages::WindowServer::GetScrollStepSize&) override; + virtual OwnPtr<Messages::WindowServer::GetScreenBitmapResponse> handle(const Messages::WindowServer::GetScreenBitmap&) override; Window* window_from_id(i32 window_id); diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h index 01fb0e7b8e..01a1ac2612 100644 --- a/Userland/Services/WindowServer/Compositor.h +++ b/Userland/Services/WindowServer/Compositor.h @@ -76,6 +76,8 @@ public: void did_construct_window_manager(Badge<WindowManager>); + const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ClientConnection>) const { return *m_front_bitmap; } + private: Compositor(); void init_bitmaps(); diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index 0e1b1cb89d..c621cd5488 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -123,5 +123,7 @@ endpoint WindowServer = 2 SetScrollStepSize(u32 step_size) => () GetScrollStepSize() => (u32 step_size) + GetScreenBitmap() => (Gfx::ShareableBitmap bitmap) + Pong() =| } |