From ab0dad5ea2a764d4a13c960d24efa7a2e69b931a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 16 Jan 2021 10:06:27 +0100 Subject: WindowServer+LibGUI: Pass drag&drop bitmaps via Gfx::ShareableBitmap This makes them backed by anonymous files instead of shbufs and also simplifies the code significantly on both client and server side. --- Userland/Libraries/LibGUI/DragOperation.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'Userland/Libraries') diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp index 060f25fc62..74c9eddd7e 100644 --- a/Userland/Libraries/LibGUI/DragOperation.cpp +++ b/Userland/Libraries/LibGUI/DragOperation.cpp @@ -51,22 +51,17 @@ DragOperation::Outcome DragOperation::exec() ASSERT(!m_event_loop); ASSERT(m_mime_data); - int bitmap_id = -1; - Gfx::IntSize bitmap_size; - RefPtr shared_bitmap; + Gfx::ShareableBitmap drag_bitmap; if (m_mime_data->has_format("image/x-raw-bitmap")) { auto data = m_mime_data->data("image/x-raw-bitmap"); auto bitmap = Gfx::Bitmap::create_from_serialized_byte_buffer(move(data)); - shared_bitmap = bitmap->to_bitmap_backed_by_shared_buffer(); - shared_bitmap->shared_buffer()->share_with(WindowServerConnection::the().server_pid()); - bitmap_id = shared_bitmap->shbuf_id(); - bitmap_size = shared_bitmap->size(); + drag_bitmap = bitmap->to_shareable_bitmap(); } auto response = WindowServerConnection::the().send_sync( m_mime_data->text(), m_mime_data->all_data(), - bitmap_id, bitmap_size); + drag_bitmap); if (!response->started()) { m_outcome = Outcome::Cancelled; -- cgit v1.2.3