1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:37:35 +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

@ -6,6 +6,7 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/Format.h>
#include <AK/Forward.h>
#include <AK/Vector.h>
@ -150,6 +151,29 @@ private:
ClipboardDataType m_data_type;
};
// Used to send the clipboard's contents to the client/server.
class ClipboardMessage : public Message {
public:
ClipboardMessage(ClipboardDataType data_type, ByteBuffer const& contents)
: Message(Type::Clipboard)
, m_data_type(data_type)
, m_contents(contents)
{
}
static ErrorOr<ClipboardMessage> read_from_stream(AK::Stream& stream);
ErrorOr<void> write_to_stream(AK::Stream& stream);
ErrorOr<String> debug_description() override;
ClipboardDataType data_type() { return m_data_type; }
ByteBuffer const& contents() { return m_contents; }
private:
ClipboardDataType m_data_type;
ByteBuffer m_contents;
};
}
namespace AK {