mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-04 19:06:45 +08:00
dropped "c" prefix from class names
This commit is contained in:
@@ -19,10 +19,10 @@
|
||||
#include "server/BaseClientProxy.h"
|
||||
|
||||
//
|
||||
// CBaseClientProxy
|
||||
// BaseClientProxy
|
||||
//
|
||||
|
||||
CBaseClientProxy::CBaseClientProxy(const CString& name) :
|
||||
BaseClientProxy::BaseClientProxy(const String& name) :
|
||||
m_name(name),
|
||||
m_x(0),
|
||||
m_y(0)
|
||||
@@ -30,27 +30,27 @@ CBaseClientProxy::CBaseClientProxy(const CString& name) :
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CBaseClientProxy::~CBaseClientProxy()
|
||||
BaseClientProxy::~BaseClientProxy()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CBaseClientProxy::setJumpCursorPos(SInt32 x, SInt32 y)
|
||||
BaseClientProxy::setJumpCursorPos(SInt32 x, SInt32 y)
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
}
|
||||
|
||||
void
|
||||
CBaseClientProxy::getJumpCursorPos(SInt32& x, SInt32& y) const
|
||||
BaseClientProxy::getJumpCursorPos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
x = m_x;
|
||||
y = m_y;
|
||||
}
|
||||
|
||||
CString
|
||||
CBaseClientProxy::getName() const
|
||||
String
|
||||
BaseClientProxy::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
#include "base/String.h"
|
||||
|
||||
//! Generic proxy for client or primary
|
||||
class CBaseClientProxy : public IClient {
|
||||
class BaseClientProxy : public IClient {
|
||||
public:
|
||||
/*!
|
||||
\c name is the name of the client.
|
||||
*/
|
||||
CBaseClientProxy(const CString& name);
|
||||
~CBaseClientProxy();
|
||||
BaseClientProxy(const String& name);
|
||||
~BaseClientProxy();
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
@@ -77,13 +77,13 @@ public:
|
||||
virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta) = 0;
|
||||
virtual void screensaver(bool activate) = 0;
|
||||
virtual void resetOptions() = 0;
|
||||
virtual void setOptions(const COptionsList& options) = 0;
|
||||
virtual void setOptions(const OptionsList& options) = 0;
|
||||
virtual void sendDragInfo(UInt32 fileCount, const char* info,
|
||||
size_t size) = 0;
|
||||
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize) = 0;
|
||||
virtual CString getName() const;
|
||||
virtual String getName() const;
|
||||
|
||||
private:
|
||||
CString m_name;
|
||||
String m_name;
|
||||
SInt32 m_x, m_y;
|
||||
};
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
#include "base/TMethodEventJob.h"
|
||||
|
||||
//
|
||||
// CClientListener
|
||||
// ClientListener
|
||||
//
|
||||
|
||||
CClientListener::CClientListener(const CNetworkAddress& address,
|
||||
ClientListener::ClientListener(const NetworkAddress& address,
|
||||
ISocketFactory* socketFactory,
|
||||
IStreamFilterFactory* streamFilterFactory,
|
||||
const CCryptoOptions& crypto,
|
||||
const CryptoOptions& crypto,
|
||||
IEventQueue* events) :
|
||||
m_socketFactory(socketFactory),
|
||||
m_streamFilterFactory(streamFilterFactory),
|
||||
@@ -73,29 +73,29 @@ CClientListener::CClientListener(const CNetworkAddress& address,
|
||||
|
||||
// setup event handler
|
||||
m_events->adoptHandler(m_events->forIListenSocket().connecting(), m_listen,
|
||||
new TMethodEventJob<CClientListener>(this,
|
||||
&CClientListener::handleClientConnecting));
|
||||
new TMethodEventJob<ClientListener>(this,
|
||||
&ClientListener::handleClientConnecting));
|
||||
}
|
||||
|
||||
CClientListener::~CClientListener()
|
||||
ClientListener::~ClientListener()
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "stop listening for clients"));
|
||||
|
||||
// discard already connected clients
|
||||
for (CNewClients::iterator index = m_newClients.begin();
|
||||
for (NewClients::iterator index = m_newClients.begin();
|
||||
index != m_newClients.end(); ++index) {
|
||||
CClientProxyUnknown* client = *index;
|
||||
ClientProxyUnknown* client = *index;
|
||||
m_events->removeHandler(
|
||||
m_events->forCClientProxyUnknown().success(), client);
|
||||
m_events->forClientProxyUnknown().success(), client);
|
||||
m_events->removeHandler(
|
||||
m_events->forCClientProxyUnknown().failure(), client);
|
||||
m_events->forClientProxyUnknown().failure(), client);
|
||||
m_events->removeHandler(
|
||||
m_events->forCClientProxy().disconnected(), client);
|
||||
m_events->forClientProxy().disconnected(), client);
|
||||
delete client;
|
||||
}
|
||||
|
||||
// discard waiting clients
|
||||
CClientProxy* client = getNextClient();
|
||||
ClientProxy* client = getNextClient();
|
||||
while (client != NULL) {
|
||||
delete client;
|
||||
client = getNextClient();
|
||||
@@ -108,26 +108,26 @@ CClientListener::~CClientListener()
|
||||
}
|
||||
|
||||
void
|
||||
CClientListener::setServer(CServer* server)
|
||||
ClientListener::setServer(Server* server)
|
||||
{
|
||||
assert(server != NULL);
|
||||
m_server = server;
|
||||
}
|
||||
|
||||
CClientProxy*
|
||||
CClientListener::getNextClient()
|
||||
ClientProxy*
|
||||
ClientListener::getNextClient()
|
||||
{
|
||||
CClientProxy* client = NULL;
|
||||
ClientProxy* client = NULL;
|
||||
if (!m_waitingClients.empty()) {
|
||||
client = m_waitingClients.front();
|
||||
m_waitingClients.pop_front();
|
||||
m_events->removeHandler(m_events->forCClientProxy().disconnected(), client);
|
||||
m_events->removeHandler(m_events->forClientProxy().disconnected(), client);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
void
|
||||
CClientListener::handleClientConnecting(const CEvent&, void*)
|
||||
ClientListener::handleClientConnecting(const Event&, void*)
|
||||
{
|
||||
// accept client connection
|
||||
synergy::IStream* stream = m_listen->accept();
|
||||
@@ -140,10 +140,10 @@ CClientListener::handleClientConnecting(const CEvent&, void*)
|
||||
if (m_streamFilterFactory != NULL) {
|
||||
stream = m_streamFilterFactory->create(stream, true);
|
||||
}
|
||||
stream = new CPacketStreamFilter(m_events, stream, true);
|
||||
stream = new PacketStreamFilter(m_events, stream, true);
|
||||
|
||||
if (m_crypto.m_mode != kDisabled) {
|
||||
CCryptoStream* cryptoStream = new CCryptoStream(
|
||||
CryptoStream* cryptoStream = new CryptoStream(
|
||||
m_events, stream, m_crypto, true);
|
||||
stream = cryptoStream;
|
||||
}
|
||||
@@ -151,59 +151,59 @@ CClientListener::handleClientConnecting(const CEvent&, void*)
|
||||
assert(m_server != NULL);
|
||||
|
||||
// create proxy for unknown client
|
||||
CClientProxyUnknown* client = new CClientProxyUnknown(stream, 30.0, m_server, m_events);
|
||||
ClientProxyUnknown* client = new ClientProxyUnknown(stream, 30.0, m_server, m_events);
|
||||
m_newClients.insert(client);
|
||||
|
||||
// watch for events from unknown client
|
||||
m_events->adoptHandler(m_events->forCClientProxyUnknown().success(), client,
|
||||
new TMethodEventJob<CClientListener>(this,
|
||||
&CClientListener::handleUnknownClient, client));
|
||||
m_events->adoptHandler(m_events->forCClientProxyUnknown().failure(), client,
|
||||
new TMethodEventJob<CClientListener>(this,
|
||||
&CClientListener::handleUnknownClient, client));
|
||||
m_events->adoptHandler(m_events->forClientProxyUnknown().success(), client,
|
||||
new TMethodEventJob<ClientListener>(this,
|
||||
&ClientListener::handleUnknownClient, client));
|
||||
m_events->adoptHandler(m_events->forClientProxyUnknown().failure(), client,
|
||||
new TMethodEventJob<ClientListener>(this,
|
||||
&ClientListener::handleUnknownClient, client));
|
||||
}
|
||||
|
||||
void
|
||||
CClientListener::handleUnknownClient(const CEvent&, void* vclient)
|
||||
ClientListener::handleUnknownClient(const Event&, void* vclient)
|
||||
{
|
||||
CClientProxyUnknown* unknownClient =
|
||||
reinterpret_cast<CClientProxyUnknown*>(vclient);
|
||||
ClientProxyUnknown* unknownClient =
|
||||
reinterpret_cast<ClientProxyUnknown*>(vclient);
|
||||
|
||||
// we should have the client in our new client list
|
||||
assert(m_newClients.count(unknownClient) == 1);
|
||||
|
||||
// get the real client proxy and install it
|
||||
CClientProxy* client = unknownClient->orphanClientProxy();
|
||||
ClientProxy* client = unknownClient->orphanClientProxy();
|
||||
if (client != NULL) {
|
||||
// handshake was successful
|
||||
m_waitingClients.push_back(client);
|
||||
m_events->addEvent(CEvent(m_events->forCClientListener().connected(), this));
|
||||
m_events->addEvent(Event(m_events->forClientListener().connected(), this));
|
||||
|
||||
// watch for client to disconnect while it's in our queue
|
||||
m_events->adoptHandler(m_events->forCClientProxy().disconnected(), client,
|
||||
new TMethodEventJob<CClientListener>(this,
|
||||
&CClientListener::handleClientDisconnected,
|
||||
m_events->adoptHandler(m_events->forClientProxy().disconnected(), client,
|
||||
new TMethodEventJob<ClientListener>(this,
|
||||
&ClientListener::handleClientDisconnected,
|
||||
client));
|
||||
}
|
||||
|
||||
// now finished with unknown client
|
||||
m_events->removeHandler(m_events->forCClientProxyUnknown().success(), client);
|
||||
m_events->removeHandler(m_events->forCClientProxyUnknown().failure(), client);
|
||||
m_events->removeHandler(m_events->forClientProxyUnknown().success(), client);
|
||||
m_events->removeHandler(m_events->forClientProxyUnknown().failure(), client);
|
||||
m_newClients.erase(unknownClient);
|
||||
delete unknownClient;
|
||||
}
|
||||
|
||||
void
|
||||
CClientListener::handleClientDisconnected(const CEvent&, void* vclient)
|
||||
ClientListener::handleClientDisconnected(const Event&, void* vclient)
|
||||
{
|
||||
CClientProxy* client = reinterpret_cast<CClientProxy*>(vclient);
|
||||
ClientProxy* client = reinterpret_cast<ClientProxy*>(vclient);
|
||||
|
||||
// find client in waiting clients queue
|
||||
for (CWaitingClients::iterator i = m_waitingClients.begin(),
|
||||
for (WaitingClients::iterator i = m_waitingClients.begin(),
|
||||
n = m_waitingClients.end(); i != n; ++i) {
|
||||
if (*i == client) {
|
||||
m_waitingClients.erase(i);
|
||||
m_events->removeHandler(m_events->forCClientProxy().disconnected(),
|
||||
m_events->removeHandler(m_events->forClientProxy().disconnected(),
|
||||
client);
|
||||
delete client;
|
||||
break;
|
||||
|
||||
@@ -25,29 +25,29 @@
|
||||
#include "common/stddeque.h"
|
||||
#include "common/stdset.h"
|
||||
|
||||
class CClientProxy;
|
||||
class CClientProxyUnknown;
|
||||
class CNetworkAddress;
|
||||
class ClientProxy;
|
||||
class ClientProxyUnknown;
|
||||
class NetworkAddress;
|
||||
class IListenSocket;
|
||||
class ISocketFactory;
|
||||
class IStreamFilterFactory;
|
||||
class CServer;
|
||||
class Server;
|
||||
class IEventQueue;
|
||||
|
||||
class CClientListener {
|
||||
class ClientListener {
|
||||
public:
|
||||
// The factories are adopted.
|
||||
CClientListener(const CNetworkAddress&,
|
||||
ClientListener(const NetworkAddress&,
|
||||
ISocketFactory*,
|
||||
IStreamFilterFactory*,
|
||||
const CCryptoOptions& crypto,
|
||||
const CryptoOptions& crypto,
|
||||
IEventQueue* events);
|
||||
~CClientListener();
|
||||
~ClientListener();
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
|
||||
void setServer(CServer* server);
|
||||
void setServer(Server* server);
|
||||
|
||||
//@}
|
||||
|
||||
@@ -60,29 +60,29 @@ public:
|
||||
list. The client is responsible for deleting the returned client.
|
||||
Returns NULL if no clients are available.
|
||||
*/
|
||||
CClientProxy* getNextClient();
|
||||
ClientProxy* getNextClient();
|
||||
|
||||
//! Get server which owns this listener
|
||||
CServer* getServer() { return m_server; }
|
||||
Server* getServer() { return m_server; }
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
// client connection event handlers
|
||||
void handleClientConnecting(const CEvent&, void*);
|
||||
void handleUnknownClient(const CEvent&, void*);
|
||||
void handleClientDisconnected(const CEvent&, void*);
|
||||
void handleClientConnecting(const Event&, void*);
|
||||
void handleUnknownClient(const Event&, void*);
|
||||
void handleClientDisconnected(const Event&, void*);
|
||||
|
||||
private:
|
||||
typedef std::set<CClientProxyUnknown*> CNewClients;
|
||||
typedef std::deque<CClientProxy*> CWaitingClients;
|
||||
typedef std::set<ClientProxyUnknown*> NewClients;
|
||||
typedef std::deque<ClientProxy*> WaitingClients;
|
||||
|
||||
IListenSocket* m_listen;
|
||||
ISocketFactory* m_socketFactory;
|
||||
IStreamFilterFactory* m_streamFilterFactory;
|
||||
CNewClients m_newClients;
|
||||
CWaitingClients m_waitingClients;
|
||||
CServer* m_server;
|
||||
CCryptoOptions m_crypto;
|
||||
NewClients m_newClients;
|
||||
WaitingClients m_waitingClients;
|
||||
Server* m_server;
|
||||
CryptoOptions m_crypto;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
@@ -24,38 +24,38 @@
|
||||
#include "base/EventQueue.h"
|
||||
|
||||
//
|
||||
// CClientProxy
|
||||
// ClientProxy
|
||||
//
|
||||
|
||||
CClientProxy::CClientProxy(const CString& name, synergy::IStream* stream) :
|
||||
CBaseClientProxy(name),
|
||||
ClientProxy::ClientProxy(const String& name, synergy::IStream* stream) :
|
||||
BaseClientProxy(name),
|
||||
m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
||||
CClientProxy::~CClientProxy()
|
||||
ClientProxy::~ClientProxy()
|
||||
{
|
||||
delete m_stream;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy::close(const char* msg)
|
||||
ClientProxy::close(const char* msg)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), msg);
|
||||
ProtocolUtil::writef(getStream(), msg);
|
||||
|
||||
// force the close to be sent before we return
|
||||
getStream()->flush();
|
||||
}
|
||||
|
||||
synergy::IStream*
|
||||
CClientProxy::getStream() const
|
||||
ClientProxy::getStream() const
|
||||
{
|
||||
return m_stream;
|
||||
}
|
||||
|
||||
void*
|
||||
CClientProxy::getEventTarget() const
|
||||
ClientProxy::getEventTarget() const
|
||||
{
|
||||
return static_cast<IScreen*>(const_cast<CClientProxy*>(this));
|
||||
return static_cast<IScreen*>(const_cast<ClientProxy*>(this));
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
namespace synergy { class IStream; }
|
||||
|
||||
//! Generic proxy for client
|
||||
class CClientProxy : public CBaseClientProxy {
|
||||
class ClientProxy : public BaseClientProxy {
|
||||
public:
|
||||
/*!
|
||||
\c name is the name of the client.
|
||||
*/
|
||||
CClientProxy(const CString& name, synergy::IStream* adoptedStream);
|
||||
~CClientProxy();
|
||||
ClientProxy(const String& name, synergy::IStream* adoptedStream);
|
||||
~ClientProxy();
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta) = 0;
|
||||
virtual void screensaver(bool activate) = 0;
|
||||
virtual void resetOptions() = 0;
|
||||
virtual void setOptions(const COptionsList& options) = 0;
|
||||
virtual void setOptions(const OptionsList& options) = 0;
|
||||
virtual void sendDragInfo(UInt32 fileCount, const char* info,
|
||||
size_t size) = 0;
|
||||
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize) = 0;
|
||||
|
||||
@@ -28,57 +28,57 @@
|
||||
#include <cstring>
|
||||
|
||||
//
|
||||
// CClientProxy1_0
|
||||
// ClientProxy1_0
|
||||
//
|
||||
|
||||
CClientProxy1_0::CClientProxy1_0(const CString& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
CClientProxy(name, stream),
|
||||
ClientProxy1_0::ClientProxy1_0(const String& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
ClientProxy(name, stream),
|
||||
m_heartbeatTimer(NULL),
|
||||
m_parser(&CClientProxy1_0::parseHandshakeMessage),
|
||||
m_parser(&ClientProxy1_0::parseHandshakeMessage),
|
||||
m_events(events)
|
||||
{
|
||||
// install event handlers
|
||||
m_events->adoptHandler(m_events->forIStream().inputReady(),
|
||||
stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxy1_0>(this,
|
||||
&CClientProxy1_0::handleData, NULL));
|
||||
new TMethodEventJob<ClientProxy1_0>(this,
|
||||
&ClientProxy1_0::handleData, NULL));
|
||||
m_events->adoptHandler(m_events->forIStream().outputError(),
|
||||
stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxy1_0>(this,
|
||||
&CClientProxy1_0::handleWriteError, NULL));
|
||||
new TMethodEventJob<ClientProxy1_0>(this,
|
||||
&ClientProxy1_0::handleWriteError, NULL));
|
||||
m_events->adoptHandler(m_events->forIStream().inputShutdown(),
|
||||
stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxy1_0>(this,
|
||||
&CClientProxy1_0::handleDisconnect, NULL));
|
||||
new TMethodEventJob<ClientProxy1_0>(this,
|
||||
&ClientProxy1_0::handleDisconnect, NULL));
|
||||
m_events->adoptHandler(m_events->forIStream().outputShutdown(),
|
||||
stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxy1_0>(this,
|
||||
&CClientProxy1_0::handleWriteError, NULL));
|
||||
m_events->adoptHandler(CEvent::kTimer, this,
|
||||
new TMethodEventJob<CClientProxy1_0>(this,
|
||||
&CClientProxy1_0::handleFlatline, NULL));
|
||||
new TMethodEventJob<ClientProxy1_0>(this,
|
||||
&ClientProxy1_0::handleWriteError, NULL));
|
||||
m_events->adoptHandler(Event::kTimer, this,
|
||||
new TMethodEventJob<ClientProxy1_0>(this,
|
||||
&ClientProxy1_0::handleFlatline, NULL));
|
||||
|
||||
setHeartbeatRate(kHeartRate, kHeartRate * kHeartBeatsUntilDeath);
|
||||
|
||||
LOG((CLOG_DEBUG1 "querying client \"%s\" info", getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgQInfo);
|
||||
ProtocolUtil::writef(getStream(), kMsgQInfo);
|
||||
}
|
||||
|
||||
CClientProxy1_0::~CClientProxy1_0()
|
||||
ClientProxy1_0::~ClientProxy1_0()
|
||||
{
|
||||
removeHandlers();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::disconnect()
|
||||
ClientProxy1_0::disconnect()
|
||||
{
|
||||
removeHandlers();
|
||||
getStream()->close();
|
||||
m_events->addEvent(CEvent(m_events->forCClientProxy().disconnected(), getEventTarget()));
|
||||
m_events->addEvent(Event(m_events->forClientProxy().disconnected(), getEventTarget()));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::removeHandlers()
|
||||
ClientProxy1_0::removeHandlers()
|
||||
{
|
||||
// uninstall event handlers
|
||||
m_events->removeHandler(m_events->forIStream().inputReady(),
|
||||
@@ -89,14 +89,14 @@ CClientProxy1_0::removeHandlers()
|
||||
getStream()->getEventTarget());
|
||||
m_events->removeHandler(m_events->forIStream().outputShutdown(),
|
||||
getStream()->getEventTarget());
|
||||
m_events->removeHandler(CEvent::kTimer, this);
|
||||
m_events->removeHandler(Event::kTimer, this);
|
||||
|
||||
// remove timer
|
||||
removeHeartbeatTimer();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::addHeartbeatTimer()
|
||||
ClientProxy1_0::addHeartbeatTimer()
|
||||
{
|
||||
if (m_heartbeatAlarm > 0.0) {
|
||||
m_heartbeatTimer = m_events->newOneShotTimer(m_heartbeatAlarm, this);
|
||||
@@ -104,7 +104,7 @@ CClientProxy1_0::addHeartbeatTimer()
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::removeHeartbeatTimer()
|
||||
ClientProxy1_0::removeHeartbeatTimer()
|
||||
{
|
||||
if (m_heartbeatTimer != NULL) {
|
||||
m_events->deleteTimer(m_heartbeatTimer);
|
||||
@@ -113,7 +113,7 @@ CClientProxy1_0::removeHeartbeatTimer()
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::resetHeartbeatTimer()
|
||||
ClientProxy1_0::resetHeartbeatTimer()
|
||||
{
|
||||
// reset the alarm
|
||||
removeHeartbeatTimer();
|
||||
@@ -121,19 +121,19 @@ CClientProxy1_0::resetHeartbeatTimer()
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::resetHeartbeatRate()
|
||||
ClientProxy1_0::resetHeartbeatRate()
|
||||
{
|
||||
setHeartbeatRate(kHeartRate, kHeartRate * kHeartBeatsUntilDeath);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::setHeartbeatRate(double, double alarm)
|
||||
ClientProxy1_0::setHeartbeatRate(double, double alarm)
|
||||
{
|
||||
m_heartbeatAlarm = alarm;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::handleData(const CEvent&, void*)
|
||||
ClientProxy1_0::handleData(const Event&, void*)
|
||||
{
|
||||
// handle messages until there are no more. first read message code.
|
||||
UInt8 code[4];
|
||||
@@ -163,7 +163,7 @@ CClientProxy1_0::handleData(const CEvent&, void*)
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::parseHandshakeMessage(const UInt8* code)
|
||||
ClientProxy1_0::parseHandshakeMessage(const UInt8* code)
|
||||
{
|
||||
if (memcmp(code, kMsgCNoop, 4) == 0) {
|
||||
// discard no-ops
|
||||
@@ -172,9 +172,9 @@ CClientProxy1_0::parseHandshakeMessage(const UInt8* code)
|
||||
}
|
||||
else if (memcmp(code, kMsgDInfo, 4) == 0) {
|
||||
// future messages get parsed by parseMessage
|
||||
m_parser = &CClientProxy1_0::parseMessage;
|
||||
m_parser = &ClientProxy1_0::parseMessage;
|
||||
if (recvInfo()) {
|
||||
m_events->addEvent(CEvent(m_events->forCClientProxy().ready(), getEventTarget()));
|
||||
m_events->addEvent(Event(m_events->forClientProxy().ready(), getEventTarget()));
|
||||
addHeartbeatTimer();
|
||||
return true;
|
||||
}
|
||||
@@ -183,12 +183,12 @@ CClientProxy1_0::parseHandshakeMessage(const UInt8* code)
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::parseMessage(const UInt8* code)
|
||||
ClientProxy1_0::parseMessage(const UInt8* code)
|
||||
{
|
||||
if (memcmp(code, kMsgDInfo, 4) == 0) {
|
||||
if (recvInfo()) {
|
||||
m_events->addEvent(
|
||||
CEvent(m_events->forIScreen().shapeChanged(), getEventTarget()));
|
||||
Event(m_events->forIScreen().shapeChanged(), getEventTarget()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -208,21 +208,21 @@ CClientProxy1_0::parseMessage(const UInt8* code)
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::handleDisconnect(const CEvent&, void*)
|
||||
ClientProxy1_0::handleDisconnect(const Event&, void*)
|
||||
{
|
||||
LOG((CLOG_NOTE "client \"%s\" has disconnected", getName().c_str()));
|
||||
disconnect();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::handleWriteError(const CEvent&, void*)
|
||||
ClientProxy1_0::handleWriteError(const Event&, void*)
|
||||
{
|
||||
LOG((CLOG_WARN "error writing to client \"%s\"", getName().c_str()));
|
||||
disconnect();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::handleFlatline(const CEvent&, void*)
|
||||
ClientProxy1_0::handleFlatline(const Event&, void*)
|
||||
{
|
||||
// didn't get a heartbeat fast enough. assume client is dead.
|
||||
LOG((CLOG_NOTE "client \"%s\" is dead", getName().c_str()));
|
||||
@@ -230,14 +230,14 @@ CClientProxy1_0::handleFlatline(const CEvent&, void*)
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::getClipboard(ClipboardID id, IClipboard* clipboard) const
|
||||
ClientProxy1_0::getClipboard(ClipboardID id, IClipboard* clipboard) const
|
||||
{
|
||||
CClipboard::copy(clipboard, &m_clipboard[id].m_clipboard);
|
||||
Clipboard::copy(clipboard, &m_clipboard[id].m_clipboard);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
ClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
{
|
||||
x = m_info.m_x;
|
||||
y = m_info.m_y;
|
||||
@@ -246,7 +246,7 @@ CClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const
|
||||
ClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
// note -- this returns the cursor pos from when we last got client info
|
||||
x = m_info.m_mx;
|
||||
@@ -254,138 +254,138 @@ CClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::enter(SInt32 xAbs, SInt32 yAbs,
|
||||
ClientProxy1_0::enter(SInt32 xAbs, SInt32 yAbs,
|
||||
UInt32 seqNum, KeyModifierMask mask, bool)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask));
|
||||
CProtocolUtil::writef(getStream(), kMsgCEnter,
|
||||
ProtocolUtil::writef(getStream(), kMsgCEnter,
|
||||
xAbs, yAbs, seqNum, mask);
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::leave()
|
||||
ClientProxy1_0::leave()
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send leave to \"%s\"", getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgCLeave);
|
||||
ProtocolUtil::writef(getStream(), kMsgCLeave);
|
||||
|
||||
// we can never prevent the user from leaving
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||
ClientProxy1_0::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||
{
|
||||
// ignore if this clipboard is already clean
|
||||
if (m_clipboard[id].m_dirty) {
|
||||
// this clipboard is now clean
|
||||
m_clipboard[id].m_dirty = false;
|
||||
CClipboard::copy(&m_clipboard[id].m_clipboard, clipboard);
|
||||
Clipboard::copy(&m_clipboard[id].m_clipboard, clipboard);
|
||||
|
||||
CString data = m_clipboard[id].m_clipboard.marshall();
|
||||
String data = m_clipboard[id].m_clipboard.marshall();
|
||||
LOG((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getName().c_str(), data.size()));
|
||||
CProtocolUtil::writef(getStream(), kMsgDClipboard, id, 0, &data);
|
||||
ProtocolUtil::writef(getStream(), kMsgDClipboard, id, 0, &data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::grabClipboard(ClipboardID id)
|
||||
ClientProxy1_0::grabClipboard(ClipboardID id)
|
||||
{
|
||||
LOG((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgCClipboard, id, 0);
|
||||
ProtocolUtil::writef(getStream(), kMsgCClipboard, id, 0);
|
||||
|
||||
// this clipboard is now dirty
|
||||
m_clipboard[id].m_dirty = true;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty)
|
||||
ClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty)
|
||||
{
|
||||
m_clipboard[id].m_dirty = dirty;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask, KeyButton)
|
||||
ClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask, KeyButton)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
|
||||
CProtocolUtil::writef(getStream(), kMsgDKeyDown1_0, key, mask);
|
||||
ProtocolUtil::writef(getStream(), kMsgDKeyDown1_0, key, mask);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask,
|
||||
ClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask,
|
||||
SInt32 count, KeyButton)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count));
|
||||
CProtocolUtil::writef(getStream(), kMsgDKeyRepeat1_0, key, mask, count);
|
||||
ProtocolUtil::writef(getStream(), kMsgDKeyRepeat1_0, key, mask, count);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton)
|
||||
ClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
|
||||
CProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask);
|
||||
ProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::mouseDown(ButtonID button)
|
||||
ClientProxy1_0::mouseDown(ButtonID button)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getName().c_str(), button));
|
||||
CProtocolUtil::writef(getStream(), kMsgDMouseDown, button);
|
||||
ProtocolUtil::writef(getStream(), kMsgDMouseDown, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::mouseUp(ButtonID button)
|
||||
ClientProxy1_0::mouseUp(ButtonID button)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getName().c_str(), button));
|
||||
CProtocolUtil::writef(getStream(), kMsgDMouseUp, button);
|
||||
ProtocolUtil::writef(getStream(), kMsgDMouseUp, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::mouseMove(SInt32 xAbs, SInt32 yAbs)
|
||||
ClientProxy1_0::mouseMove(SInt32 xAbs, SInt32 yAbs)
|
||||
{
|
||||
LOG((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs));
|
||||
CProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs);
|
||||
ProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::mouseRelativeMove(SInt32, SInt32)
|
||||
ClientProxy1_0::mouseRelativeMove(SInt32, SInt32)
|
||||
{
|
||||
// ignore -- not supported in protocol 1.0
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::mouseWheel(SInt32, SInt32 yDelta)
|
||||
ClientProxy1_0::mouseWheel(SInt32, SInt32 yDelta)
|
||||
{
|
||||
// clients prior to 1.3 only support the y axis
|
||||
LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getName().c_str(), yDelta));
|
||||
CProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta);
|
||||
ProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||
ClientProxy1_0::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||
{
|
||||
// ignore -- not supported in protocol 1.0
|
||||
LOG((CLOG_DEBUG "draggingInfoSending not supported"));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
ClientProxy1_0::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
{
|
||||
// ignore -- not supported in protocol 1.0
|
||||
LOG((CLOG_DEBUG "fileChunkSending not supported"));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::screensaver(bool on)
|
||||
ClientProxy1_0::screensaver(bool on)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0));
|
||||
CProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0);
|
||||
ProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::resetOptions()
|
||||
ClientProxy1_0::resetOptions()
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send reset options to \"%s\"", getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgCResetOptions);
|
||||
ProtocolUtil::writef(getStream(), kMsgCResetOptions);
|
||||
|
||||
// reset heart rate and death
|
||||
resetHeartbeatRate();
|
||||
@@ -394,10 +394,10 @@ CClientProxy1_0::resetOptions()
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::setOptions(const COptionsList& options)
|
||||
ClientProxy1_0::setOptions(const OptionsList& options)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send set options to \"%s\" size=%d", getName().c_str(), options.size()));
|
||||
CProtocolUtil::writef(getStream(), kMsgDSetOptions, &options);
|
||||
ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options);
|
||||
|
||||
// check options
|
||||
for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
|
||||
@@ -414,11 +414,11 @@ CClientProxy1_0::setOptions(const COptionsList& options)
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::recvInfo()
|
||||
ClientProxy1_0::recvInfo()
|
||||
{
|
||||
// parse the message
|
||||
SInt16 x, y, w, h, dummy1, mx, my;
|
||||
if (!CProtocolUtil::readf(getStream(), kMsgDInfo + 4,
|
||||
if (!ProtocolUtil::readf(getStream(), kMsgDInfo + 4,
|
||||
&x, &y, &w, &h, &dummy1, &mx, &my)) {
|
||||
return false;
|
||||
}
|
||||
@@ -443,18 +443,18 @@ CClientProxy1_0::recvInfo()
|
||||
|
||||
// acknowledge receipt
|
||||
LOG((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgCInfoAck);
|
||||
ProtocolUtil::writef(getStream(), kMsgCInfoAck);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::recvClipboard()
|
||||
ClientProxy1_0::recvClipboard()
|
||||
{
|
||||
// parse message
|
||||
ClipboardID id;
|
||||
UInt32 seqNum;
|
||||
CString data;
|
||||
if (!CProtocolUtil::readf(getStream(),
|
||||
String data;
|
||||
if (!ProtocolUtil::readf(getStream(),
|
||||
kMsgDClipboard + 4, &id, &seqNum, &data)) {
|
||||
return false;
|
||||
}
|
||||
@@ -470,22 +470,22 @@ CClientProxy1_0::recvClipboard()
|
||||
m_clipboard[id].m_sequenceNumber = seqNum;
|
||||
|
||||
// notify
|
||||
CClipboardInfo* info = new CClipboardInfo;
|
||||
ClipboardInfo* info = new ClipboardInfo;
|
||||
info->m_id = id;
|
||||
info->m_sequenceNumber = seqNum;
|
||||
m_events->addEvent(CEvent(m_events->forCClientProxy().clipboardChanged(),
|
||||
m_events->addEvent(Event(m_events->forClientProxy().clipboardChanged(),
|
||||
getEventTarget(), info));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_0::recvGrabClipboard()
|
||||
ClientProxy1_0::recvGrabClipboard()
|
||||
{
|
||||
// parse message
|
||||
ClipboardID id;
|
||||
UInt32 seqNum;
|
||||
if (!CProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) {
|
||||
if (!ProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) {
|
||||
return false;
|
||||
}
|
||||
LOG((CLOG_DEBUG "received client \"%s\" grabbed clipboard %d seqnum=%d", getName().c_str(), id, seqNum));
|
||||
@@ -496,10 +496,10 @@ CClientProxy1_0::recvGrabClipboard()
|
||||
}
|
||||
|
||||
// notify
|
||||
CClipboardInfo* info = new CClipboardInfo;
|
||||
ClipboardInfo* info = new ClipboardInfo;
|
||||
info->m_id = id;
|
||||
info->m_sequenceNumber = seqNum;
|
||||
m_events->addEvent(CEvent(m_events->forIScreen().clipboardGrabbed(),
|
||||
m_events->addEvent(Event(m_events->forIScreen().clipboardGrabbed(),
|
||||
getEventTarget(), info));
|
||||
|
||||
return true;
|
||||
@@ -507,10 +507,10 @@ CClientProxy1_0::recvGrabClipboard()
|
||||
|
||||
|
||||
//
|
||||
// CClientProxy1_0::CClientClipboard
|
||||
// ClientProxy1_0::ClientClipboard
|
||||
//
|
||||
|
||||
CClientProxy1_0::CClientClipboard::CClientClipboard() :
|
||||
ClientProxy1_0::ClientClipboard::ClientClipboard() :
|
||||
m_clipboard(),
|
||||
m_sequenceNumber(0),
|
||||
m_dirty(true)
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
#include "synergy/Clipboard.h"
|
||||
#include "synergy/protocol_types.h"
|
||||
|
||||
class CEvent;
|
||||
class CEventQueueTimer;
|
||||
class Event;
|
||||
class EventQueueTimer;
|
||||
class IEventQueue;
|
||||
|
||||
//! Proxy for client implementing protocol version 1.0
|
||||
class CClientProxy1_0 : public CClientProxy {
|
||||
class ClientProxy1_0 : public ClientProxy {
|
||||
public:
|
||||
CClientProxy1_0(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~CClientProxy1_0();
|
||||
ClientProxy1_0(const String& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~ClientProxy1_0();
|
||||
|
||||
// IScreen
|
||||
virtual bool getClipboard(ClipboardID id, IClipboard*) const;
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta);
|
||||
virtual void screensaver(bool activate);
|
||||
virtual void resetOptions();
|
||||
virtual void setOptions(const COptionsList& options);
|
||||
virtual void setOptions(const OptionsList& options);
|
||||
virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size);
|
||||
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize);
|
||||
|
||||
@@ -75,31 +75,31 @@ private:
|
||||
void disconnect();
|
||||
void removeHandlers();
|
||||
|
||||
void handleData(const CEvent&, void*);
|
||||
void handleDisconnect(const CEvent&, void*);
|
||||
void handleWriteError(const CEvent&, void*);
|
||||
void handleFlatline(const CEvent&, void*);
|
||||
void handleData(const Event&, void*);
|
||||
void handleDisconnect(const Event&, void*);
|
||||
void handleWriteError(const Event&, void*);
|
||||
void handleFlatline(const Event&, void*);
|
||||
|
||||
bool recvInfo();
|
||||
bool recvClipboard();
|
||||
bool recvGrabClipboard();
|
||||
|
||||
private:
|
||||
typedef bool (CClientProxy1_0::*MessageParser)(const UInt8*);
|
||||
struct CClientClipboard {
|
||||
typedef bool (ClientProxy1_0::*MessageParser)(const UInt8*);
|
||||
struct ClientClipboard {
|
||||
public:
|
||||
CClientClipboard();
|
||||
ClientClipboard();
|
||||
|
||||
public:
|
||||
CClipboard m_clipboard;
|
||||
Clipboard m_clipboard;
|
||||
UInt32 m_sequenceNumber;
|
||||
bool m_dirty;
|
||||
};
|
||||
|
||||
CClientInfo m_info;
|
||||
CClientClipboard m_clipboard[kClipboardEnd];
|
||||
ClientInfo m_info;
|
||||
ClientClipboard m_clipboard[kClipboardEnd];
|
||||
double m_heartbeatAlarm;
|
||||
CEventQueueTimer* m_heartbeatTimer;
|
||||
EventQueueTimer* m_heartbeatTimer;
|
||||
MessageParser m_parser;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
@@ -24,38 +24,38 @@
|
||||
#include <cstring>
|
||||
|
||||
//
|
||||
// CClientProxy1_1
|
||||
// ClientProxy1_1
|
||||
//
|
||||
|
||||
CClientProxy1_1::CClientProxy1_1(const CString& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
CClientProxy1_0(name, stream, events)
|
||||
ClientProxy1_1::ClientProxy1_1(const String& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
ClientProxy1_0(name, stream, events)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CClientProxy1_1::~CClientProxy1_1()
|
||||
ClientProxy1_1::~ClientProxy1_1()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_1::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
ClientProxy1_1::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button));
|
||||
CProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button);
|
||||
ProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_1::keyRepeat(KeyID key, KeyModifierMask mask,
|
||||
ClientProxy1_1::keyRepeat(KeyID key, KeyModifierMask mask,
|
||||
SInt32 count, KeyButton button)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d, button=0x%04x", getName().c_str(), key, mask, count, button));
|
||||
CProtocolUtil::writef(getStream(), kMsgDKeyRepeat, key, mask, count, button);
|
||||
ProtocolUtil::writef(getStream(), kMsgDKeyRepeat, key, mask, count, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
ClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button));
|
||||
CProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button);
|
||||
ProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
#include "server/ClientProxy1_0.h"
|
||||
|
||||
//! Proxy for client implementing protocol version 1.1
|
||||
class CClientProxy1_1 : public CClientProxy1_0 {
|
||||
class ClientProxy1_1 : public ClientProxy1_0 {
|
||||
public:
|
||||
CClientProxy1_1(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~CClientProxy1_1();
|
||||
ClientProxy1_1(const String& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~ClientProxy1_1();
|
||||
|
||||
// IClient overrides
|
||||
virtual void keyDown(KeyID, KeyModifierMask, KeyButton);
|
||||
|
||||
@@ -22,23 +22,23 @@
|
||||
#include "base/Log.h"
|
||||
|
||||
//
|
||||
// CClientProxy1_1
|
||||
// ClientProxy1_1
|
||||
//
|
||||
|
||||
CClientProxy1_2::CClientProxy1_2(const CString& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
CClientProxy1_1(name, stream, events)
|
||||
ClientProxy1_2::ClientProxy1_2(const String& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
ClientProxy1_1(name, stream, events)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CClientProxy1_2::~CClientProxy1_2()
|
||||
ClientProxy1_2::~ClientProxy1_2()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_2::mouseRelativeMove(SInt32 xRel, SInt32 yRel)
|
||||
ClientProxy1_2::mouseRelativeMove(SInt32 xRel, SInt32 yRel)
|
||||
{
|
||||
LOG((CLOG_DEBUG2 "send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel));
|
||||
CProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel);
|
||||
ProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel);
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
class IEventQueue;
|
||||
|
||||
//! Proxy for client implementing protocol version 1.2
|
||||
class CClientProxy1_2 : public CClientProxy1_1 {
|
||||
class ClientProxy1_2 : public ClientProxy1_1 {
|
||||
public:
|
||||
CClientProxy1_2(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~CClientProxy1_2();
|
||||
ClientProxy1_2(const String& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~ClientProxy1_2();
|
||||
|
||||
// IClient overrides
|
||||
virtual void mouseRelativeMove(SInt32 xRel, SInt32 yRel);
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <memory>
|
||||
|
||||
//
|
||||
// CClientProxy1_3
|
||||
// ClientProxy1_3
|
||||
//
|
||||
|
||||
CClientProxy1_3::CClientProxy1_3(const CString& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
CClientProxy1_2(name, stream, events),
|
||||
ClientProxy1_3::ClientProxy1_3(const String& name, synergy::IStream* stream, IEventQueue* events) :
|
||||
ClientProxy1_2(name, stream, events),
|
||||
m_keepAliveRate(kKeepAliveRate),
|
||||
m_keepAliveTimer(NULL),
|
||||
m_events(events)
|
||||
@@ -39,21 +39,21 @@ CClientProxy1_3::CClientProxy1_3(const CString& name, synergy::IStream* stream,
|
||||
setHeartbeatRate(kKeepAliveRate, kKeepAliveRate * kKeepAlivesUntilDeath);
|
||||
}
|
||||
|
||||
CClientProxy1_3::~CClientProxy1_3()
|
||||
ClientProxy1_3::~ClientProxy1_3()
|
||||
{
|
||||
// cannot do this in superclass or our override wouldn't get called
|
||||
removeHeartbeatTimer();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::mouseWheel(SInt32 xDelta, SInt32 yDelta)
|
||||
ClientProxy1_3::mouseWheel(SInt32 xDelta, SInt32 yDelta)
|
||||
{
|
||||
LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta));
|
||||
CProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta);
|
||||
ProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta);
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_3::parseMessage(const UInt8* code)
|
||||
ClientProxy1_3::parseMessage(const UInt8* code)
|
||||
{
|
||||
// process message
|
||||
if (memcmp(code, kMsgCKeepAlive, 4) == 0) {
|
||||
@@ -62,68 +62,68 @@ CClientProxy1_3::parseMessage(const UInt8* code)
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return CClientProxy1_2::parseMessage(code);
|
||||
return ClientProxy1_2::parseMessage(code);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::resetHeartbeatRate()
|
||||
ClientProxy1_3::resetHeartbeatRate()
|
||||
{
|
||||
setHeartbeatRate(kKeepAliveRate, kKeepAliveRate * kKeepAlivesUntilDeath);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::setHeartbeatRate(double rate, double)
|
||||
ClientProxy1_3::setHeartbeatRate(double rate, double)
|
||||
{
|
||||
m_keepAliveRate = rate;
|
||||
CClientProxy1_2::setHeartbeatRate(rate, rate * kKeepAlivesUntilDeath);
|
||||
ClientProxy1_2::setHeartbeatRate(rate, rate * kKeepAlivesUntilDeath);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::resetHeartbeatTimer()
|
||||
ClientProxy1_3::resetHeartbeatTimer()
|
||||
{
|
||||
// reset the alarm but not the keep alive timer
|
||||
CClientProxy1_2::removeHeartbeatTimer();
|
||||
CClientProxy1_2::addHeartbeatTimer();
|
||||
ClientProxy1_2::removeHeartbeatTimer();
|
||||
ClientProxy1_2::addHeartbeatTimer();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::addHeartbeatTimer()
|
||||
ClientProxy1_3::addHeartbeatTimer()
|
||||
{
|
||||
// create and install a timer to periodically send keep alives
|
||||
if (m_keepAliveRate > 0.0) {
|
||||
m_keepAliveTimer = m_events->newTimer(m_keepAliveRate, NULL);
|
||||
m_events->adoptHandler(CEvent::kTimer, m_keepAliveTimer,
|
||||
new TMethodEventJob<CClientProxy1_3>(this,
|
||||
&CClientProxy1_3::handleKeepAlive, NULL));
|
||||
m_events->adoptHandler(Event::kTimer, m_keepAliveTimer,
|
||||
new TMethodEventJob<ClientProxy1_3>(this,
|
||||
&ClientProxy1_3::handleKeepAlive, NULL));
|
||||
}
|
||||
|
||||
// superclass does the alarm
|
||||
CClientProxy1_2::addHeartbeatTimer();
|
||||
ClientProxy1_2::addHeartbeatTimer();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::removeHeartbeatTimer()
|
||||
ClientProxy1_3::removeHeartbeatTimer()
|
||||
{
|
||||
// remove the timer that sends keep alives periodically
|
||||
if (m_keepAliveTimer != NULL) {
|
||||
m_events->removeHandler(CEvent::kTimer, m_keepAliveTimer);
|
||||
m_events->removeHandler(Event::kTimer, m_keepAliveTimer);
|
||||
m_events->deleteTimer(m_keepAliveTimer);
|
||||
m_keepAliveTimer = NULL;
|
||||
}
|
||||
|
||||
// superclass does the alarm
|
||||
CClientProxy1_2::removeHeartbeatTimer();
|
||||
ClientProxy1_2::removeHeartbeatTimer();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::handleKeepAlive(const CEvent&, void*)
|
||||
ClientProxy1_3::handleKeepAlive(const Event&, void*)
|
||||
{
|
||||
keepAlive();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::keepAlive()
|
||||
ClientProxy1_3::keepAlive()
|
||||
{
|
||||
CProtocolUtil::writef(getStream(), kMsgCKeepAlive);
|
||||
ProtocolUtil::writef(getStream(), kMsgCKeepAlive);
|
||||
}
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include "server/ClientProxy1_2.h"
|
||||
|
||||
//! Proxy for client implementing protocol version 1.3
|
||||
class CClientProxy1_3 : public CClientProxy1_2 {
|
||||
class ClientProxy1_3 : public ClientProxy1_2 {
|
||||
public:
|
||||
CClientProxy1_3(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~CClientProxy1_3();
|
||||
ClientProxy1_3(const String& name, synergy::IStream* adoptedStream, IEventQueue* events);
|
||||
~ClientProxy1_3();
|
||||
|
||||
// IClient overrides
|
||||
virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta);
|
||||
|
||||
protected:
|
||||
// CClientProxy overrides
|
||||
// ClientProxy overrides
|
||||
virtual bool parseMessage(const UInt8* code);
|
||||
virtual void resetHeartbeatRate();
|
||||
virtual void setHeartbeatRate(double rate, double alarm);
|
||||
@@ -40,10 +40,10 @@ protected:
|
||||
virtual void keepAlive();
|
||||
|
||||
private:
|
||||
void handleKeepAlive(const CEvent&, void*);
|
||||
void handleKeepAlive(const Event&, void*);
|
||||
|
||||
private:
|
||||
double m_keepAliveRate;
|
||||
CEventQueueTimer* m_keepAliveTimer;
|
||||
EventQueueTimer* m_keepAliveTimer;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
@@ -29,61 +29,61 @@
|
||||
#include <memory>
|
||||
|
||||
//
|
||||
// CClientProxy1_4
|
||||
// ClientProxy1_4
|
||||
//
|
||||
|
||||
CClientProxy1_4::CClientProxy1_4(const CString& name, synergy::IStream* stream, CServer* server, IEventQueue* events) :
|
||||
CClientProxy1_3(name, stream, events), m_server(server)
|
||||
ClientProxy1_4::ClientProxy1_4(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) :
|
||||
ClientProxy1_3(name, stream, events), m_server(server)
|
||||
{
|
||||
assert(m_server != NULL);
|
||||
}
|
||||
|
||||
CClientProxy1_4::~CClientProxy1_4()
|
||||
ClientProxy1_4::~ClientProxy1_4()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
ClientProxy1_4::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keyDown(key, mask, button);
|
||||
ClientProxy1_3::keyDown(key, mask, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button)
|
||||
ClientProxy1_4::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button)
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keyRepeat(key, mask, count, button);
|
||||
ClientProxy1_3::keyRepeat(key, mask, count, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
ClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keyUp(key, mask, button);
|
||||
ClientProxy1_3::keyUp(key, mask, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keepAlive()
|
||||
ClientProxy1_4::keepAlive()
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keepAlive();
|
||||
ClientProxy1_3::keepAlive();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::cryptoIv()
|
||||
ClientProxy1_4::cryptoIv()
|
||||
{
|
||||
CCryptoStream* cryptoStream = dynamic_cast<CCryptoStream*>(getStream());
|
||||
CryptoStream* cryptoStream = dynamic_cast<CryptoStream*>(getStream());
|
||||
if (cryptoStream == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
byte iv[CRYPTO_IV_SIZE];
|
||||
cryptoStream->newIv(iv);
|
||||
CString data(reinterpret_cast<const char*>(iv), CRYPTO_IV_SIZE);
|
||||
String data(reinterpret_cast<const char*>(iv), CRYPTO_IV_SIZE);
|
||||
|
||||
LOG((CLOG_DEBUG2 "send crypto iv change to \"%s\"", getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgDCryptoIv, &data);
|
||||
ProtocolUtil::writef(getStream(), kMsgDCryptoIv, &data);
|
||||
|
||||
// change IV only after we've sent the current IV, otherwise
|
||||
// the client won't be able to decrypt the new IV.
|
||||
|
||||
@@ -20,19 +20,19 @@
|
||||
|
||||
#include "server/ClientProxy1_3.h"
|
||||
|
||||
class CServer;
|
||||
class Server;
|
||||
|
||||
//! Proxy for client implementing protocol version 1.4
|
||||
class CClientProxy1_4 : public CClientProxy1_3 {
|
||||
class ClientProxy1_4 : public ClientProxy1_3 {
|
||||
public:
|
||||
CClientProxy1_4(const CString& name, synergy::IStream* adoptedStream, CServer* server, IEventQueue* events);
|
||||
~CClientProxy1_4();
|
||||
ClientProxy1_4(const String& name, synergy::IStream* adoptedStream, Server* server, IEventQueue* events);
|
||||
~ClientProxy1_4();
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! get server pointer
|
||||
CServer* getServer() { return m_server; }
|
||||
Server* getServer() { return m_server; }
|
||||
|
||||
//@}
|
||||
|
||||
@@ -45,5 +45,5 @@ public:
|
||||
//! Send IV to make
|
||||
void cryptoIv();
|
||||
|
||||
CServer* m_server;
|
||||
Server* m_server;
|
||||
};
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
#include "base/Log.h"
|
||||
|
||||
//
|
||||
// CClientProxy1_5
|
||||
// ClientProxy1_5
|
||||
//
|
||||
|
||||
const UInt16 CClientProxy1_5::m_intervalThreshold = 1;
|
||||
const UInt16 ClientProxy1_5::m_intervalThreshold = 1;
|
||||
|
||||
CClientProxy1_5::CClientProxy1_5(const CString& name, synergy::IStream* stream, CServer* server, IEventQueue* events) :
|
||||
CClientProxy1_4(name, stream, server, events),
|
||||
ClientProxy1_5::ClientProxy1_5(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) :
|
||||
ClientProxy1_4(name, stream, server, events),
|
||||
m_events(events),
|
||||
m_stopwatch(true),
|
||||
m_elapsedTime(0),
|
||||
@@ -37,22 +37,22 @@ CClientProxy1_5::CClientProxy1_5(const CString& name, synergy::IStream* stream,
|
||||
{
|
||||
}
|
||||
|
||||
CClientProxy1_5::~CClientProxy1_5()
|
||||
ClientProxy1_5::~ClientProxy1_5()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||
ClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||
{
|
||||
CString data(info, size);
|
||||
String data(info, size);
|
||||
|
||||
CProtocolUtil::writef(getStream(), kMsgDDragInfo, fileCount, &data);
|
||||
ProtocolUtil::writef(getStream(), kMsgDDragInfo, fileCount, &data);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
ClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
{
|
||||
CString chunk(data, dataSize);
|
||||
String chunk(data, dataSize);
|
||||
|
||||
switch (mark) {
|
||||
case kFileStart:
|
||||
@@ -68,11 +68,11 @@ CClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
break;
|
||||
}
|
||||
|
||||
CProtocolUtil::writef(getStream(), kMsgDFileTransfer, mark, &chunk);
|
||||
ProtocolUtil::writef(getStream(), kMsgDFileTransfer, mark, &chunk);
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_5::parseMessage(const UInt8* code)
|
||||
ClientProxy1_5::parseMessage(const UInt8* code)
|
||||
{
|
||||
if (memcmp(code, kMsgDFileTransfer, 4) == 0) {
|
||||
fileChunkReceived();
|
||||
@@ -81,21 +81,21 @@ CClientProxy1_5::parseMessage(const UInt8* code)
|
||||
dragInfoReceived();
|
||||
}
|
||||
else {
|
||||
return CClientProxy1_4::parseMessage(code);
|
||||
return ClientProxy1_4::parseMessage(code);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_5::fileChunkReceived()
|
||||
ClientProxy1_5::fileChunkReceived()
|
||||
{
|
||||
// parse
|
||||
UInt8 mark = 0;
|
||||
CString content;
|
||||
CProtocolUtil::readf(getStream(), kMsgDFileTransfer + 4, &mark, &content);
|
||||
String content;
|
||||
ProtocolUtil::readf(getStream(), kMsgDFileTransfer + 4, &mark, &content);
|
||||
|
||||
CServer* server = getServer();
|
||||
Server* server = getServer();
|
||||
switch (mark) {
|
||||
case kFileStart:
|
||||
server->clearReceivedFileData();
|
||||
@@ -125,7 +125,7 @@ CClientProxy1_5::fileChunkReceived()
|
||||
break;
|
||||
|
||||
case kFileEnd:
|
||||
m_events->addEvent(CEvent(m_events->forIScreen().fileRecieveCompleted(), server));
|
||||
m_events->addEvent(Event(m_events->forIScreen().fileRecieveCompleted(), server));
|
||||
if (CLOG->getFilter() >= kDEBUG2) {
|
||||
LOG((CLOG_DEBUG2 "file data transfer finished"));
|
||||
m_elapsedTime += m_stopwatch.getTime();
|
||||
@@ -139,12 +139,12 @@ CClientProxy1_5::fileChunkReceived()
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_5::dragInfoReceived()
|
||||
ClientProxy1_5::dragInfoReceived()
|
||||
{
|
||||
// parse
|
||||
UInt32 fileNum = 0;
|
||||
CString content;
|
||||
CProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content);
|
||||
String content;
|
||||
ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content);
|
||||
|
||||
m_server->dragInfoReceived(fileNum, content);
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
#include "server/ClientProxy1_4.h"
|
||||
#include "base/Stopwatch.h"
|
||||
|
||||
class CServer;
|
||||
class Server;
|
||||
class IEventQueue;
|
||||
|
||||
//! Proxy for client implementing protocol version 1.5
|
||||
class CClientProxy1_5 : public CClientProxy1_4 {
|
||||
class ClientProxy1_5 : public ClientProxy1_4 {
|
||||
public:
|
||||
CClientProxy1_5(const CString& name, synergy::IStream* adoptedStream, CServer* server, IEventQueue* events);
|
||||
~CClientProxy1_5();
|
||||
ClientProxy1_5(const String& name, synergy::IStream* adoptedStream, Server* server, IEventQueue* events);
|
||||
~ClientProxy1_5();
|
||||
|
||||
virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size);
|
||||
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize);
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
private:
|
||||
IEventQueue* m_events;
|
||||
|
||||
CStopwatch m_stopwatch;
|
||||
Stopwatch m_stopwatch;
|
||||
double m_elapsedTime;
|
||||
size_t m_receivedDataSize;
|
||||
static const UInt16 m_intervalThreshold;
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
#include "base/TMethodEventJob.h"
|
||||
|
||||
//
|
||||
// CClientProxyUnknown
|
||||
// ClientProxyUnknown
|
||||
//
|
||||
|
||||
CClientProxyUnknown::CClientProxyUnknown(synergy::IStream* stream, double timeout, CServer* server, IEventQueue* events) :
|
||||
ClientProxyUnknown::ClientProxyUnknown(synergy::IStream* stream, double timeout, Server* server, IEventQueue* events) :
|
||||
m_stream(stream),
|
||||
m_proxy(NULL),
|
||||
m_ready(false),
|
||||
@@ -48,19 +48,19 @@ CClientProxyUnknown::CClientProxyUnknown(synergy::IStream* stream, double timeou
|
||||
{
|
||||
assert(m_server != NULL);
|
||||
|
||||
m_events->adoptHandler(CEvent::kTimer, this,
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleTimeout, NULL));
|
||||
m_events->adoptHandler(Event::kTimer, this,
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleTimeout, NULL));
|
||||
m_timer = m_events->newOneShotTimer(timeout, this);
|
||||
addStreamHandlers();
|
||||
|
||||
LOG((CLOG_DEBUG1 "saying hello"));
|
||||
CProtocolUtil::writef(m_stream, kMsgHello,
|
||||
ProtocolUtil::writef(m_stream, kMsgHello,
|
||||
kProtocolMajorVersion,
|
||||
kProtocolMinorVersion);
|
||||
}
|
||||
|
||||
CClientProxyUnknown::~CClientProxyUnknown()
|
||||
ClientProxyUnknown::~ClientProxyUnknown()
|
||||
{
|
||||
removeHandlers();
|
||||
removeTimer();
|
||||
@@ -68,12 +68,12 @@ CClientProxyUnknown::~CClientProxyUnknown()
|
||||
delete m_proxy;
|
||||
}
|
||||
|
||||
CClientProxy*
|
||||
CClientProxyUnknown::orphanClientProxy()
|
||||
ClientProxy*
|
||||
ClientProxyUnknown::orphanClientProxy()
|
||||
{
|
||||
if (m_ready) {
|
||||
removeHandlers();
|
||||
CClientProxy* proxy = m_proxy;
|
||||
ClientProxy* proxy = m_proxy;
|
||||
m_proxy = NULL;
|
||||
return proxy;
|
||||
}
|
||||
@@ -83,64 +83,64 @@ CClientProxyUnknown::orphanClientProxy()
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::sendSuccess()
|
||||
ClientProxyUnknown::sendSuccess()
|
||||
{
|
||||
m_ready = true;
|
||||
removeTimer();
|
||||
m_events->addEvent(CEvent(m_events->forCClientProxyUnknown().success(), this));
|
||||
m_events->addEvent(Event(m_events->forClientProxyUnknown().success(), this));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::sendFailure()
|
||||
ClientProxyUnknown::sendFailure()
|
||||
{
|
||||
delete m_proxy;
|
||||
m_proxy = NULL;
|
||||
m_ready = false;
|
||||
removeHandlers();
|
||||
removeTimer();
|
||||
m_events->addEvent(CEvent(m_events->forCClientProxyUnknown().failure(), this));
|
||||
m_events->addEvent(Event(m_events->forClientProxyUnknown().failure(), this));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::addStreamHandlers()
|
||||
ClientProxyUnknown::addStreamHandlers()
|
||||
{
|
||||
assert(m_stream != NULL);
|
||||
|
||||
m_events->adoptHandler(m_events->forIStream().inputReady(),
|
||||
m_stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleData));
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleData));
|
||||
m_events->adoptHandler(m_events->forIStream().outputError(),
|
||||
m_stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleWriteError));
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleWriteError));
|
||||
m_events->adoptHandler(m_events->forIStream().inputShutdown(),
|
||||
m_stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleDisconnect));
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleDisconnect));
|
||||
m_events->adoptHandler(m_events->forIStream().outputShutdown(),
|
||||
m_stream->getEventTarget(),
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleWriteError));
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleWriteError));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::addProxyHandlers()
|
||||
ClientProxyUnknown::addProxyHandlers()
|
||||
{
|
||||
assert(m_proxy != NULL);
|
||||
|
||||
m_events->adoptHandler(m_events->forCClientProxy().ready(),
|
||||
m_events->adoptHandler(m_events->forClientProxy().ready(),
|
||||
m_proxy,
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleReady));
|
||||
m_events->adoptHandler(m_events->forCClientProxy().disconnected(),
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleReady));
|
||||
m_events->adoptHandler(m_events->forClientProxy().disconnected(),
|
||||
m_proxy,
|
||||
new TMethodEventJob<CClientProxyUnknown>(this,
|
||||
&CClientProxyUnknown::handleDisconnect));
|
||||
new TMethodEventJob<ClientProxyUnknown>(this,
|
||||
&ClientProxyUnknown::handleDisconnect));
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::removeHandlers()
|
||||
ClientProxyUnknown::removeHandlers()
|
||||
{
|
||||
if (m_stream != NULL) {
|
||||
m_events->removeHandler(m_events->forIStream().inputReady(),
|
||||
@@ -153,29 +153,29 @@ CClientProxyUnknown::removeHandlers()
|
||||
m_stream->getEventTarget());
|
||||
}
|
||||
if (m_proxy != NULL) {
|
||||
m_events->removeHandler(m_events->forCClientProxy().ready(),
|
||||
m_events->removeHandler(m_events->forClientProxy().ready(),
|
||||
m_proxy);
|
||||
m_events->removeHandler(m_events->forCClientProxy().disconnected(),
|
||||
m_events->removeHandler(m_events->forClientProxy().disconnected(),
|
||||
m_proxy);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::removeTimer()
|
||||
ClientProxyUnknown::removeTimer()
|
||||
{
|
||||
if (m_timer != NULL) {
|
||||
m_events->deleteTimer(m_timer);
|
||||
m_events->removeHandler(CEvent::kTimer, this);
|
||||
m_events->removeHandler(Event::kTimer, this);
|
||||
m_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::handleData(const CEvent&, void*)
|
||||
ClientProxyUnknown::handleData(const Event&, void*)
|
||||
{
|
||||
LOG((CLOG_DEBUG1 "parsing hello reply"));
|
||||
|
||||
CString name("<unknown>");
|
||||
String name("<unknown>");
|
||||
try {
|
||||
// limit the maximum length of the hello
|
||||
UInt32 n = m_stream->getSize();
|
||||
@@ -186,7 +186,7 @@ CClientProxyUnknown::handleData(const CEvent&, void*)
|
||||
|
||||
// parse the reply to hello
|
||||
SInt16 major, minor;
|
||||
if (!CProtocolUtil::readf(m_stream, kMsgHelloBack,
|
||||
if (!ProtocolUtil::readf(m_stream, kMsgHelloBack,
|
||||
&major, &minor, &name)) {
|
||||
throw XBadClient();
|
||||
}
|
||||
@@ -205,27 +205,27 @@ CClientProxyUnknown::handleData(const CEvent&, void*)
|
||||
if (major == 1) {
|
||||
switch (minor) {
|
||||
case 0:
|
||||
m_proxy = new CClientProxy1_0(name, m_stream, m_events);
|
||||
m_proxy = new ClientProxy1_0(name, m_stream, m_events);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
m_proxy = new CClientProxy1_1(name, m_stream, m_events);
|
||||
m_proxy = new ClientProxy1_1(name, m_stream, m_events);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_proxy = new CClientProxy1_2(name, m_stream, m_events);
|
||||
m_proxy = new ClientProxy1_2(name, m_stream, m_events);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
m_proxy = new CClientProxy1_3(name, m_stream, m_events);
|
||||
m_proxy = new ClientProxy1_3(name, m_stream, m_events);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
m_proxy = new CClientProxy1_4(name, m_stream, m_server, m_events);
|
||||
m_proxy = new ClientProxy1_4(name, m_stream, m_server, m_events);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
m_proxy = new CClientProxy1_5(name, m_stream, m_server, m_events);
|
||||
m_proxy = new ClientProxy1_5(name, m_stream, m_server, m_events);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -246,14 +246,14 @@ CClientProxyUnknown::handleData(const CEvent&, void*)
|
||||
catch (XIncompatibleClient& e) {
|
||||
// client is incompatible
|
||||
LOG((CLOG_WARN "client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor()));
|
||||
CProtocolUtil::writef(m_stream,
|
||||
ProtocolUtil::writef(m_stream,
|
||||
kMsgEIncompatible,
|
||||
kProtocolMajorVersion, kProtocolMinorVersion);
|
||||
}
|
||||
catch (XBadClient&) {
|
||||
// client not behaving
|
||||
LOG((CLOG_WARN "protocol error from client \"%s\"", name.c_str()));
|
||||
CProtocolUtil::writef(m_stream, kMsgEBad);
|
||||
ProtocolUtil::writef(m_stream, kMsgEBad);
|
||||
}
|
||||
catch (XBase& e) {
|
||||
// misc error
|
||||
@@ -263,28 +263,28 @@ CClientProxyUnknown::handleData(const CEvent&, void*)
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::handleWriteError(const CEvent&, void*)
|
||||
ClientProxyUnknown::handleWriteError(const Event&, void*)
|
||||
{
|
||||
LOG((CLOG_NOTE "error communicating with new client"));
|
||||
sendFailure();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::handleTimeout(const CEvent&, void*)
|
||||
ClientProxyUnknown::handleTimeout(const Event&, void*)
|
||||
{
|
||||
LOG((CLOG_NOTE "new client is unresponsive"));
|
||||
sendFailure();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::handleDisconnect(const CEvent&, void*)
|
||||
ClientProxyUnknown::handleDisconnect(const Event&, void*)
|
||||
{
|
||||
LOG((CLOG_NOTE "new client disconnected"));
|
||||
sendFailure();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxyUnknown::handleReady(const CEvent&, void*)
|
||||
ClientProxyUnknown::handleReady(const Event&, void*)
|
||||
{
|
||||
sendSuccess();
|
||||
}
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include "base/Event.h"
|
||||
#include "base/EventTypes.h"
|
||||
|
||||
class CClientProxy;
|
||||
class CEventQueueTimer;
|
||||
class ClientProxy;
|
||||
class EventQueueTimer;
|
||||
namespace synergy { class IStream; }
|
||||
class CServer;
|
||||
class Server;
|
||||
class IEventQueue;
|
||||
|
||||
class CClientProxyUnknown {
|
||||
class ClientProxyUnknown {
|
||||
public:
|
||||
CClientProxyUnknown(synergy::IStream* stream, double timeout, CServer* server, IEventQueue* events);
|
||||
~CClientProxyUnknown();
|
||||
ClientProxyUnknown(synergy::IStream* stream, double timeout, Server* server, IEventQueue* events);
|
||||
~ClientProxyUnknown();
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
(i.e. when this object sends a success event). Returns NULL
|
||||
if the handshake is unsuccessful or incomplete.
|
||||
*/
|
||||
CClientProxy* orphanClientProxy();
|
||||
ClientProxy* orphanClientProxy();
|
||||
|
||||
//@}
|
||||
|
||||
@@ -52,17 +52,17 @@ private:
|
||||
void addProxyHandlers();
|
||||
void removeHandlers();
|
||||
void removeTimer();
|
||||
void handleData(const CEvent&, void*);
|
||||
void handleWriteError(const CEvent&, void*);
|
||||
void handleTimeout(const CEvent&, void*);
|
||||
void handleDisconnect(const CEvent&, void*);
|
||||
void handleReady(const CEvent&, void*);
|
||||
void handleData(const Event&, void*);
|
||||
void handleWriteError(const Event&, void*);
|
||||
void handleTimeout(const Event&, void*);
|
||||
void handleDisconnect(const Event&, void*);
|
||||
void handleReady(const Event&, void*);
|
||||
|
||||
private:
|
||||
synergy::IStream* m_stream;
|
||||
CEventQueueTimer* m_timer;
|
||||
CClientProxy* m_proxy;
|
||||
EventQueueTimer* m_timer;
|
||||
ClientProxy* m_proxy;
|
||||
bool m_ready;
|
||||
CServer* m_server;
|
||||
Server* m_server;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,18 +30,18 @@
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
class CConfig;
|
||||
class CConfigReadContext;
|
||||
class Config;
|
||||
class ConfigReadContext;
|
||||
class IEventQueue;
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
struct iterator_traits<CConfig> {
|
||||
typedef CString value_type;
|
||||
struct iterator_traits<Config> {
|
||||
typedef String value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef CString* pointer;
|
||||
typedef CString& reference;
|
||||
typedef String* pointer;
|
||||
typedef String& reference;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -55,23 +55,23 @@ Note that case is preserved in screen names but is ignored when
|
||||
comparing names. Screen names and their aliases share a
|
||||
namespace and must be unique.
|
||||
*/
|
||||
class CConfig {
|
||||
class Config {
|
||||
public:
|
||||
typedef std::map<OptionID, OptionValue> CScreenOptions;
|
||||
typedef std::pair<float, float> CInterval;
|
||||
typedef std::map<OptionID, OptionValue> ScreenOptions;
|
||||
typedef std::pair<float, float> Interval;
|
||||
|
||||
class CCellEdge {
|
||||
class CellEdge {
|
||||
public:
|
||||
CCellEdge(EDirection side, float position);
|
||||
CCellEdge(EDirection side, const CInterval&);
|
||||
CCellEdge(const CString& name, EDirection side, const CInterval&);
|
||||
~CCellEdge();
|
||||
CellEdge(EDirection side, float position);
|
||||
CellEdge(EDirection side, const Interval&);
|
||||
CellEdge(const String& name, EDirection side, const Interval&);
|
||||
~CellEdge();
|
||||
|
||||
CInterval getInterval() const;
|
||||
void setName(const CString& newName);
|
||||
CString getName() const;
|
||||
Interval getInterval() const;
|
||||
void setName(const String& newName);
|
||||
String getName() const;
|
||||
EDirection getSide() const;
|
||||
bool overlaps(const CCellEdge&) const;
|
||||
bool overlaps(const CellEdge&) const;
|
||||
bool isInside(float x) const;
|
||||
|
||||
// transform position to [0,1]
|
||||
@@ -81,73 +81,73 @@ public:
|
||||
float inverseTransform(float x) const;
|
||||
|
||||
// compares side and start of interval
|
||||
bool operator<(const CCellEdge&) const;
|
||||
bool operator<(const CellEdge&) const;
|
||||
|
||||
// compares side and interval
|
||||
bool operator==(const CCellEdge&) const;
|
||||
bool operator!=(const CCellEdge&) const;
|
||||
bool operator==(const CellEdge&) const;
|
||||
bool operator!=(const CellEdge&) const;
|
||||
|
||||
private:
|
||||
void init(const CString& name, EDirection side,
|
||||
const CInterval&);
|
||||
void init(const String& name, EDirection side,
|
||||
const Interval&);
|
||||
|
||||
private:
|
||||
CString m_name;
|
||||
String m_name;
|
||||
EDirection m_side;
|
||||
CInterval m_interval;
|
||||
Interval m_interval;
|
||||
};
|
||||
|
||||
private:
|
||||
class CName {
|
||||
class Name {
|
||||
public:
|
||||
CName(CConfig*, const CString& name);
|
||||
Name(Config*, const String& name);
|
||||
|
||||
bool operator==(const CString& name) const;
|
||||
bool operator==(const String& name) const;
|
||||
|
||||
private:
|
||||
CConfig* m_config;
|
||||
CString m_name;
|
||||
Config* m_config;
|
||||
String m_name;
|
||||
};
|
||||
|
||||
class CCell {
|
||||
class Cell {
|
||||
private:
|
||||
typedef std::map<CCellEdge, CCellEdge> CEdgeLinks;
|
||||
typedef std::map<CellEdge, CellEdge> EdgeLinks;
|
||||
|
||||
public:
|
||||
typedef CEdgeLinks::const_iterator const_iterator;
|
||||
typedef EdgeLinks::const_iterator const_iterator;
|
||||
|
||||
bool add(const CCellEdge& src, const CCellEdge& dst);
|
||||
bool add(const CellEdge& src, const CellEdge& dst);
|
||||
void remove(EDirection side);
|
||||
void remove(EDirection side, float position);
|
||||
void remove(const CName& destinationName);
|
||||
void rename(const CName& oldName, const CString& newName);
|
||||
void remove(const Name& destinationName);
|
||||
void rename(const Name& oldName, const String& newName);
|
||||
|
||||
bool hasEdge(const CCellEdge&) const;
|
||||
bool overlaps(const CCellEdge&) const;
|
||||
bool hasEdge(const CellEdge&) const;
|
||||
bool overlaps(const CellEdge&) const;
|
||||
|
||||
bool getLink(EDirection side, float position,
|
||||
const CCellEdge*& src, const CCellEdge*& dst) const;
|
||||
const CellEdge*& src, const CellEdge*& dst) const;
|
||||
|
||||
bool operator==(const CCell&) const;
|
||||
bool operator!=(const CCell&) const;
|
||||
bool operator==(const Cell&) const;
|
||||
bool operator!=(const Cell&) const;
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
private:
|
||||
CEdgeLinks m_neighbors;
|
||||
EdgeLinks m_neighbors;
|
||||
|
||||
public:
|
||||
CScreenOptions m_options;
|
||||
ScreenOptions m_options;
|
||||
};
|
||||
typedef std::map<CString, CCell, synergy::string::CaselessCmp> CCellMap;
|
||||
typedef std::map<CString, CString, synergy::string::CaselessCmp> CNameMap;
|
||||
typedef std::map<String, Cell, synergy::string::CaselessCmp> CellMap;
|
||||
typedef std::map<String, String, synergy::string::CaselessCmp> NameMap;
|
||||
|
||||
public:
|
||||
typedef CCell::const_iterator link_const_iterator;
|
||||
typedef CCellMap::const_iterator internal_const_iterator;
|
||||
typedef CNameMap::const_iterator all_const_iterator;
|
||||
class const_iterator : std::iterator_traits<CConfig> {
|
||||
typedef Cell::const_iterator link_const_iterator;
|
||||
typedef CellMap::const_iterator internal_const_iterator;
|
||||
typedef NameMap::const_iterator all_const_iterator;
|
||||
class const_iterator : std::iterator_traits<Config> {
|
||||
public:
|
||||
explicit const_iterator() : m_i() { }
|
||||
explicit const_iterator(const internal_const_iterator& i) : m_i(i) { }
|
||||
@@ -156,8 +156,8 @@ public:
|
||||
m_i = i.m_i;
|
||||
return *this;
|
||||
}
|
||||
CString operator*() { return m_i->first; }
|
||||
const CString* operator->() { return &(m_i->first); }
|
||||
String operator*() { return m_i->first; }
|
||||
const String* operator->() { return &(m_i->first); }
|
||||
const_iterator& operator++() { ++m_i; return *this; }
|
||||
const_iterator operator++(int) { return const_iterator(m_i++); }
|
||||
const_iterator& operator--() { --m_i; return *this; }
|
||||
@@ -173,11 +173,11 @@ public:
|
||||
internal_const_iterator m_i;
|
||||
};
|
||||
|
||||
CConfig(IEventQueue* events);
|
||||
virtual ~CConfig();
|
||||
Config(IEventQueue* events);
|
||||
virtual ~Config();
|
||||
|
||||
#ifdef TEST_ENV
|
||||
CConfig() : m_inputFilter(NULL) { }
|
||||
Config() : m_inputFilter(NULL) { }
|
||||
#endif
|
||||
|
||||
//! @name manipulators
|
||||
@@ -188,15 +188,15 @@ public:
|
||||
Adds a screen, returning true iff successful. If a screen or
|
||||
alias with the given name exists then it fails.
|
||||
*/
|
||||
bool addScreen(const CString& name);
|
||||
bool addScreen(const String& name);
|
||||
|
||||
//! Rename screen
|
||||
/*!
|
||||
Renames a screen. All references to the name are updated.
|
||||
Returns true iff successful.
|
||||
*/
|
||||
bool renameScreen(const CString& oldName,
|
||||
const CString& newName);
|
||||
bool renameScreen(const String& oldName,
|
||||
const String& newName);
|
||||
|
||||
//! Remove screen
|
||||
/*!
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
disconnects any connections to the screen. \c name may be an
|
||||
alias.
|
||||
*/
|
||||
void removeScreen(const CString& name);
|
||||
void removeScreen(const String& name);
|
||||
|
||||
//! Remove all screens
|
||||
/*!
|
||||
@@ -219,22 +219,22 @@ public:
|
||||
Returns false if the alias name already exists or the canonical
|
||||
name is unknown, otherwise returns true.
|
||||
*/
|
||||
bool addAlias(const CString& canonical,
|
||||
const CString& alias);
|
||||
bool addAlias(const String& canonical,
|
||||
const String& alias);
|
||||
|
||||
//! Remove alias
|
||||
/*!
|
||||
Removes an alias for a screen name. It returns false if the
|
||||
alias is unknown or a canonical name, otherwise returns true.
|
||||
*/
|
||||
bool removeAlias(const CString& alias);
|
||||
bool removeAlias(const String& alias);
|
||||
|
||||
//! Remove aliases
|
||||
/*!
|
||||
Removes all aliases for a canonical screen name. It returns false
|
||||
if the canonical name is unknown, otherwise returns true.
|
||||
*/
|
||||
bool removeAliases(const CString& canonical);
|
||||
bool removeAliases(const String& canonical);
|
||||
|
||||
//! Remove all aliases
|
||||
/*!
|
||||
@@ -258,10 +258,10 @@ public:
|
||||
and all of \c srcStart, \c srcEnd, \c dstStart, or \c dstEnd must
|
||||
be inside the range [0,1].
|
||||
*/
|
||||
bool connect(const CString& srcName,
|
||||
bool connect(const String& srcName,
|
||||
EDirection srcSide,
|
||||
float srcStart, float srcEnd,
|
||||
const CString& dstName,
|
||||
const String& dstName,
|
||||
float dstStart, float dstEnd);
|
||||
|
||||
//! Disconnect screens
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
Removes all connections created by connect() on side \c srcSide.
|
||||
Returns false if \c srcName is unknown.
|
||||
*/
|
||||
bool disconnect(const CString& srcName,
|
||||
bool disconnect(const String& srcName,
|
||||
EDirection srcSide);
|
||||
|
||||
//! Disconnect screens
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
covering position \c position. Returns false if \c srcName is
|
||||
unknown.
|
||||
*/
|
||||
bool disconnect(const CString& srcName,
|
||||
bool disconnect(const String& srcName,
|
||||
EDirection srcSide, float position);
|
||||
|
||||
//! Set server address
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
Set the synergy listen addresses. There is no default address so
|
||||
this must be called to run a server using this configuration.
|
||||
*/
|
||||
void setSynergyAddress(const CNetworkAddress&);
|
||||
void setSynergyAddress(const NetworkAddress&);
|
||||
|
||||
//! Add a screen option
|
||||
/*!
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
existing option's value if there is one. Returns true iff \c name
|
||||
is a known screen.
|
||||
*/
|
||||
bool addOption(const CString& name,
|
||||
bool addOption(const String& name,
|
||||
OptionID option, OptionValue value);
|
||||
|
||||
//! Remove a screen option
|
||||
@@ -303,21 +303,21 @@ public:
|
||||
nothing if the option doesn't exist on the screen. Returns true
|
||||
iff \c name is a known screen.
|
||||
*/
|
||||
bool removeOption(const CString& name, OptionID option);
|
||||
bool removeOption(const String& name, OptionID option);
|
||||
|
||||
//! Remove a screen options
|
||||
/*!
|
||||
Removes all options and values from the named screen. Returns true
|
||||
iff \c name is a known screen.
|
||||
*/
|
||||
bool removeOptions(const CString& name);
|
||||
bool removeOptions(const String& name);
|
||||
|
||||
//! Get the hot key input filter
|
||||
/*!
|
||||
Returns the hot key input filter. Clients can modify hotkeys using
|
||||
that object.
|
||||
*/
|
||||
virtual CInputFilter*
|
||||
virtual InputFilter*
|
||||
getInputFilter();
|
||||
|
||||
//@}
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
/*!
|
||||
Returns true iff \c name is a valid screen name.
|
||||
*/
|
||||
bool isValidScreenName(const CString& name) const;
|
||||
bool isValidScreenName(const String& name) const;
|
||||
|
||||
//! Get beginning (canonical) screen name iterator
|
||||
const_iterator begin() const;
|
||||
@@ -344,20 +344,20 @@ public:
|
||||
/*!
|
||||
Returns true iff \c name names a screen.
|
||||
*/
|
||||
virtual bool isScreen(const CString& name) const;
|
||||
virtual bool isScreen(const String& name) const;
|
||||
|
||||
//! Test for canonical screen name
|
||||
/*!
|
||||
Returns true iff \c name is the canonical name of a screen.
|
||||
*/
|
||||
bool isCanonicalName(const CString& name) const;
|
||||
bool isCanonicalName(const String& name) const;
|
||||
|
||||
//! Get canonical name
|
||||
/*!
|
||||
Returns the canonical name of a screen or the empty string if
|
||||
the name is unknown. Returns the canonical name if one is given.
|
||||
*/
|
||||
CString getCanonicalName(const CString& name) const;
|
||||
String getCanonicalName(const String& name) const;
|
||||
|
||||
//! Get neighbor
|
||||
/*!
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
saves the position on the neighbor in \c positionOut if it's not
|
||||
\c NULL.
|
||||
*/
|
||||
CString getNeighbor(const CString&, EDirection,
|
||||
String getNeighbor(const String&, EDirection,
|
||||
float position, float* positionOut) const;
|
||||
|
||||
//! Check for neighbor
|
||||
@@ -375,23 +375,23 @@ public:
|
||||
Returns \c true if the screen has a neighbor anywhere along the edge
|
||||
given by the direction.
|
||||
*/
|
||||
bool hasNeighbor(const CString&, EDirection) const;
|
||||
bool hasNeighbor(const String&, EDirection) const;
|
||||
|
||||
//! Check for neighbor
|
||||
/*!
|
||||
Returns \c true if the screen has a neighbor in the given range along
|
||||
the edge given by the direction.
|
||||
*/
|
||||
bool hasNeighbor(const CString&, EDirection,
|
||||
bool hasNeighbor(const String&, EDirection,
|
||||
float start, float end) const;
|
||||
|
||||
//! Get beginning neighbor iterator
|
||||
link_const_iterator beginNeighbor(const CString&) const;
|
||||
link_const_iterator beginNeighbor(const String&) const;
|
||||
//! Get ending neighbor iterator
|
||||
link_const_iterator endNeighbor(const CString&) const;
|
||||
link_const_iterator endNeighbor(const String&) const;
|
||||
|
||||
//! Get the server address
|
||||
const CNetworkAddress& getSynergyAddress() const;
|
||||
const NetworkAddress& getSynergyAddress() const;
|
||||
|
||||
//! Get the screen options
|
||||
/*!
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
if the screen is unknown and an empty collection if there are no
|
||||
options.
|
||||
*/
|
||||
const CScreenOptions* getOptions(const CString& name) const;
|
||||
const ScreenOptions* getOptions(const String& name) const;
|
||||
|
||||
//! Check for lock to screen action
|
||||
/*!
|
||||
@@ -409,28 +409,28 @@ public:
|
||||
bool hasLockToScreenAction() const;
|
||||
|
||||
//! Compare configurations
|
||||
bool operator==(const CConfig&) const;
|
||||
bool operator==(const Config&) const;
|
||||
//! Compare configurations
|
||||
bool operator!=(const CConfig&) const;
|
||||
bool operator!=(const Config&) const;
|
||||
|
||||
//! Read configuration
|
||||
/*!
|
||||
Reads a configuration from a context. Throws XConfigRead on error
|
||||
and context is unchanged.
|
||||
*/
|
||||
void read(CConfigReadContext& context);
|
||||
void read(ConfigReadContext& context);
|
||||
|
||||
//! Read configuration
|
||||
/*!
|
||||
Reads a configuration from a stream. Throws XConfigRead on error.
|
||||
*/
|
||||
friend std::istream& operator>>(std::istream&, CConfig&);
|
||||
friend std::istream& operator>>(std::istream&, Config&);
|
||||
|
||||
//! Write configuration
|
||||
/*!
|
||||
Writes a configuration to a stream.
|
||||
*/
|
||||
friend std::ostream& operator<<(std::ostream&, const CConfig&);
|
||||
friend std::ostream& operator<<(std::ostream&, const Config&);
|
||||
|
||||
//! Get direction name
|
||||
/*!
|
||||
@@ -442,37 +442,37 @@ public:
|
||||
/*!
|
||||
Returns an interval as a parseable string.
|
||||
*/
|
||||
static CString formatInterval(const CInterval&);
|
||||
static String formatInterval(const Interval&);
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
void readSection(CConfigReadContext&);
|
||||
void readSectionOptions(CConfigReadContext&);
|
||||
void readSectionScreens(CConfigReadContext&);
|
||||
void readSectionLinks(CConfigReadContext&);
|
||||
void readSectionAliases(CConfigReadContext&);
|
||||
void readSection(ConfigReadContext&);
|
||||
void readSectionOptions(ConfigReadContext&);
|
||||
void readSectionScreens(ConfigReadContext&);
|
||||
void readSectionLinks(ConfigReadContext&);
|
||||
void readSectionAliases(ConfigReadContext&);
|
||||
|
||||
CInputFilter::CCondition*
|
||||
parseCondition(CConfigReadContext&,
|
||||
const CString& condition,
|
||||
const std::vector<CString>& args);
|
||||
void parseAction(CConfigReadContext&,
|
||||
const CString& action,
|
||||
const std::vector<CString>& args,
|
||||
CInputFilter::CRule&, bool activate);
|
||||
InputFilter::Condition*
|
||||
parseCondition(ConfigReadContext&,
|
||||
const String& condition,
|
||||
const std::vector<String>& args);
|
||||
void parseAction(ConfigReadContext&,
|
||||
const String& action,
|
||||
const std::vector<String>& args,
|
||||
InputFilter::Rule&, bool activate);
|
||||
|
||||
void parseScreens(CConfigReadContext&, const CString&,
|
||||
std::set<CString>& screens) const;
|
||||
void parseScreens(ConfigReadContext&, const String&,
|
||||
std::set<String>& screens) const;
|
||||
static const char* getOptionName(OptionID);
|
||||
static CString getOptionValue(OptionID, OptionValue);
|
||||
static String getOptionValue(OptionID, OptionValue);
|
||||
|
||||
private:
|
||||
CCellMap m_map;
|
||||
CNameMap m_nameToCanonicalName;
|
||||
CNetworkAddress m_synergyAddress;
|
||||
CScreenOptions m_globalOptions;
|
||||
CInputFilter m_inputFilter;
|
||||
CellMap m_map;
|
||||
NameMap m_nameToCanonicalName;
|
||||
NetworkAddress m_synergyAddress;
|
||||
ScreenOptions m_globalOptions;
|
||||
InputFilter m_inputFilter;
|
||||
bool m_hasLockToScreenAction;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
@@ -481,44 +481,44 @@ private:
|
||||
/*!
|
||||
Maintains a context when reading a configuration from a stream.
|
||||
*/
|
||||
class CConfigReadContext {
|
||||
class ConfigReadContext {
|
||||
public:
|
||||
typedef std::vector<CString> ArgList;
|
||||
typedef std::vector<String> ArgList;
|
||||
|
||||
CConfigReadContext(std::istream&, SInt32 firstLine = 1);
|
||||
~CConfigReadContext();
|
||||
ConfigReadContext(std::istream&, SInt32 firstLine = 1);
|
||||
~ConfigReadContext();
|
||||
|
||||
bool readLine(CString&);
|
||||
bool readLine(String&);
|
||||
UInt32 getLineNumber() const;
|
||||
|
||||
bool operator!() const;
|
||||
|
||||
OptionValue parseBoolean(const CString&) const;
|
||||
OptionValue parseInt(const CString&) const;
|
||||
OptionValue parseModifierKey(const CString&) const;
|
||||
OptionValue parseCorner(const CString&) const;
|
||||
OptionValue parseCorners(const CString&) const;
|
||||
CConfig::CInterval
|
||||
OptionValue parseBoolean(const String&) const;
|
||||
OptionValue parseInt(const String&) const;
|
||||
OptionValue parseModifierKey(const String&) const;
|
||||
OptionValue parseCorner(const String&) const;
|
||||
OptionValue parseCorners(const String&) const;
|
||||
Config::Interval
|
||||
parseInterval(const ArgList& args) const;
|
||||
void parseNameWithArgs(
|
||||
const CString& type, const CString& line,
|
||||
const CString& delim, CString::size_type& index,
|
||||
CString& name, ArgList& args) const;
|
||||
IPlatformScreen::CKeyInfo*
|
||||
parseKeystroke(const CString& keystroke) const;
|
||||
IPlatformScreen::CKeyInfo*
|
||||
parseKeystroke(const CString& keystroke,
|
||||
const std::set<CString>& screens) const;
|
||||
IPlatformScreen::CButtonInfo*
|
||||
parseMouse(const CString& mouse) const;
|
||||
KeyModifierMask parseModifier(const CString& modifiers) const;
|
||||
const String& type, const String& line,
|
||||
const String& delim, String::size_type& index,
|
||||
String& name, ArgList& args) const;
|
||||
IPlatformScreen::KeyInfo*
|
||||
parseKeystroke(const String& keystroke) const;
|
||||
IPlatformScreen::KeyInfo*
|
||||
parseKeystroke(const String& keystroke,
|
||||
const std::set<String>& screens) const;
|
||||
IPlatformScreen::ButtonInfo*
|
||||
parseMouse(const String& mouse) const;
|
||||
KeyModifierMask parseModifier(const String& modifiers) const;
|
||||
std::istream& getStream() const { return m_stream; };
|
||||
|
||||
private:
|
||||
// not implemented
|
||||
CConfigReadContext& operator=(const CConfigReadContext&);
|
||||
ConfigReadContext& operator=(const ConfigReadContext&);
|
||||
|
||||
static CString concatArgs(const ArgList& args);
|
||||
static String concatArgs(const ArgList& args);
|
||||
|
||||
private:
|
||||
std::istream& m_stream;
|
||||
@@ -531,15 +531,15 @@ Thrown when a configuration stream cannot be parsed.
|
||||
*/
|
||||
class XConfigRead : public XBase {
|
||||
public:
|
||||
XConfigRead(const CConfigReadContext& context, const CString&);
|
||||
XConfigRead(const CConfigReadContext& context,
|
||||
const char* errorFmt, const CString& arg);
|
||||
XConfigRead(const ConfigReadContext& context, const String&);
|
||||
XConfigRead(const ConfigReadContext& context,
|
||||
const char* errorFmt, const String& arg);
|
||||
virtual ~XConfigRead() _NOEXCEPT;
|
||||
|
||||
protected:
|
||||
// XBase overrides
|
||||
virtual CString getWhat() const throw();
|
||||
virtual String getWhat() const throw();
|
||||
|
||||
private:
|
||||
CString m_error;
|
||||
String m_error;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,11 +26,11 @@
|
||||
#include "common/stdmap.h"
|
||||
#include "common/stdset.h"
|
||||
|
||||
class CPrimaryClient;
|
||||
class CEvent;
|
||||
class PrimaryClient;
|
||||
class Event;
|
||||
class IEventQueue;
|
||||
|
||||
class CInputFilter {
|
||||
class InputFilter {
|
||||
public:
|
||||
// -------------------------------------------------------------------------
|
||||
// Input Filter Condition Classes
|
||||
@@ -41,36 +41,36 @@ public:
|
||||
kDeactivate
|
||||
};
|
||||
|
||||
class CCondition {
|
||||
class Condition {
|
||||
public:
|
||||
CCondition();
|
||||
virtual ~CCondition();
|
||||
Condition();
|
||||
virtual ~Condition();
|
||||
|
||||
virtual CCondition* clone() const = 0;
|
||||
virtual CString format() const = 0;
|
||||
virtual Condition* clone() const = 0;
|
||||
virtual String format() const = 0;
|
||||
|
||||
virtual EFilterStatus match(const CEvent&) = 0;
|
||||
virtual EFilterStatus match(const Event&) = 0;
|
||||
|
||||
virtual void enablePrimary(CPrimaryClient*);
|
||||
virtual void disablePrimary(CPrimaryClient*);
|
||||
virtual void enablePrimary(PrimaryClient*);
|
||||
virtual void disablePrimary(PrimaryClient*);
|
||||
};
|
||||
|
||||
// CKeystrokeCondition
|
||||
class CKeystrokeCondition : public CCondition {
|
||||
// KeystrokeCondition
|
||||
class KeystrokeCondition : public Condition {
|
||||
public:
|
||||
CKeystrokeCondition(IEventQueue* events, IPlatformScreen::CKeyInfo*);
|
||||
CKeystrokeCondition(IEventQueue* events, KeyID key, KeyModifierMask mask);
|
||||
virtual ~CKeystrokeCondition();
|
||||
KeystrokeCondition(IEventQueue* events, IPlatformScreen::KeyInfo*);
|
||||
KeystrokeCondition(IEventQueue* events, KeyID key, KeyModifierMask mask);
|
||||
virtual ~KeystrokeCondition();
|
||||
|
||||
KeyID getKey() const;
|
||||
KeyModifierMask getMask() const;
|
||||
|
||||
// CCondition overrides
|
||||
virtual CCondition* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual EFilterStatus match(const CEvent&);
|
||||
virtual void enablePrimary(CPrimaryClient*);
|
||||
virtual void disablePrimary(CPrimaryClient*);
|
||||
// Condition overrides
|
||||
virtual Condition* clone() const;
|
||||
virtual String format() const;
|
||||
virtual EFilterStatus match(const Event&);
|
||||
virtual void enablePrimary(PrimaryClient*);
|
||||
virtual void disablePrimary(PrimaryClient*);
|
||||
|
||||
private:
|
||||
UInt32 m_id;
|
||||
@@ -79,20 +79,20 @@ public:
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CMouseButtonCondition
|
||||
class CMouseButtonCondition : public CCondition {
|
||||
// MouseButtonCondition
|
||||
class MouseButtonCondition : public Condition {
|
||||
public:
|
||||
CMouseButtonCondition(IEventQueue* events, IPlatformScreen::CButtonInfo*);
|
||||
CMouseButtonCondition(IEventQueue* events, ButtonID, KeyModifierMask mask);
|
||||
virtual ~CMouseButtonCondition();
|
||||
MouseButtonCondition(IEventQueue* events, IPlatformScreen::ButtonInfo*);
|
||||
MouseButtonCondition(IEventQueue* events, ButtonID, KeyModifierMask mask);
|
||||
virtual ~MouseButtonCondition();
|
||||
|
||||
ButtonID getButton() const;
|
||||
KeyModifierMask getMask() const;
|
||||
|
||||
// CCondition overrides
|
||||
virtual CCondition* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual EFilterStatus match(const CEvent&);
|
||||
// Condition overrides
|
||||
virtual Condition* clone() const;
|
||||
virtual String format() const;
|
||||
virtual EFilterStatus match(const Event&);
|
||||
|
||||
private:
|
||||
ButtonID m_button;
|
||||
@@ -100,19 +100,19 @@ public:
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CScreenConnectedCondition
|
||||
class CScreenConnectedCondition : public CCondition {
|
||||
// ScreenConnectedCondition
|
||||
class ScreenConnectedCondition : public Condition {
|
||||
public:
|
||||
CScreenConnectedCondition(IEventQueue* events, const CString& screen);
|
||||
virtual ~CScreenConnectedCondition();
|
||||
ScreenConnectedCondition(IEventQueue* events, const String& screen);
|
||||
virtual ~ScreenConnectedCondition();
|
||||
|
||||
// CCondition overrides
|
||||
virtual CCondition* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual EFilterStatus match(const CEvent&);
|
||||
// Condition overrides
|
||||
virtual Condition* clone() const;
|
||||
virtual String format() const;
|
||||
virtual EFilterStatus match(const Event&);
|
||||
|
||||
private:
|
||||
CString m_screen;
|
||||
String m_screen;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
@@ -120,242 +120,242 @@ public:
|
||||
// Input Filter Action Classes
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
class CAction {
|
||||
class Action {
|
||||
public:
|
||||
CAction();
|
||||
virtual ~CAction();
|
||||
Action();
|
||||
virtual ~Action();
|
||||
|
||||
virtual CAction* clone() const = 0;
|
||||
virtual CString format() const = 0;
|
||||
virtual Action* clone() const = 0;
|
||||
virtual String format() const = 0;
|
||||
|
||||
virtual void perform(const CEvent&) = 0;
|
||||
virtual void perform(const Event&) = 0;
|
||||
};
|
||||
|
||||
// CLockCursorToScreenAction
|
||||
class CLockCursorToScreenAction : public CAction {
|
||||
// LockCursorToScreenAction
|
||||
class LockCursorToScreenAction : public Action {
|
||||
public:
|
||||
enum Mode { kOff, kOn, kToggle };
|
||||
|
||||
CLockCursorToScreenAction(IEventQueue* events, Mode = kToggle);
|
||||
LockCursorToScreenAction(IEventQueue* events, Mode = kToggle);
|
||||
|
||||
Mode getMode() const;
|
||||
|
||||
// CAction overrides
|
||||
virtual CAction* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual void perform(const CEvent&);
|
||||
// Action overrides
|
||||
virtual Action* clone() const;
|
||||
virtual String format() const;
|
||||
virtual void perform(const Event&);
|
||||
|
||||
private:
|
||||
Mode m_mode;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CSwitchToScreenAction
|
||||
class CSwitchToScreenAction : public CAction {
|
||||
// SwitchToScreenAction
|
||||
class SwitchToScreenAction : public Action {
|
||||
public:
|
||||
CSwitchToScreenAction(IEventQueue* events, const CString& screen);
|
||||
SwitchToScreenAction(IEventQueue* events, const String& screen);
|
||||
|
||||
CString getScreen() const;
|
||||
String getScreen() const;
|
||||
|
||||
// CAction overrides
|
||||
virtual CAction* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual void perform(const CEvent&);
|
||||
// Action overrides
|
||||
virtual Action* clone() const;
|
||||
virtual String format() const;
|
||||
virtual void perform(const Event&);
|
||||
|
||||
private:
|
||||
CString m_screen;
|
||||
String m_screen;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CSwitchInDirectionAction
|
||||
class CSwitchInDirectionAction : public CAction {
|
||||
// SwitchInDirectionAction
|
||||
class SwitchInDirectionAction : public Action {
|
||||
public:
|
||||
CSwitchInDirectionAction(IEventQueue* events, EDirection);
|
||||
SwitchInDirectionAction(IEventQueue* events, EDirection);
|
||||
|
||||
EDirection getDirection() const;
|
||||
|
||||
// CAction overrides
|
||||
virtual CAction* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual void perform(const CEvent&);
|
||||
// Action overrides
|
||||
virtual Action* clone() const;
|
||||
virtual String format() const;
|
||||
virtual void perform(const Event&);
|
||||
|
||||
private:
|
||||
EDirection m_direction;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CKeyboardBroadcastAction
|
||||
class CKeyboardBroadcastAction : public CAction {
|
||||
// KeyboardBroadcastAction
|
||||
class KeyboardBroadcastAction : public Action {
|
||||
public:
|
||||
enum Mode { kOff, kOn, kToggle };
|
||||
|
||||
CKeyboardBroadcastAction(IEventQueue* events, Mode = kToggle);
|
||||
CKeyboardBroadcastAction(IEventQueue* events, Mode, const std::set<CString>& screens);
|
||||
KeyboardBroadcastAction(IEventQueue* events, Mode = kToggle);
|
||||
KeyboardBroadcastAction(IEventQueue* events, Mode, const std::set<String>& screens);
|
||||
|
||||
Mode getMode() const;
|
||||
std::set<CString> getScreens() const;
|
||||
std::set<String> getScreens() const;
|
||||
|
||||
// CAction overrides
|
||||
virtual CAction* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual void perform(const CEvent&);
|
||||
// Action overrides
|
||||
virtual Action* clone() const;
|
||||
virtual String format() const;
|
||||
virtual void perform(const Event&);
|
||||
|
||||
private:
|
||||
Mode m_mode;
|
||||
CString m_screens;
|
||||
String m_screens;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CKeystrokeAction
|
||||
class CKeystrokeAction : public CAction {
|
||||
// KeystrokeAction
|
||||
class KeystrokeAction : public Action {
|
||||
public:
|
||||
CKeystrokeAction(IEventQueue* events, IPlatformScreen::CKeyInfo* adoptedInfo, bool press);
|
||||
~CKeystrokeAction();
|
||||
KeystrokeAction(IEventQueue* events, IPlatformScreen::KeyInfo* adoptedInfo, bool press);
|
||||
~KeystrokeAction();
|
||||
|
||||
void adoptInfo(IPlatformScreen::CKeyInfo*);
|
||||
const IPlatformScreen::CKeyInfo*
|
||||
void adoptInfo(IPlatformScreen::KeyInfo*);
|
||||
const IPlatformScreen::KeyInfo*
|
||||
getInfo() const;
|
||||
bool isOnPress() const;
|
||||
|
||||
// CAction overrides
|
||||
virtual CAction* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual void perform(const CEvent&);
|
||||
// Action overrides
|
||||
virtual Action* clone() const;
|
||||
virtual String format() const;
|
||||
virtual void perform(const Event&);
|
||||
|
||||
protected:
|
||||
virtual const char* formatName() const;
|
||||
|
||||
private:
|
||||
IPlatformScreen::CKeyInfo* m_keyInfo;
|
||||
IPlatformScreen::KeyInfo* m_keyInfo;
|
||||
bool m_press;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
// CMouseButtonAction -- modifier combinations not implemented yet
|
||||
class CMouseButtonAction : public CAction {
|
||||
// MouseButtonAction -- modifier combinations not implemented yet
|
||||
class MouseButtonAction : public Action {
|
||||
public:
|
||||
CMouseButtonAction(IEventQueue* events,
|
||||
IPlatformScreen::CButtonInfo* adoptedInfo,
|
||||
MouseButtonAction(IEventQueue* events,
|
||||
IPlatformScreen::ButtonInfo* adoptedInfo,
|
||||
bool press);
|
||||
~CMouseButtonAction();
|
||||
~MouseButtonAction();
|
||||
|
||||
const IPlatformScreen::CButtonInfo*
|
||||
const IPlatformScreen::ButtonInfo*
|
||||
getInfo() const;
|
||||
bool isOnPress() const;
|
||||
|
||||
// CAction overrides
|
||||
virtual CAction* clone() const;
|
||||
virtual CString format() const;
|
||||
virtual void perform(const CEvent&);
|
||||
// Action overrides
|
||||
virtual Action* clone() const;
|
||||
virtual String format() const;
|
||||
virtual void perform(const Event&);
|
||||
|
||||
protected:
|
||||
virtual const char* formatName() const;
|
||||
|
||||
private:
|
||||
IPlatformScreen::CButtonInfo* m_buttonInfo;
|
||||
IPlatformScreen::ButtonInfo* m_buttonInfo;
|
||||
bool m_press;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
class CRule {
|
||||
class Rule {
|
||||
public:
|
||||
CRule();
|
||||
CRule(CCondition* adopted);
|
||||
CRule(const CRule&);
|
||||
~CRule();
|
||||
Rule();
|
||||
Rule(Condition* adopted);
|
||||
Rule(const Rule&);
|
||||
~Rule();
|
||||
|
||||
CRule& operator=(const CRule&);
|
||||
Rule& operator=(const Rule&);
|
||||
|
||||
// replace the condition
|
||||
void setCondition(CCondition* adopted);
|
||||
void setCondition(Condition* adopted);
|
||||
|
||||
// add an action to the rule
|
||||
void adoptAction(CAction*, bool onActivation);
|
||||
void adoptAction(Action*, bool onActivation);
|
||||
|
||||
// remove an action from the rule
|
||||
void removeAction(bool onActivation, UInt32 index);
|
||||
|
||||
// replace an action in the rule
|
||||
void replaceAction(CAction* adopted,
|
||||
void replaceAction(Action* adopted,
|
||||
bool onActivation, UInt32 index);
|
||||
|
||||
// enable/disable
|
||||
void enable(CPrimaryClient*);
|
||||
void disable(CPrimaryClient*);
|
||||
void enable(PrimaryClient*);
|
||||
void disable(PrimaryClient*);
|
||||
|
||||
// event handling
|
||||
bool handleEvent(const CEvent&);
|
||||
bool handleEvent(const Event&);
|
||||
|
||||
// convert rule to a string
|
||||
CString format() const;
|
||||
String format() const;
|
||||
|
||||
// get the rule's condition
|
||||
const CCondition*
|
||||
const Condition*
|
||||
getCondition() const;
|
||||
|
||||
// get number of actions
|
||||
UInt32 getNumActions(bool onActivation) const;
|
||||
|
||||
// get action by index
|
||||
const CAction& getAction(bool onActivation, UInt32 index) const;
|
||||
const Action& getAction(bool onActivation, UInt32 index) const;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
void copy(const CRule&);
|
||||
void copy(const Rule&);
|
||||
|
||||
private:
|
||||
typedef std::vector<CAction*> CActionList;
|
||||
typedef std::vector<Action*> ActionList;
|
||||
|
||||
CCondition* m_condition;
|
||||
CActionList m_activateActions;
|
||||
CActionList m_deactivateActions;
|
||||
Condition* m_condition;
|
||||
ActionList m_activateActions;
|
||||
ActionList m_deactivateActions;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Input Filter Class
|
||||
// -------------------------------------------------------------------------
|
||||
typedef std::vector<CRule> CRuleList;
|
||||
typedef std::vector<Rule> RuleList;
|
||||
|
||||
CInputFilter(IEventQueue* events);
|
||||
CInputFilter(const CInputFilter&);
|
||||
virtual ~CInputFilter();
|
||||
InputFilter(IEventQueue* events);
|
||||
InputFilter(const InputFilter&);
|
||||
virtual ~InputFilter();
|
||||
|
||||
#ifdef TEST_ENV
|
||||
CInputFilter() : m_primaryClient(NULL) { }
|
||||
InputFilter() : m_primaryClient(NULL) { }
|
||||
#endif
|
||||
|
||||
CInputFilter& operator=(const CInputFilter&);
|
||||
InputFilter& operator=(const InputFilter&);
|
||||
|
||||
// add rule, adopting the condition and the actions
|
||||
void addFilterRule(const CRule& rule);
|
||||
void addFilterRule(const Rule& rule);
|
||||
|
||||
// remove a rule
|
||||
void removeFilterRule(UInt32 index);
|
||||
|
||||
// get rule by index
|
||||
CRule& getRule(UInt32 index);
|
||||
Rule& getRule(UInt32 index);
|
||||
|
||||
// enable event filtering using the given primary client. disable
|
||||
// if client is NULL.
|
||||
virtual void setPrimaryClient(CPrimaryClient* client);
|
||||
virtual void setPrimaryClient(PrimaryClient* client);
|
||||
|
||||
// convert rules to a string
|
||||
CString format(const CString& linePrefix) const;
|
||||
String format(const String& linePrefix) const;
|
||||
|
||||
// get number of rules
|
||||
UInt32 getNumRules() const;
|
||||
|
||||
//! Compare filters
|
||||
bool operator==(const CInputFilter&) const;
|
||||
bool operator==(const InputFilter&) const;
|
||||
//! Compare filters
|
||||
bool operator!=(const CInputFilter&) const;
|
||||
bool operator!=(const InputFilter&) const;
|
||||
|
||||
private:
|
||||
// event handling
|
||||
void handleEvent(const CEvent&, void*);
|
||||
void handleEvent(const Event&, void*);
|
||||
|
||||
private:
|
||||
CRuleList m_ruleList;
|
||||
CPrimaryClient* m_primaryClient;
|
||||
RuleList m_ruleList;
|
||||
PrimaryClient* m_primaryClient;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
#include "base/Log.h"
|
||||
|
||||
//
|
||||
// CPrimaryClient
|
||||
// PrimaryClient
|
||||
//
|
||||
|
||||
CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) :
|
||||
CBaseClientProxy(name),
|
||||
PrimaryClient::PrimaryClient(const String& name, Screen* screen) :
|
||||
BaseClientProxy(name),
|
||||
m_screen(screen),
|
||||
m_fakeInputCount(0)
|
||||
{
|
||||
@@ -37,31 +37,31 @@ CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) :
|
||||
}
|
||||
}
|
||||
|
||||
CPrimaryClient::~CPrimaryClient()
|
||||
PrimaryClient::~PrimaryClient()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::reconfigure(UInt32 activeSides)
|
||||
PrimaryClient::reconfigure(UInt32 activeSides)
|
||||
{
|
||||
m_screen->reconfigure(activeSides);
|
||||
}
|
||||
|
||||
UInt32
|
||||
CPrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||
PrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||
{
|
||||
return m_screen->registerHotKey(key, mask);
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::unregisterHotKey(UInt32 id)
|
||||
PrimaryClient::unregisterHotKey(UInt32 id)
|
||||
{
|
||||
m_screen->unregisterHotKey(id);
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::fakeInputBegin()
|
||||
PrimaryClient::fakeInputBegin()
|
||||
{
|
||||
if (++m_fakeInputCount == 1) {
|
||||
m_screen->fakeInputBegin();
|
||||
@@ -69,7 +69,7 @@ CPrimaryClient::fakeInputBegin()
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::fakeInputEnd()
|
||||
PrimaryClient::fakeInputEnd()
|
||||
{
|
||||
if (--m_fakeInputCount == 0) {
|
||||
m_screen->fakeInputEnd();
|
||||
@@ -77,68 +77,68 @@ CPrimaryClient::fakeInputEnd()
|
||||
}
|
||||
|
||||
SInt32
|
||||
CPrimaryClient::getJumpZoneSize() const
|
||||
PrimaryClient::getJumpZoneSize() const
|
||||
{
|
||||
return m_screen->getJumpZoneSize();
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const
|
||||
PrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const
|
||||
{
|
||||
m_screen->getCursorCenter(x, y);
|
||||
}
|
||||
|
||||
KeyModifierMask
|
||||
CPrimaryClient::getToggleMask() const
|
||||
PrimaryClient::getToggleMask() const
|
||||
{
|
||||
return m_screen->pollActiveModifiers();
|
||||
}
|
||||
|
||||
bool
|
||||
CPrimaryClient::isLockedToScreen() const
|
||||
PrimaryClient::isLockedToScreen() const
|
||||
{
|
||||
return m_screen->isLockedToScreen();
|
||||
}
|
||||
|
||||
void*
|
||||
CPrimaryClient::getEventTarget() const
|
||||
PrimaryClient::getEventTarget() const
|
||||
{
|
||||
return m_screen->getEventTarget();
|
||||
}
|
||||
|
||||
bool
|
||||
CPrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const
|
||||
PrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const
|
||||
{
|
||||
return m_screen->getClipboard(id, clipboard);
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::getShape(SInt32& x, SInt32& y,
|
||||
PrimaryClient::getShape(SInt32& x, SInt32& y,
|
||||
SInt32& width, SInt32& height) const
|
||||
{
|
||||
m_screen->getShape(x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::getCursorPos(SInt32& x, SInt32& y) const
|
||||
PrimaryClient::getCursorPos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
m_screen->getCursorPos(x, y);
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::enable()
|
||||
PrimaryClient::enable()
|
||||
{
|
||||
m_screen->enable();
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::disable()
|
||||
PrimaryClient::disable()
|
||||
{
|
||||
m_screen->disable();
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
|
||||
PrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
|
||||
UInt32 seqNum, KeyModifierMask mask, bool screensaver)
|
||||
{
|
||||
m_screen->setSequenceNumber(seqNum);
|
||||
@@ -149,13 +149,13 @@ CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
|
||||
}
|
||||
|
||||
bool
|
||||
CPrimaryClient::leave()
|
||||
PrimaryClient::leave()
|
||||
{
|
||||
return m_screen->leave();
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||
PrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||
{
|
||||
// ignore if this clipboard is already clean
|
||||
if (m_clipboardDirty[id]) {
|
||||
@@ -168,7 +168,7 @@ CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::grabClipboard(ClipboardID id)
|
||||
PrimaryClient::grabClipboard(ClipboardID id)
|
||||
{
|
||||
// grab clipboard
|
||||
m_screen->grabClipboard(id);
|
||||
@@ -178,13 +178,13 @@ CPrimaryClient::grabClipboard(ClipboardID id)
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::setClipboardDirty(ClipboardID id, bool dirty)
|
||||
PrimaryClient::setClipboardDirty(ClipboardID id, bool dirty)
|
||||
{
|
||||
m_clipboardDirty[id] = dirty;
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
PrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
if (m_fakeInputCount > 0) {
|
||||
// XXX -- don't forward keystrokes to primary screen for now
|
||||
@@ -196,13 +196,13 @@ CPrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton)
|
||||
PrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
PrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
if (m_fakeInputCount > 0) {
|
||||
// XXX -- don't forward keystrokes to primary screen for now
|
||||
@@ -214,61 +214,61 @@ CPrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::mouseDown(ButtonID)
|
||||
PrimaryClient::mouseDown(ButtonID)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::mouseUp(ButtonID)
|
||||
PrimaryClient::mouseUp(ButtonID)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::mouseMove(SInt32 x, SInt32 y)
|
||||
PrimaryClient::mouseMove(SInt32 x, SInt32 y)
|
||||
{
|
||||
m_screen->warpCursor(x, y);
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::mouseRelativeMove(SInt32, SInt32)
|
||||
PrimaryClient::mouseRelativeMove(SInt32, SInt32)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::mouseWheel(SInt32, SInt32)
|
||||
PrimaryClient::mouseWheel(SInt32, SInt32)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::screensaver(bool)
|
||||
PrimaryClient::screensaver(bool)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||
PrimaryClient::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
PrimaryClient::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::resetOptions()
|
||||
PrimaryClient::resetOptions()
|
||||
{
|
||||
m_screen->resetOptions();
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::setOptions(const COptionsList& options)
|
||||
PrimaryClient::setOptions(const OptionsList& options)
|
||||
{
|
||||
m_screen->setOptions(options);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "server/BaseClientProxy.h"
|
||||
#include "synergy/protocol_types.h"
|
||||
|
||||
class CScreen;
|
||||
class Screen;
|
||||
|
||||
//! Primary screen as pseudo-client
|
||||
/*!
|
||||
@@ -29,16 +29,16 @@ The primary screen does not have a client associated with it. This
|
||||
class provides a pseudo-client to allow the primary screen to be
|
||||
treated as if it was a client.
|
||||
*/
|
||||
class CPrimaryClient : public CBaseClientProxy {
|
||||
class PrimaryClient : public BaseClientProxy {
|
||||
public:
|
||||
/*!
|
||||
\c name is the name of the server and \p screen is primary screen.
|
||||
*/
|
||||
CPrimaryClient(const CString& name, CScreen* screen);
|
||||
~CPrimaryClient();
|
||||
PrimaryClient(const String& name, Screen* screen);
|
||||
~PrimaryClient();
|
||||
|
||||
#ifdef TEST_ENV
|
||||
CPrimaryClient() : CBaseClientProxy("") { }
|
||||
PrimaryClient() : BaseClientProxy("") { }
|
||||
#endif
|
||||
|
||||
//! @name manipulators
|
||||
@@ -142,12 +142,12 @@ public:
|
||||
virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta);
|
||||
virtual void screensaver(bool activate);
|
||||
virtual void resetOptions();
|
||||
virtual void setOptions(const COptionsList& options);
|
||||
virtual void setOptions(const OptionsList& options);
|
||||
virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size);
|
||||
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize);
|
||||
|
||||
private:
|
||||
CScreen* m_screen;
|
||||
Screen* m_screen;
|
||||
bool m_clipboardDirty[kClipboardEnd];
|
||||
SInt32 m_fakeInputCount;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,35 +32,35 @@
|
||||
#include "common/stdset.h"
|
||||
#include "common/stdvector.h"
|
||||
|
||||
class CBaseClientProxy;
|
||||
class CEventQueueTimer;
|
||||
class CPrimaryClient;
|
||||
class CInputFilter;
|
||||
class CScreen;
|
||||
class BaseClientProxy;
|
||||
class EventQueueTimer;
|
||||
class PrimaryClient;
|
||||
class InputFilter;
|
||||
class Screen;
|
||||
class IEventQueue;
|
||||
class CThread;
|
||||
class Thread;
|
||||
|
||||
//! Synergy server
|
||||
/*!
|
||||
This class implements the top-level server algorithms for synergy.
|
||||
*/
|
||||
class CServer : public INode {
|
||||
class Server : public INode {
|
||||
public:
|
||||
//! Lock cursor to screen data
|
||||
class CLockCursorToScreenInfo {
|
||||
class LockCursorToScreenInfo {
|
||||
public:
|
||||
enum State { kOff, kOn, kToggle };
|
||||
|
||||
static CLockCursorToScreenInfo* alloc(State state = kToggle);
|
||||
static LockCursorToScreenInfo* alloc(State state = kToggle);
|
||||
|
||||
public:
|
||||
State m_state;
|
||||
};
|
||||
|
||||
//! Switch to screen data
|
||||
class CSwitchToScreenInfo {
|
||||
class SwitchToScreenInfo {
|
||||
public:
|
||||
static CSwitchToScreenInfo* alloc(const CString& screen);
|
||||
static SwitchToScreenInfo* alloc(const String& screen);
|
||||
|
||||
public:
|
||||
// this is a C-string; this type is a variable size structure
|
||||
@@ -68,31 +68,31 @@ public:
|
||||
};
|
||||
|
||||
//! Switch in direction data
|
||||
class CSwitchInDirectionInfo {
|
||||
class SwitchInDirectionInfo {
|
||||
public:
|
||||
static CSwitchInDirectionInfo* alloc(EDirection direction);
|
||||
static SwitchInDirectionInfo* alloc(EDirection direction);
|
||||
|
||||
public:
|
||||
EDirection m_direction;
|
||||
};
|
||||
|
||||
//! Screen connected data
|
||||
class CScreenConnectedInfo {
|
||||
class ScreenConnectedInfo {
|
||||
public:
|
||||
CScreenConnectedInfo(CString screen) : m_screen(screen) { }
|
||||
ScreenConnectedInfo(String screen) : m_screen(screen) { }
|
||||
|
||||
public:
|
||||
CString m_screen; // was char[1]
|
||||
String m_screen; // was char[1]
|
||||
};
|
||||
|
||||
//! Keyboard broadcast data
|
||||
class CKeyboardBroadcastInfo {
|
||||
class KeyboardBroadcastInfo {
|
||||
public:
|
||||
enum State { kOff, kOn, kToggle };
|
||||
|
||||
static CKeyboardBroadcastInfo* alloc(State state = kToggle);
|
||||
static CKeyboardBroadcastInfo* alloc(State state,
|
||||
const CString& screens);
|
||||
static KeyboardBroadcastInfo* alloc(State state = kToggle);
|
||||
static KeyboardBroadcastInfo* alloc(State state,
|
||||
const String& screens);
|
||||
|
||||
public:
|
||||
State m_state;
|
||||
@@ -104,12 +104,12 @@ public:
|
||||
client (local screen) \p primaryClient. The client retains
|
||||
ownership of \p primaryClient.
|
||||
*/
|
||||
CServer(CConfig& config, CPrimaryClient* primaryClient, CScreen* screen, IEventQueue* events, bool enableDragDrop);
|
||||
~CServer();
|
||||
Server(Config& config, PrimaryClient* primaryClient, Screen* screen, IEventQueue* events, bool enableDragDrop);
|
||||
~Server();
|
||||
|
||||
#ifdef TEST_ENV
|
||||
CServer() : m_mock(true), m_config(NULL) { }
|
||||
void setActive(CBaseClientProxy* active) { m_active = active; }
|
||||
Server() : m_mock(true), m_config(NULL) { }
|
||||
void setActive(BaseClientProxy* active) { m_active = active; }
|
||||
#endif
|
||||
|
||||
//! @name manipulators
|
||||
@@ -121,14 +121,14 @@ public:
|
||||
configuration was accepted (it must include the server's name).
|
||||
This will disconnect any clients no longer in the configuration.
|
||||
*/
|
||||
bool setConfig(const CConfig&);
|
||||
bool setConfig(const Config&);
|
||||
|
||||
//! Add a client
|
||||
/*!
|
||||
Adds \p client to the server. The client is adopted and will be
|
||||
destroyed when the client disconnects or is disconnected.
|
||||
*/
|
||||
void adoptClient(CBaseClientProxy* client);
|
||||
void adoptClient(BaseClientProxy* client);
|
||||
|
||||
//! Disconnect clients
|
||||
/*!
|
||||
@@ -143,16 +143,16 @@ public:
|
||||
void clearReceivedFileData();
|
||||
|
||||
//! Set the expected size of receiving file
|
||||
void setExpectedFileSize(CString data);
|
||||
void setExpectedFileSize(String data);
|
||||
|
||||
//! Received a chunk of file data
|
||||
void fileChunkReceived(CString data);
|
||||
void fileChunkReceived(String data);
|
||||
|
||||
//! Create a new thread and use it to send file to client
|
||||
void sendFileToClient(const char* filename);
|
||||
|
||||
//! Received dragging information from client
|
||||
void dragInfoReceived(UInt32 fileNum, CString content);
|
||||
void dragInfoReceived(UInt32 fileNum, String content);
|
||||
|
||||
//@}
|
||||
//! @name accessors
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
/*!
|
||||
Set the \c list to the names of the currently connected clients.
|
||||
*/
|
||||
void getClients(std::vector<CString>& list) const;
|
||||
void getClients(std::vector<String>& list) const;
|
||||
|
||||
//! Return true if recieved file size is valid
|
||||
bool isReceivedFileSizeValid();
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
|
||||
private:
|
||||
// get canonical name of client
|
||||
CString getName(const CBaseClientProxy*) const;
|
||||
String getName(const BaseClientProxy*) const;
|
||||
|
||||
// get the sides of the primary screen that have neighbors
|
||||
UInt32 getActivePrimarySides() const;
|
||||
@@ -195,32 +195,32 @@ private:
|
||||
bool isLockedToScreen() const;
|
||||
|
||||
// returns the jump zone of the client
|
||||
SInt32 getJumpZoneSize(CBaseClientProxy*) const;
|
||||
SInt32 getJumpZoneSize(BaseClientProxy*) const;
|
||||
|
||||
// change the active screen
|
||||
void switchScreen(CBaseClientProxy*,
|
||||
void switchScreen(BaseClientProxy*,
|
||||
SInt32 x, SInt32 y, bool forScreenSaver);
|
||||
|
||||
// jump to screen
|
||||
void jumpToScreen(CBaseClientProxy*);
|
||||
void jumpToScreen(BaseClientProxy*);
|
||||
|
||||
// convert pixel position to fraction, using x or y depending on the
|
||||
// direction.
|
||||
float mapToFraction(CBaseClientProxy*, EDirection,
|
||||
float mapToFraction(BaseClientProxy*, EDirection,
|
||||
SInt32 x, SInt32 y) const;
|
||||
|
||||
// convert fraction to pixel position, writing only x or y depending
|
||||
// on the direction.
|
||||
void mapToPixel(CBaseClientProxy*, EDirection, float f,
|
||||
void mapToPixel(BaseClientProxy*, EDirection, float f,
|
||||
SInt32& x, SInt32& y) const;
|
||||
|
||||
// returns true if the client has a neighbor anywhere along the edge
|
||||
// indicated by the direction.
|
||||
bool hasAnyNeighbor(CBaseClientProxy*, EDirection) const;
|
||||
bool hasAnyNeighbor(BaseClientProxy*, EDirection) const;
|
||||
|
||||
// lookup neighboring screen, mapping the coordinate independent of
|
||||
// the direction to the neighbor's coordinate space.
|
||||
CBaseClientProxy* getNeighbor(CBaseClientProxy*, EDirection,
|
||||
BaseClientProxy* getNeighbor(BaseClientProxy*, EDirection,
|
||||
SInt32& x, SInt32& y) const;
|
||||
|
||||
// lookup neighboring screen. given a position relative to the
|
||||
@@ -228,18 +228,18 @@ private:
|
||||
// if the position is sufficiently far from the source then we
|
||||
// cross multiple screens. if there is no suitable screen then
|
||||
// return NULL and x,y are not modified.
|
||||
CBaseClientProxy* mapToNeighbor(CBaseClientProxy*, EDirection,
|
||||
BaseClientProxy* mapToNeighbor(BaseClientProxy*, EDirection,
|
||||
SInt32& x, SInt32& y) const;
|
||||
|
||||
// adjusts x and y or neither to avoid ending up in a jump zone
|
||||
// after entering the client in the given direction.
|
||||
void avoidJumpZone(CBaseClientProxy*, EDirection,
|
||||
void avoidJumpZone(BaseClientProxy*, EDirection,
|
||||
SInt32& x, SInt32& y) const;
|
||||
|
||||
// test if a switch is permitted. this includes testing user
|
||||
// options like switch delay and tracking any state required to
|
||||
// implement them. returns true iff a switch is permitted.
|
||||
bool isSwitchOkay(CBaseClientProxy* dst, EDirection,
|
||||
bool isSwitchOkay(BaseClientProxy* dst, EDirection,
|
||||
SInt32 x, SInt32 y, SInt32 xActive, SInt32 yActive);
|
||||
|
||||
// update switch state due to a mouse move at \p x, \p y that
|
||||
@@ -275,46 +275,46 @@ private:
|
||||
|
||||
// returns the corner (EScreenSwitchCornerMasks) where x,y is on the
|
||||
// given client. corners have the given size.
|
||||
UInt32 getCorner(CBaseClientProxy*,
|
||||
UInt32 getCorner(BaseClientProxy*,
|
||||
SInt32 x, SInt32 y, SInt32 size) const;
|
||||
|
||||
// stop relative mouse moves
|
||||
void stopRelativeMoves();
|
||||
|
||||
// send screen options to \c client
|
||||
void sendOptions(CBaseClientProxy* client) const;
|
||||
void sendOptions(BaseClientProxy* client) const;
|
||||
|
||||
// process options from configuration
|
||||
void processOptions();
|
||||
|
||||
// event handlers
|
||||
void handleShapeChanged(const CEvent&, void*);
|
||||
void handleClipboardGrabbed(const CEvent&, void*);
|
||||
void handleClipboardChanged(const CEvent&, void*);
|
||||
void handleKeyDownEvent(const CEvent&, void*);
|
||||
void handleKeyUpEvent(const CEvent&, void*);
|
||||
void handleKeyRepeatEvent(const CEvent&, void*);
|
||||
void handleButtonDownEvent(const CEvent&, void*);
|
||||
void handleButtonUpEvent(const CEvent&, void*);
|
||||
void handleMotionPrimaryEvent(const CEvent&, void*);
|
||||
void handleMotionSecondaryEvent(const CEvent&, void*);
|
||||
void handleWheelEvent(const CEvent&, void*);
|
||||
void handleScreensaverActivatedEvent(const CEvent&, void*);
|
||||
void handleScreensaverDeactivatedEvent(const CEvent&, void*);
|
||||
void handleSwitchWaitTimeout(const CEvent&, void*);
|
||||
void handleClientDisconnected(const CEvent&, void*);
|
||||
void handleClientCloseTimeout(const CEvent&, void*);
|
||||
void handleSwitchToScreenEvent(const CEvent&, void*);
|
||||
void handleSwitchInDirectionEvent(const CEvent&, void*);
|
||||
void handleKeyboardBroadcastEvent(const CEvent&,void*);
|
||||
void handleLockCursorToScreenEvent(const CEvent&, void*);
|
||||
void handleFakeInputBeginEvent(const CEvent&, void*);
|
||||
void handleFakeInputEndEvent(const CEvent&, void*);
|
||||
void handleFileChunkSendingEvent(const CEvent&, void*);
|
||||
void handleFileRecieveCompletedEvent(const CEvent&, void*);
|
||||
void handleShapeChanged(const Event&, void*);
|
||||
void handleClipboardGrabbed(const Event&, void*);
|
||||
void handleClipboardChanged(const Event&, void*);
|
||||
void handleKeyDownEvent(const Event&, void*);
|
||||
void handleKeyUpEvent(const Event&, void*);
|
||||
void handleKeyRepeatEvent(const Event&, void*);
|
||||
void handleButtonDownEvent(const Event&, void*);
|
||||
void handleButtonUpEvent(const Event&, void*);
|
||||
void handleMotionPrimaryEvent(const Event&, void*);
|
||||
void handleMotionSecondaryEvent(const Event&, void*);
|
||||
void handleWheelEvent(const Event&, void*);
|
||||
void handleScreensaverActivatedEvent(const Event&, void*);
|
||||
void handleScreensaverDeactivatedEvent(const Event&, void*);
|
||||
void handleSwitchWaitTimeout(const Event&, void*);
|
||||
void handleClientDisconnected(const Event&, void*);
|
||||
void handleClientCloseTimeout(const Event&, void*);
|
||||
void handleSwitchToScreenEvent(const Event&, void*);
|
||||
void handleSwitchInDirectionEvent(const Event&, void*);
|
||||
void handleKeyboardBroadcastEvent(const Event&,void*);
|
||||
void handleLockCursorToScreenEvent(const Event&, void*);
|
||||
void handleFakeInputBeginEvent(const Event&, void*);
|
||||
void handleFakeInputEndEvent(const Event&, void*);
|
||||
void handleFileChunkSendingEvent(const Event&, void*);
|
||||
void handleFileRecieveCompletedEvent(const Event&, void*);
|
||||
|
||||
// event processing
|
||||
void onClipboardChanged(CBaseClientProxy* sender,
|
||||
void onClipboardChanged(BaseClientProxy* sender,
|
||||
ClipboardID id, UInt32 seqNum);
|
||||
void onScreensaver(bool activated);
|
||||
void onKeyDown(KeyID, KeyModifierMask, KeyButton,
|
||||
@@ -331,27 +331,27 @@ private:
|
||||
void onFileRecieveCompleted();
|
||||
|
||||
// add client to list and attach event handlers for client
|
||||
bool addClient(CBaseClientProxy*);
|
||||
bool addClient(BaseClientProxy*);
|
||||
|
||||
// remove client from list and detach event handlers for client
|
||||
bool removeClient(CBaseClientProxy*);
|
||||
bool removeClient(BaseClientProxy*);
|
||||
|
||||
// close a client
|
||||
void closeClient(CBaseClientProxy*, const char* msg);
|
||||
void closeClient(BaseClientProxy*, const char* msg);
|
||||
|
||||
// close clients not in \p config
|
||||
void closeClients(const CConfig& config);
|
||||
void closeClients(const Config& config);
|
||||
|
||||
// close all clients whether they've completed the handshake or not,
|
||||
// except the primary client
|
||||
void closeAllClients();
|
||||
|
||||
// remove clients from internal state
|
||||
void removeActiveClient(CBaseClientProxy*);
|
||||
void removeOldClient(CBaseClientProxy*);
|
||||
void removeActiveClient(BaseClientProxy*);
|
||||
void removeOldClient(BaseClientProxy*);
|
||||
|
||||
// force the cursor off of \p client
|
||||
void forceLeaveClient(CBaseClientProxy* client);
|
||||
void forceLeaveClient(BaseClientProxy* client);
|
||||
|
||||
// thread funciton for sending file
|
||||
void sendFileThread(void*);
|
||||
@@ -363,38 +363,38 @@ private:
|
||||
void getDragInfoThread(void*);
|
||||
|
||||
// send drag info to new client screen
|
||||
void sendDragInfo(CBaseClientProxy* newScreen);
|
||||
void sendDragInfo(BaseClientProxy* newScreen);
|
||||
|
||||
public:
|
||||
bool m_mock;
|
||||
|
||||
private:
|
||||
class CClipboardInfo {
|
||||
class ClipboardInfo {
|
||||
public:
|
||||
CClipboardInfo();
|
||||
ClipboardInfo();
|
||||
|
||||
public:
|
||||
CClipboard m_clipboard;
|
||||
CString m_clipboardData;
|
||||
CString m_clipboardOwner;
|
||||
Clipboard m_clipboard;
|
||||
String m_clipboardData;
|
||||
String m_clipboardOwner;
|
||||
UInt32 m_clipboardSeqNum;
|
||||
};
|
||||
|
||||
// the primary screen client
|
||||
CPrimaryClient* m_primaryClient;
|
||||
PrimaryClient* m_primaryClient;
|
||||
|
||||
// all clients (including the primary client) indexed by name
|
||||
typedef std::map<CString, CBaseClientProxy*> CClientList;
|
||||
typedef std::set<CBaseClientProxy*> CClientSet;
|
||||
CClientList m_clients;
|
||||
CClientSet m_clientSet;
|
||||
typedef std::map<String, BaseClientProxy*> ClientList;
|
||||
typedef std::set<BaseClientProxy*> ClientSet;
|
||||
ClientList m_clients;
|
||||
ClientSet m_clientSet;
|
||||
|
||||
// all old connections that we're waiting to hangup
|
||||
typedef std::map<CBaseClientProxy*, CEventQueueTimer*> COldClients;
|
||||
COldClients m_oldClients;
|
||||
typedef std::map<BaseClientProxy*, EventQueueTimer*> OldClients;
|
||||
OldClients m_oldClients;
|
||||
|
||||
// the client with focus
|
||||
CBaseClientProxy* m_active;
|
||||
BaseClientProxy* m_active;
|
||||
|
||||
// the sequence number of enter messages
|
||||
UInt32 m_seqNum;
|
||||
@@ -411,31 +411,31 @@ private:
|
||||
SInt32 m_xDelta2, m_yDelta2;
|
||||
|
||||
// current configuration
|
||||
CConfig* m_config;
|
||||
Config* m_config;
|
||||
|
||||
// input filter (from m_config);
|
||||
CInputFilter* m_inputFilter;
|
||||
InputFilter* m_inputFilter;
|
||||
|
||||
// clipboard cache
|
||||
CClipboardInfo m_clipboards[kClipboardEnd];
|
||||
ClipboardInfo m_clipboards[kClipboardEnd];
|
||||
|
||||
// state saved when screen saver activates
|
||||
CBaseClientProxy* m_activeSaver;
|
||||
BaseClientProxy* m_activeSaver;
|
||||
SInt32 m_xSaver, m_ySaver;
|
||||
|
||||
// common state for screen switch tests. all tests are always
|
||||
// trying to reach the same screen in the same direction.
|
||||
EDirection m_switchDir;
|
||||
CBaseClientProxy* m_switchScreen;
|
||||
BaseClientProxy* m_switchScreen;
|
||||
|
||||
// state for delayed screen switching
|
||||
double m_switchWaitDelay;
|
||||
CEventQueueTimer* m_switchWaitTimer;
|
||||
EventQueueTimer* m_switchWaitTimer;
|
||||
SInt32 m_switchWaitX, m_switchWaitY;
|
||||
|
||||
// state for double-tap screen switching
|
||||
double m_switchTwoTapDelay;
|
||||
CStopwatch m_switchTwoTapTimer;
|
||||
Stopwatch m_switchTwoTapTimer;
|
||||
bool m_switchTwoTapEngaged;
|
||||
bool m_switchTwoTapArmed;
|
||||
SInt32 m_switchTwoTapZone;
|
||||
@@ -451,26 +451,26 @@ private:
|
||||
// flag whether or not we have broadcasting enabled and the screens to
|
||||
// which we should send broadcasted keys.
|
||||
bool m_keyboardBroadcasting;
|
||||
CString m_keyboardBroadcastingScreens;
|
||||
String m_keyboardBroadcastingScreens;
|
||||
|
||||
// screen locking (former scroll lock)
|
||||
bool m_lockedToScreen;
|
||||
|
||||
// server screen
|
||||
CScreen* m_screen;
|
||||
Screen* m_screen;
|
||||
|
||||
IEventQueue* m_events;
|
||||
|
||||
// file transfer
|
||||
size_t m_expectedFileSize;
|
||||
CString m_receivedFileData;
|
||||
CDragFileList m_dragFileList;
|
||||
CThread* m_sendFileThread;
|
||||
CThread* m_writeToDropDirThread;
|
||||
CString m_dragFileExt;
|
||||
String m_receivedFileData;
|
||||
DragFileList m_dragFileList;
|
||||
Thread* m_sendFileThread;
|
||||
Thread* m_writeToDropDirThread;
|
||||
String m_dragFileExt;
|
||||
bool m_ignoreFileTransfer;
|
||||
bool m_enableDragDrop;
|
||||
|
||||
CThread* m_getDragInfoThread;
|
||||
Thread* m_getDragInfoThread;
|
||||
bool m_waitDragInfoThread;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user