diff --git a/lib/client/CClient.cpp b/lib/client/CClient.cpp index 2d5ee1f1..35fefe1e 100644 --- a/lib/client/CClient.cpp +++ b/lib/client/CClient.cpp @@ -111,6 +111,14 @@ CClient::disconnect(const char* msg) } } +void +CClient::handshakeComplete() +{ + m_ready = true; + m_screen->enable(); + sendEvent(getConnectedEvent(), NULL); +} + bool CClient::isConnected() const { @@ -386,10 +394,6 @@ CClient::setupScreen() getEventTarget(), new TMethodEventJob(this, &CClient::handleClipboardGrabbed)); - EVENTQUEUE->adoptHandler(CServerProxy::getHandshakeCompleteEvent(), - m_server, - new TMethodEventJob(this, - &CClient::handleHandshakeComplete)); } void @@ -437,11 +441,7 @@ void CClient::cleanupScreen() { if (m_server != NULL) { - if (!m_ready) { - EVENTQUEUE->removeHandler(CServerProxy::getHandshakeCompleteEvent(), - m_server); - } - else { + if (m_ready) { m_screen->disable(); m_ready = false; } @@ -523,16 +523,6 @@ CClient::handleDisconnected(const CEvent&, void*) sendEvent(getDisconnectedEvent(), NULL); } -void -CClient::handleHandshakeComplete(const CEvent&, void*) -{ - m_ready = true; - EVENTQUEUE->removeHandler(CServerProxy::getHandshakeCompleteEvent(), - m_server); - sendEvent(getConnectedEvent(), NULL); - m_screen->enable(); -} - void CClient::handleShapeChanged(const CEvent&, void*) { diff --git a/lib/client/CClient.h b/lib/client/CClient.h index 70386413..9c49d3cd 100644 --- a/lib/client/CClient.h +++ b/lib/client/CClient.h @@ -66,6 +66,12 @@ public: */ void disconnect(const char* msg); + //! Notify of handshake complete + /*! + Notifies the client that the connection handshake has completed. + */ + void handshakeComplete(); + //@} //! @name accessors //@{ @@ -152,7 +158,6 @@ private: void handleConnectTimeout(const CEvent&, void*); void handleOutputError(const CEvent&, void*); void handleDisconnected(const CEvent&, void*); - void handleHandshakeComplete(const CEvent&, void*); void handleShapeChanged(const CEvent&, void*); void handleClipboardGrabbed(const CEvent&, void*); void handleHello(const CEvent&, void*); diff --git a/lib/client/CServerProxy.cpp b/lib/client/CServerProxy.cpp index c72dc12f..b6568365 100644 --- a/lib/client/CServerProxy.cpp +++ b/lib/client/CServerProxy.cpp @@ -29,9 +29,6 @@ // CServerProxy // -CEvent::Type CServerProxy::s_handshakeCompleteEvent = - CEvent::kUnknown; - CServerProxy::CServerProxy(CClient* client, IStream* stream) : m_client(client), m_stream(stream), @@ -66,13 +63,6 @@ CServerProxy::~CServerProxy() m_stream->getEventTarget()); } -CEvent::Type -CServerProxy::getHandshakeCompleteEvent() -{ - return CEvent::registerTypeOnce(s_handshakeCompleteEvent, - "CServerProxy::handshakeComplete"); -} - void CServerProxy::installHeartBeat(double heartRate) { @@ -141,7 +131,7 @@ CServerProxy::parseHandshakeMessage(const UInt8* code) // handshake is complete m_parser = &CServerProxy::parseMessage; - EVENTQUEUE->addEvent(CEvent(getHandshakeCompleteEvent(), this)); + m_client->handshakeComplete(); } else if (memcmp(code, kMsgCResetOptions, 4) == 0) { diff --git a/lib/client/CServerProxy.h b/lib/client/CServerProxy.h index 3a06784e..61e5474b 100644 --- a/lib/client/CServerProxy.h +++ b/lib/client/CServerProxy.h @@ -47,17 +47,6 @@ public: void onClipboardChanged(ClipboardID, const IClipboard*); //@} - //! @name accessors - //@{ - - //! Get handshake complete event type - /*! - Returns the handshake complete event type. This is sent when the - client has completed the handshake with the server. - */ - static CEvent::Type getHandshakeCompleteEvent(); - - //@} protected: enum EResult { kOkay, kUnknown, kDisconnect }; @@ -116,8 +105,6 @@ private: double m_heartRate; MessageParser m_parser; - - static CEvent::Type s_handshakeCompleteEvent; }; #endif