1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:37:47 +00:00

SpiceAgent: Implement setting the user's clipboard contents for text

We also now use GUI::Clipboard for setting the clipboard contents,
instead of using a custom connection to the Clipboard server.
This commit is contained in:
Caoimhe 2023-05-13 14:20:41 +01:00 committed by Andreas Kling
parent 9c4538a9a8
commit 3b6d63f723
8 changed files with 96 additions and 124 deletions

View file

@ -7,10 +7,11 @@
#pragma once
#include "ConnectionToClipboardServer.h"
#include "Message.h"
#include "MessageHeader.h"
#include <AK/MemoryStream.h>
#include <AK/Vector.h>
#include <LibCore/File.h>
#include <LibCore/Notifier.h>
namespace SpiceAgent {
@ -26,7 +27,7 @@ public:
};
static ErrorOr<NonnullOwnPtr<SpiceAgent>> create(StringView device_path);
SpiceAgent(NonnullOwnPtr<Core::File> spice_device, ConnectionToClipboardServer& clipboard_connection, Vector<Capability> const& capabilities);
SpiceAgent(NonnullOwnPtr<Core::File> spice_device, Vector<Capability> const& capabilities);
ErrorOr<void> start();
@ -61,11 +62,13 @@ public:
private:
NonnullOwnPtr<Core::File> m_spice_device;
ConnectionToClipboardServer& m_clipboard_connection;
Vector<Capability> m_capabilities;
RefPtr<Core::Notifier> m_notifier;
// Fired when we receive clipboard data from the spice server.
ErrorOr<void> did_receive_clipboard_message(ClipboardMessage& message);
ErrorOr<void> on_message_received();
ErrorOr<ByteBuffer> read_message_buffer();
};