mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
WindowServer+LibGUI: Add a server-side clipboard.
On the client side, use GClipboard's data() and set_data(String) to access the global clipboard. :^)
This commit is contained in:
parent
eda0866992
commit
6820f9e14f
12 changed files with 250 additions and 2 deletions
29
WindowServer/WSClipboard.h
Normal file
29
WindowServer/WSClipboard.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <WindowServer/WSMessageReceiver.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
class WSClipboard final : public WSMessageReceiver {
|
||||
public:
|
||||
static WSClipboard& the();
|
||||
virtual ~WSClipboard() override;
|
||||
|
||||
bool has_data() const
|
||||
{
|
||||
return m_shared_buffer;
|
||||
}
|
||||
|
||||
const byte* data() const;
|
||||
int size() const;
|
||||
|
||||
void clear();
|
||||
void set_data(Retained<SharedBuffer>&&, int contents_size);
|
||||
|
||||
private:
|
||||
WSClipboard();
|
||||
virtual void on_message(WSMessage&) override;
|
||||
|
||||
RetainPtr<SharedBuffer> m_shared_buffer;
|
||||
int m_contents_size { 0 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue