Synergy client. More...
#include <CClient.h>
Inherits IClient.
Classes | |
class | CFailInfo |
Public Member Functions | |
CClient (const CString &name, const CNetworkAddress &address, ISocketFactory *socketFactory, IStreamFilterFactory *streamFilterFactory, CScreen *screen) | |
virtual void * | getEventTarget () const |
Get event target. | |
virtual bool | getClipboard (ClipboardID id, IClipboard *) const |
Get clipboard. | |
virtual void | getShape (SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const |
Get screen shape. | |
virtual void | getCursorPos (SInt32 &x, SInt32 &y) const |
Get cursor position. | |
virtual void | enter (SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) |
Enter screen. | |
virtual bool | leave () |
Leave screen. | |
virtual void | setClipboard (ClipboardID, const IClipboard *) |
Set clipboard. | |
virtual void | grabClipboard (ClipboardID) |
Grab clipboard. | |
virtual void | setClipboardDirty (ClipboardID, bool) |
Mark clipboard dirty. | |
virtual void | keyDown (KeyID, KeyModifierMask, KeyButton) |
Notify of key press. | |
virtual void | keyRepeat (KeyID, KeyModifierMask, SInt32 count, KeyButton) |
Notify of key repeat. | |
virtual void | keyUp (KeyID, KeyModifierMask, KeyButton) |
Notify of key release. | |
virtual void | mouseDown (ButtonID) |
Notify of mouse press. | |
virtual void | mouseUp (ButtonID) |
Notify of mouse release. | |
virtual void | mouseMove (SInt32 xAbs, SInt32 yAbs) |
Notify of mouse motion. | |
virtual void | mouseRelativeMove (SInt32 xRel, SInt32 yRel) |
Notify of mouse motion. | |
virtual void | mouseWheel (SInt32 xDelta, SInt32 yDelta) |
Notify of mouse wheel motion. | |
virtual void | screensaver (bool activate) |
Notify of screen saver change. | |
virtual void | resetOptions () |
Notify of options changes. | |
virtual void | setOptions (const COptionsList &options) |
Notify of options changes. | |
virtual CString | getName () const |
Get client name. | |
manipulators | |
void | connect () |
Connect to server. | |
void | disconnect (const char *msg) |
Disconnect. | |
void | handshakeComplete () |
Notify of handshake complete. | |
accessors | |
| |
bool | isConnected () const |
Test if connected. | |
bool | isConnecting () const |
Test if connecting. | |
CNetworkAddress | getServerAddress () const |
Get address of server. | |
static CEvent::Type | getConnectedEvent () |
Get connected event type. | |
static CEvent::Type | getConnectionFailedEvent () |
Get connection failed event type. | |
static CEvent::Type | getDisconnectedEvent () |
Get disconnected event type. |
Synergy client.
This class implements the top-level client algorithms for synergy.
Definition at line 34 of file CClient.h.
CClient::CClient | ( | const CString & | name, | |
const CNetworkAddress & | address, | |||
ISocketFactory * | socketFactory, | |||
IStreamFilterFactory * | streamFilterFactory, | |||
CScreen * | screen | |||
) |
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.
Definition at line 41 of file CClient.cpp.
References getEventTarget(), IScreen::getResumeEvent(), and IScreen::getSuspendEvent().
void CClient::connect | ( | ) |
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.
Definition at line 88 of file CClient.cpp.
References IDataSocket::connect(), IStreamFilterFactory::create(), ISocketFactory::create(), CNetworkAddress::getAddress(), CNetworkAddress::getHostname(), CNetworkAddress::getPort(), CNetworkAddress::resolve(), and XBase::what().
void CClient::disconnect | ( | const char * | msg | ) |
Disconnect.
Disconnects from the server with an optional error message.
Definition at line 143 of file CClient.cpp.
References getDisconnectedEvent().
void CClient::enter | ( | SInt32 | xAbs, | |
SInt32 | yAbs, | |||
UInt32 | seqNum, | |||
KeyModifierMask | mask, | |||
bool | forScreensaver | |||
) | [virtual] |
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.
Definition at line 230 of file CClient.cpp.
References CScreen::enter(), and CScreen::mouseMove().
bool CClient::getClipboard | ( | ClipboardID | id, | |
IClipboard * | ||||
) | const [virtual] |
Get clipboard.
Save the contents of the clipboard indicated by id
and return true iff successful.
Implements IClient.
Definition at line 212 of file CClient.cpp.
References CScreen::getClipboard().
CEvent::Type CClient::getConnectedEvent | ( | ) | [static] |
Get connected event type.
Returns the connected event type. This is sent when the client has successfully connected to the server.
Definition at line 185 of file CClient.cpp.
References CEvent::registerTypeOnce().
Referenced by handshakeComplete().
CEvent::Type CClient::getConnectionFailedEvent | ( | ) | [static] |
Get connection failed event type.
Returns the connection failed event type. This is sent when the server fails for some reason. The event data is a CFailInfo*.
Definition at line 192 of file CClient.cpp.
References CEvent::registerTypeOnce().
void CClient::getCursorPos | ( | SInt32 & | x, | |
SInt32 & | y | |||
) | const [virtual] |
Get cursor position.
Return the current position of the cursor in x
and y
.
Implements IClient.
Definition at line 224 of file CClient.cpp.
References CScreen::getCursorPos().
CEvent::Type CClient::getDisconnectedEvent | ( | ) | [static] |
Get disconnected event type.
Returns the disconnected event type. This is sent when the client has disconnected from the server (and only after having successfully connected).
Definition at line 199 of file CClient.cpp.
References CEvent::registerTypeOnce().
Referenced by disconnect().
void * CClient::getEventTarget | ( | ) | const [virtual] |
Get event target.
Returns the target used for events created by this object.
Implements IClient.
Definition at line 206 of file CClient.cpp.
References CScreen::getEventTarget().
Referenced by CClient().
CString CClient::getName | ( | ) | const [virtual] |
Get client name.
Return the client's name.
Implements IClient.
Definition at line 344 of file CClient.cpp.
CNetworkAddress CClient::getServerAddress | ( | ) | const |
Get address of server.
Returns the address of the server the client is connected (or wants to connect) to.
Definition at line 179 of file CClient.cpp.
Referenced by CClientTaskBarReceiver::updateStatus().
void CClient::getShape | ( | SInt32 & | x, | |
SInt32 & | y, | |||
SInt32 & | width, | |||
SInt32 & | height | |||
) | const [virtual] |
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.
Definition at line 218 of file CClient.cpp.
References CScreen::getShape().
void CClient::grabClipboard | ( | ClipboardID | ) | [virtual] |
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.
Definition at line 263 of file CClient.cpp.
References CScreen::grabClipboard().
void CClient::handshakeComplete | ( | ) |
Notify of handshake complete.
Notifies the client that the connection handshake has completed.
Definition at line 159 of file CClient.cpp.
References CScreen::enable(), and getConnectedEvent().
bool CClient::isConnected | ( | ) | const |
Test if connected.
Returns true iff the client is successfully connected to the server.
Definition at line 167 of file CClient.cpp.
Referenced by CClientTaskBarReceiver::updateStatus().
bool CClient::isConnecting | ( | ) | const |
Test if connecting.
Returns true iff the client is currently attempting to connect to the server.
Definition at line 173 of file CClient.cpp.
Referenced by CClientTaskBarReceiver::updateStatus().
void CClient::keyDown | ( | KeyID | id, | |
KeyModifierMask | , | |||
KeyButton | ||||
) | [virtual] |
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.
Definition at line 277 of file CClient.cpp.
References CScreen::keyDown().
void CClient::keyRepeat | ( | KeyID | id, | |
KeyModifierMask | , | |||
SInt32 | count, | |||
KeyButton | ||||
) | [virtual] |
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.
Definition at line 283 of file CClient.cpp.
References CScreen::keyRepeat().
void CClient::keyUp | ( | KeyID | id, | |
KeyModifierMask | , | |||
KeyButton | ||||
) | [virtual] |
Notify of key release.
Synthesize key events to generate a release of key id
. If possible match the given modifier mask.
Implements IClient.
Definition at line 290 of file CClient.cpp.
References CScreen::keyUp().
bool CClient::leave | ( | ) | [virtual] |
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.
Definition at line 238 of file CClient.cpp.
References CScreen::leave().
void CClient::mouseDown | ( | ButtonID | id | ) | [virtual] |
Notify of mouse press.
Synthesize mouse events to generate a press of mouse button id
.
Implements IClient.
Definition at line 296 of file CClient.cpp.
References CScreen::mouseDown().
void CClient::mouseMove | ( | SInt32 | xAbs, | |
SInt32 | yAbs | |||
) | [virtual] |
Notify of mouse motion.
Synthesize mouse events to generate mouse motion to the absolute screen position xAbs
,yAbs.
Implements IClient.
Definition at line 308 of file CClient.cpp.
References CScreen::mouseMove().
void CClient::mouseRelativeMove | ( | SInt32 | xRel, | |
SInt32 | yRel | |||
) | [virtual] |
Notify of mouse motion.
Synthesize mouse events to generate mouse motion by the relative amount xRel
,yRel.
Implements IClient.
Definition at line 314 of file CClient.cpp.
References CScreen::mouseRelativeMove().
void CClient::mouseUp | ( | ButtonID | id | ) | [virtual] |
Notify of mouse release.
Synthesize mouse events to generate a release of mouse button id
.
Implements IClient.
Definition at line 302 of file CClient.cpp.
References CScreen::mouseUp().
void CClient::mouseWheel | ( | SInt32 | xDelta, | |
SInt32 | yDelta | |||
) | [virtual] |
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.
Definition at line 320 of file CClient.cpp.
References CScreen::mouseWheel().
void CClient::resetOptions | ( | ) | [virtual] |
Notify of options changes.
Reset all options to their default values.
Implements IClient.
Definition at line 332 of file CClient.cpp.
References CScreen::resetOptions().
void CClient::setClipboard | ( | ClipboardID | , | |
const IClipboard * | ||||
) | [virtual] |
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.
Definition at line 255 of file CClient.cpp.
References CScreen::setClipboard().
void CClient::setClipboardDirty | ( | ClipboardID | , | |
bool | dirty | |||
) | [virtual] |
Mark clipboard dirty.
Mark the client's clipboard as dirty (out of date) or clean (up to date).
Implements IClient.
Definition at line 271 of file CClient.cpp.
void CClient::setOptions | ( | const COptionsList & | options | ) | [virtual] |
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.
Definition at line 338 of file CClient.cpp.
References CScreen::setOptions().