Deskflow 1.25.0.83
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
WlClipboard Class Reference

Wayland clipboard implementation using wl-copy/wl-paste. More...

#include <WlClipboard.h>

Inheritance diagram for WlClipboard:
Collaboration diagram for WlClipboard:

Public Member Functions

 WlClipboard (ClipboardID id)
 WlClipboard (WlClipboard const &)=delete
 WlClipboard (WlClipboard &&)=delete
 ~WlClipboard () override
WlClipboardoperator= (WlClipboard const &)=delete
WlClipboardoperator= (WlClipboard &&)=delete
ClipboardID getID () const
 Get clipboard ID.
void startMonitoring ()
 Start monitoring clipboard changes.
void stopMonitoring ()
 Stop monitoring clipboard changes.
bool hasChanged () const
 Check if clipboard has changed.
void resetChanged ()
 Reset the changed flag and clear cache.
bool empty () override
 Empty clipboard.
void add (Format format, const std::string &data) override
 Add data.
bool open (Time time) const override
 Open clipboard.
void close () const override
 Close clipboard.
Time getTime () const override
 Get time.
bool has (Format format) const override
 Check for data.
std::string get (Format format) const override
 Get data.
Public Member Functions inherited from IClipboard
virtual ~IClipboard ()=default

Static Public Member Functions

static bool isAvailable ()
 Check if wl-clipboard tools are available.
static bool isEnabled ()
 Check if WlClipboard is enabled.
static std::string marshall (const IClipboard *clipboard)
 Marshall clipboard data.
static void unmarshall (IClipboard *clipboard, const std::string_view &data, Time time)
 Unmarshall clipboard data.
static bool copy (IClipboard *dst, const IClipboard *src)
 Copy clipboard.
static bool copy (IClipboard *dst, const IClipboard *src, Time)
 Copy clipboard.

Additional Inherited Members

Public Types inherited from IClipboard
enum class  Format { Text , HTML , Bitmap , TotalFormats }
 Clipboard formats. More...
using Time = uint32_t
 Timestamp type.

Detailed Description

Wayland clipboard implementation using wl-copy/wl-paste.

This class implements clipboard functionality for Wayland environments by using the wl-clipboard utilities (wl-copy and wl-paste).

Constructor & Destructor Documentation

◆ WlClipboard() [1/3]

WlClipboard::WlClipboard ( ClipboardID id)
explicit

◆ WlClipboard() [2/3]

WlClipboard::WlClipboard ( WlClipboard const & )
delete

◆ WlClipboard() [3/3]

WlClipboard::WlClipboard ( WlClipboard && )
delete

◆ ~WlClipboard()

WlClipboard::~WlClipboard ( )
override

Member Function Documentation

◆ add()

void WlClipboard::add ( Format ,
const std::string & data )
overridevirtual

Add data.

Add data in the given format to the clipboard. May only be called after a successful empty().

Implements IClipboard.

◆ close()

void WlClipboard::close ( ) const
overridevirtual

Close clipboard.

Close the clipboard. close() must match a preceding successful open(). This signals that the clipboard has been filled with all the necessary data or all data has been read. It does not mean the clipboard ownership should be released (if it was taken).

Implements IClipboard.

◆ empty()

bool WlClipboard::empty ( )
overridevirtual

Empty clipboard.

Take ownership of the clipboard and clear all data from it. This must be called between a successful open() and close(). Return false if the clipboard ownership could not be taken; the clipboard should not be emptied in this case.

Implements IClipboard.

◆ get()

std::string WlClipboard::get ( Format ) const
overridevirtual

Get data.

Return the data in the given format. Returns the empty string if there is no data in that format. Must be called between a successful open() and close().

Implements IClipboard.

◆ getID()

ClipboardID WlClipboard::getID ( ) const

Get clipboard ID.

◆ getTime()

IClipboard::Time WlClipboard::getTime ( ) const
overridevirtual

Get time.

Return the timestamp passed to the last successful open().

Implements IClipboard.

◆ has()

bool WlClipboard::has ( Format ) const
overridevirtual

Check for data.

Return true iff the clipboard contains data in the given format. Must be called between a successful open() and close().

Implements IClipboard.

◆ hasChanged()

bool WlClipboard::hasChanged ( ) const

Check if clipboard has changed.

◆ isAvailable()

bool WlClipboard::isAvailable ( )
static

Check if wl-clipboard tools are available.

◆ isEnabled()

bool WlClipboard::isEnabled ( )
static

Check if WlClipboard is enabled.

◆ open()

bool WlClipboard::open ( Time time) const
overridevirtual

Open clipboard.

Open the clipboard. Return true iff the clipboard could be opened. If open() returns true then the client must call close() at some later time; if it returns false then close() must not be called. time should be the current time or a time in the past when the open should effectively have taken place.

Implements IClipboard.

◆ operator=() [1/2]

WlClipboard & WlClipboard::operator= ( WlClipboard && )
delete

◆ operator=() [2/2]

WlClipboard & WlClipboard::operator= ( WlClipboard const & )
delete

◆ resetChanged()

void WlClipboard::resetChanged ( )

Reset the changed flag and clear cache.

◆ startMonitoring()

void WlClipboard::startMonitoring ( )

Start monitoring clipboard changes.

◆ stopMonitoring()

void WlClipboard::stopMonitoring ( )

Stop monitoring clipboard changes.


The documentation for this class was generated from the following files: