Esempio n. 1
0
CServerProxy::CServerProxy(CClient* client, IStream* stream) :
	m_client(client),
	m_stream(stream),
	m_seqNum(0),
	m_compressMouse(false),
	m_compressMouseRelative(false),
	m_xMouse(0),
	m_yMouse(0),
	m_dxMouse(0),
	m_dyMouse(0),
	m_ignoreMouse(false),
	m_keepAliveAlarm(0.0),
	m_keepAliveAlarmTimer(NULL),
	m_parser(&CServerProxy::parseHandshakeMessage)
{
	assert(m_client != NULL);
	assert(m_stream != NULL);

	// initialize modifier translation table
	for (KeyModifierID id = 0; id < kKeyModifierIDLast; ++id)
		m_modifierTranslationTable[id] = id;

	// handle data on stream
	EVENTQUEUE->adoptHandler(IStream::getInputReadyEvent(),
							m_stream->getEventTarget(),
							new TMethodEventJob<CServerProxy>(this,
								&CServerProxy::handleData));

	// send heartbeat
	setKeepAliveRate(kKeepAliveRate);
}
Esempio n. 2
0
CServerProxy::CServerProxy(CClient* client, synergy::IStream* stream, IEventQueue* events) :
	m_client(client),
	m_stream(stream),
	m_seqNum(0),
	m_compressMouse(false),
	m_compressMouseRelative(false),
	m_xMouse(0),
	m_yMouse(0),
	m_dxMouse(0),
	m_dyMouse(0),
	m_ignoreMouse(false),
	m_keepAliveAlarm(0.0),
	m_keepAliveAlarmTimer(NULL),
	m_parser(&CServerProxy::parseHandshakeMessage),
	m_events(events),
	m_stopwatch(true),
	m_elapsedTime(0),
	m_receivedDataSize(0)
{
	assert(m_client != NULL);
	assert(m_stream != NULL);

	// initialize modifier translation table
	for (KeyModifierID id = 0; id < kKeyModifierIDLast; ++id)
		m_modifierTranslationTable[id] = id;

	// handle data on stream
	m_events->adoptHandler(m_events->forIStream().inputReady(),
							m_stream->getEventTarget(),
							new TMethodEventJob<CServerProxy>(this,
								&CServerProxy::handleData));

	// send heartbeat
	setKeepAliveRate(kKeepAliveRate);
}
Esempio n. 3
0
void
ServerProxy::resetOptions()
{
	// parse
	LOG((CLOG_DEBUG1 "recv reset options"));

	// forward
	m_client->resetOptions();

	// reset keep alive
	setKeepAliveRate(kKeepAliveRate);

	// reset modifier translation table
	for (KeyModifierID id = 0; id < kKeyModifierIDLast; ++id) {
		m_modifierTranslationTable[id] = id;
	}
}
Esempio n. 4
0
void
ServerProxy::setOptions()
{
	// parse
	OptionsList options;
	ProtocolUtil::readf(m_stream, kMsgDSetOptions + 4, &options);
	LOG((CLOG_DEBUG1 "recv set options size=%d", options.size()));

	// forward
	m_client->setOptions(options);

	// update modifier table
	for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
		KeyModifierID id = kKeyModifierIDNull;
		if (options[i] == kOptionModifierMapForShift) {
			id = kKeyModifierIDShift;
		}
		else if (options[i] == kOptionModifierMapForControl) {
			id = kKeyModifierIDControl;
		}
		else if (options[i] == kOptionModifierMapForAlt) {
			id = kKeyModifierIDAlt;
		}
		else if (options[i] == kOptionModifierMapForAltGr) {
			id = kKeyModifierIDAltGr;
		}
		else if (options[i] == kOptionModifierMapForMeta) {
			id = kKeyModifierIDMeta;
		}
		else if (options[i] == kOptionModifierMapForSuper) {
			id = kKeyModifierIDSuper;
		}
		else if (options[i] == kOptionHeartbeat) {
			// update keep alive
			setKeepAliveRate(1.0e-3 * static_cast<double>(options[i + 1]));
		}

		if (id != kKeyModifierIDNull) {
			m_modifierTranslationTable[id] =
				static_cast<KeyModifierID>(options[i + 1]);
			LOG((CLOG_DEBUG1 "modifier %d mapped to %d", id, m_modifierTranslationTable[id]));
		}
	}
}
Esempio n. 5
0
ServerProxy::~ServerProxy()
{
	setKeepAliveRate(-1.0);
	m_events->removeHandler(m_events->forIStream().inputReady(),
							m_stream->getEventTarget());
}
Esempio n. 6
0
CServerProxy::~CServerProxy()
{
	setKeepAliveRate(-1.0);
	EVENTQUEUE->removeHandler(IStream::getInputReadyEvent(),
							m_stream->getEventTarget());
}
Esempio n. 7
0
CServerProxy::~CServerProxy()
{
    setKeepAliveRate(-1.0);
    m_eventQueue.removeHandler(m_stream->getInputReadyEvent(),
                               m_stream->getEventTarget());
}