Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
Client Class Reference

Deskflow client. More...

#include <Client.h>

Inheritance diagram for Client:
Collaboration diagram for Client:

Classes

class  FailInfo

Public Member Functions

 Client (IEventQueue *events, const std::string &name, const NetworkAddress &address, ISocketFactory *socketFactory, deskflow::Screen *screen, deskflow::ClientArgs const &args)
 Client (Client const &)=delete
 Client (Client &&)=delete
 ~Client () override
Clientoperator= (Client const &)=delete
Clientoperator= (Client &&)=delete
manipulators
void connect (size_t addressIndex=0)
 Connect to server.
void disconnect (const char *msg)
 Disconnect.
void refuseConnection (const char *msg)
 Refuse connection.
virtual void handshakeComplete ()
 Notify of handshake complete.
Public Member Functions inherited from IClient
Public Member Functions inherited from IScreen
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

accessors

bool isConnected () const
 Test if connected.
bool isConnecting () const
 Test if connecting.
NetworkAddress getServerAddress () const
 Get address of server.
size_t getLastResolvedAddressesCount () const
 Return last resolved adresses count.
void * getEventTarget () const final
 Get event target.
bool getClipboard (ClipboardID id, IClipboard *) const override
 Get clipboard.
void getShape (int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override
 Get screen shape.
void getCursorPos (int32_t &x, int32_t &y) const override
 Get cursor position.
void enter (int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver) override
 Enter screen.
bool leave () override
 Leave screen.
void setClipboard (ClipboardID, const IClipboard *) override
 Set clipboard.
void grabClipboard (ClipboardID) override
 Grab clipboard.
void setClipboardDirty (ClipboardID, bool) override
 Mark clipboard dirty.
void keyDown (KeyID, KeyModifierMask, KeyButton, const std::string &) override
 Notify of key press.
void keyRepeat (KeyID, KeyModifierMask, int32_t count, KeyButton, const std::string &lang) override
 Notify of key repeat.
void keyUp (KeyID, KeyModifierMask, KeyButton) override
 Notify of key release.
void mouseDown (ButtonID) override
 Notify of mouse press.
void mouseUp (ButtonID) override
 Notify of mouse release.
void mouseMove (int32_t xAbs, int32_t yAbs) override
 Notify of mouse motion.
void mouseRelativeMove (int32_t xRel, int32_t yRel) override
 Notify of mouse motion.
void mouseWheel (int32_t xDelta, int32_t yDelta) override
 Notify of mouse wheel motion.
void screensaver (bool activate) override
 Notify of screen saver change.
void resetOptions () override
 Notify of options changes.
void setOptions (const OptionsList &options) override
 Notify of options changes.
std::string getName () const override
 Get client name.

Detailed Description

Deskflow client.

This class implements the top-level client algorithms for deskflow.

Constructor & Destructor Documentation

◆ Client() [1/3]

Client::Client ( IEventQueue * events,
const std::string & name,
const NetworkAddress & address,
ISocketFactory * socketFactory,
deskflow::Screen * screen,
deskflow::ClientArgs const & args )

This client will attempt to connect to the server using name as its name and address as the server's address and factory to create the socket. screen is the local screen.

◆ Client() [2/3]

Client::Client ( Client const & )
delete

◆ Client() [3/3]

Client::Client ( Client && )
delete

◆ ~Client()

Client::~Client ( )
override

Member Function Documentation

◆ connect()

void Client::connect ( size_t addressIndex = 0)

Connect to server.

Starts an attempt to connect to the server. This is ignored if the client is trying to connect or is already connected.

◆ disconnect()

void Client::disconnect ( const char * msg)

Disconnect.

Disconnects from the server with an optional error message.

◆ enter()

void Client::enter ( int32_t xAbs,
int32_t yAbs,
uint32_t seqNum,
KeyModifierMask mask,
bool forScreensaver )
overridevirtual

Enter screen.

Enter the screen. The cursor should be warped to xAbs,yAbs. mask is the expected toggle button state and the client should update its state to match. forScreensaver is true iff the screen is being entered because the screen saver is starting. Subsequent clipboard events should report seqNum.

Implements IClient.

◆ getClipboard()

bool Client::getClipboard ( ClipboardID id,
IClipboard *  ) const
overridevirtual

Get clipboard.

Save the contents of the clipboard indicated by id and return true iff successful.

Implements IClient.

◆ getCursorPos()

void Client::getCursorPos ( int32_t & x,
int32_t & y ) const
overridevirtual

Get cursor position.

Return the current position of the cursor in x and y.

Implements IClient.

◆ getEventTarget()

void * Client::getEventTarget ( ) const
finalvirtual

Get event target.

Returns the target used for events created by this object.

Implements IClient.

◆ getLastResolvedAddressesCount()

size_t Client::getLastResolvedAddressesCount ( ) const
inline

Return last resolved adresses count.

◆ getName()

std::string Client::getName ( ) const
overridevirtual

Get client name.

Return the client's name.

Implements IClient.

◆ getServerAddress()

NetworkAddress Client::getServerAddress ( ) const

Get address of server.

Returns the address of the server the client is connected (or wants to connect) to.

◆ getShape()

void Client::getShape ( int32_t & x,
int32_t & y,
int32_t & width,
int32_t & height ) const
overridevirtual

Get screen shape.

Return the position of the upper-left corner of the screen in x and y and the size of the screen in width and height.

Implements IClient.

◆ grabClipboard()

void Client::grabClipboard ( ClipboardID )
overridevirtual

Grab clipboard.

Grab (i.e. take ownership of) the client's clipboard. Since this is called when another client takes ownership of the clipboard it implies that the client's clipboard is out of date.

Implements IClient.

◆ handshakeComplete()

void Client::handshakeComplete ( )
virtual

Notify of handshake complete.

Notifies the client that the connection handshake has completed.

◆ isConnected()

bool Client::isConnected ( ) const

Test if connected.

Returns true iff the client is successfully connected to the server.

◆ isConnecting()

bool Client::isConnecting ( ) const

Test if connecting.

Returns true iff the client is currently attempting to connect to the server.

◆ keyDown()

void Client::keyDown ( KeyID id,
KeyModifierMask ,
KeyButton ,
const std::string &  )
overridevirtual

Notify of key press.

Synthesize key events to generate a press of key id. If possible match the given modifier mask. The KeyButton identifies the physical key on the server that generated this key down. The client must ensure that a key up or key repeat that uses the same KeyButton will synthesize an up or repeat for the same client key synthesized by keyDown().

Implements IClient.

◆ keyRepeat()

void Client::keyRepeat ( KeyID id,
KeyModifierMask ,
int32_t count,
KeyButton ,
const std::string & lang )
overridevirtual

Notify of key repeat.

Synthesize key events to generate a press and release of key id count times. If possible match the given modifier mask.

Implements IClient.

◆ keyUp()

void Client::keyUp ( KeyID id,
KeyModifierMask ,
KeyButton  )
overridevirtual

Notify of key release.

Synthesize key events to generate a release of key id. If possible match the given modifier mask.

Implements IClient.

◆ leave()

bool Client::leave ( )
overridevirtual

Leave screen.

Leave the screen. Return false iff the user may not leave the client's screen (because, for example, a button is down).

Implements IClient.

◆ mouseDown()

void Client::mouseDown ( ButtonID id)
overridevirtual

Notify of mouse press.

Synthesize mouse events to generate a press of mouse button id.

Implements IClient.

◆ mouseMove()

void Client::mouseMove ( int32_t xAbs,
int32_t yAbs )
overridevirtual

Notify of mouse motion.

Synthesize mouse events to generate mouse motion to the absolute screen position xAbs,yAbs.

Implements IClient.

◆ mouseRelativeMove()

void Client::mouseRelativeMove ( int32_t xRel,
int32_t yRel )
overridevirtual

Notify of mouse motion.

Synthesize mouse events to generate mouse motion by the relative amount xRel,yRel.

Implements IClient.

◆ mouseUp()

void Client::mouseUp ( ButtonID id)
overridevirtual

Notify of mouse release.

Synthesize mouse events to generate a release of mouse button id.

Implements IClient.

◆ mouseWheel()

void Client::mouseWheel ( int32_t xDelta,
int32_t yDelta )
overridevirtual

Notify of mouse wheel motion.

Synthesize mouse events to generate mouse wheel motion of xDelta and yDelta. Deltas are positive for motion away from the user or to the right and negative for motion towards the user or to the left. Each wheel click should generate a delta of +/-120.

Implements IClient.

◆ operator=() [1/2]

Client & Client::operator= ( Client && )
delete

◆ operator=() [2/2]

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

◆ refuseConnection()

void Client::refuseConnection ( const char * msg)

Refuse connection.

Disconnects from the server with an optional error message. Unlike disconnect this function doesn't try to use other ip addresses

◆ resetOptions()

void Client::resetOptions ( )
overridevirtual

Notify of options changes.

Reset all options to their default values.

Implements IClient.

◆ screensaver()

void Client::screensaver ( bool activate)
overridevirtual

Notify of screen saver change.

Implements IClient.

◆ setClipboard()

void Client::setClipboard ( ClipboardID ,
const IClipboard *  )
overridevirtual

Set clipboard.

Update the client's clipboard. This implies that the client's clipboard is now up to date. If the client's clipboard was already known to be up to date then this may do nothing. data has marshalled clipboard data.

Implements IClient.

◆ setClipboardDirty()

void Client::setClipboardDirty ( ClipboardID ,
bool dirty )
overridevirtual

Mark clipboard dirty.

Mark the client's clipboard as dirty (out of date) or clean (up to date).

Implements IClient.

◆ setOptions()

void Client::setOptions ( const OptionsList & options)
overridevirtual

Notify of options changes.

Set options to given values. Ignore unknown options and don't modify our options that aren't given in options.

Implements IClient.


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