diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-16 10:06:27 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-16 11:26:53 +0100 |
commit | ab0dad5ea2a764d4a13c960d24efa7a2e69b931a (patch) | |
tree | 9020a03b351d787e20f14e0a4ac15a5e75d60f3c /Userland/Libraries | |
parent | 60e580fa3e42785a2bf2485cf85bd8ff8ba8c361 (diff) | |
download | serenity-ab0dad5ea2a764d4a13c960d24efa7a2e69b931a.zip |
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGUI/DragOperation.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
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<Gfx::Bitmap> 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<Messages::WindowServer::StartDrag>( m_mime_data->text(), m_mime_data->all_data(), - bitmap_id, bitmap_size); + drag_bitmap); if (!response->started()) { m_outcome = Outcome::Cancelled; |