From c3135b1b1c09b2bc61122ed2b2cdf690bb06bf7f Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 29 Feb 2004 17:28:51 +0000 Subject: [PATCH] Moved clipboard changed event to CClientProxy because only it and CServer use it. CServerProxy instead makes a direct call to CClient, like it does for most other messages. --- lib/client/CClient.cpp | 12 ------------ lib/client/CClient.h | 1 - lib/server/CClientProxy.cpp | 12 ++++++++++-- lib/server/CClientProxy.h | 9 +++++++++ lib/server/CServer.cpp | 4 ++-- lib/synergy/IScreen.cpp | 8 -------- lib/synergy/IScreen.h | 9 --------- 7 files changed, 21 insertions(+), 34 deletions(-) diff --git a/lib/client/CClient.cpp b/lib/client/CClient.cpp index da227d2a..2d5ee1f1 100644 --- a/lib/client/CClient.cpp +++ b/lib/client/CClient.cpp @@ -386,10 +386,6 @@ CClient::setupScreen() getEventTarget(), new TMethodEventJob(this, &CClient::handleClipboardGrabbed)); - EVENTQUEUE->adoptHandler(IScreen::getClipboardChangedEvent(), - getEventTarget(), - new TMethodEventJob(this, - &CClient::handleClipboardChanged)); EVENTQUEUE->adoptHandler(CServerProxy::getHandshakeCompleteEvent(), m_server, new TMethodEventJob(this, @@ -453,8 +449,6 @@ CClient::cleanupScreen() getEventTarget()); EVENTQUEUE->removeHandler(IScreen::getClipboardGrabbedEvent(), getEventTarget()); - EVENTQUEUE->removeHandler(IScreen::getClipboardChangedEvent(), - getEventTarget()); delete m_server; m_server = NULL; } @@ -566,12 +560,6 @@ CClient::handleClipboardGrabbed(const CEvent& event, void*) } } -void -CClient::handleClipboardChanged(const CEvent&, void*) -{ - // ignore -- we'll check the clipboard when we leave -} - void CClient::handleHello(const CEvent&, void*) { diff --git a/lib/client/CClient.h b/lib/client/CClient.h index 3595a719..70386413 100644 --- a/lib/client/CClient.h +++ b/lib/client/CClient.h @@ -155,7 +155,6 @@ private: void handleHandshakeComplete(const CEvent&, void*); void handleShapeChanged(const CEvent&, void*); void handleClipboardGrabbed(const CEvent&, void*); - void handleClipboardChanged(const CEvent&, void*); void handleHello(const CEvent&, void*); private: diff --git a/lib/server/CClientProxy.cpp b/lib/server/CClientProxy.cpp index e5dc02c0..99772cd9 100644 --- a/lib/server/CClientProxy.cpp +++ b/lib/server/CClientProxy.cpp @@ -21,8 +21,9 @@ // CClientProxy // -CEvent::Type CClientProxy::s_readyEvent = CEvent::kUnknown; -CEvent::Type CClientProxy::s_disconnectedEvent = CEvent::kUnknown; +CEvent::Type CClientProxy::s_readyEvent = CEvent::kUnknown; +CEvent::Type CClientProxy::s_disconnectedEvent = CEvent::kUnknown; +CEvent::Type CClientProxy::s_clipboardChangedEvent= CEvent::kUnknown; CClientProxy::CClientProxy(const CString& name, IStream* stream) : m_name(name), @@ -72,6 +73,13 @@ CClientProxy::getDisconnectedEvent() "CClientProxy::disconnected"); } +CEvent::Type +CClientProxy::getClipboardChangedEvent() +{ + return CEvent::registerTypeOnce(s_clipboardChangedEvent, + "CClientProxy::clipboardChanged"); +} + void* CClientProxy::getEventTarget() const { diff --git a/lib/server/CClientProxy.h b/lib/server/CClientProxy.h index 4a95ebc5..9453a203 100644 --- a/lib/server/CClientProxy.h +++ b/lib/server/CClientProxy.h @@ -64,6 +64,14 @@ public: */ static CEvent::Type getDisconnectedEvent(); + //! Get clipboard changed event type + /*! + Returns the clipboard changed event type. This is sent whenever the + contents of the clipboard has changed. The data is a pointer to a + IScreen::CClipboardInfo. + */ + static CEvent::Type getClipboardChangedEvent(); + //@} // IScreen @@ -100,6 +108,7 @@ private: static CEvent::Type s_readyEvent; static CEvent::Type s_disconnectedEvent; + static CEvent::Type s_clipboardChangedEvent; }; #endif diff --git a/lib/server/CServer.cpp b/lib/server/CServer.cpp index d129ab96..56432af9 100644 --- a/lib/server/CServer.cpp +++ b/lib/server/CServer.cpp @@ -1425,7 +1425,7 @@ CServer::addClient(IClient* client) client->getEventTarget(), new TMethodEventJob(this, &CServer::handleClipboardGrabbed, client)); - EVENTQUEUE->adoptHandler(IScreen::getClipboardChangedEvent(), + EVENTQUEUE->adoptHandler(CClientProxy::getClipboardChangedEvent(), client->getEventTarget(), new TMethodEventJob(this, &CServer::handleClipboardChanged, client)); @@ -1454,7 +1454,7 @@ CServer::removeClient(IClient* client) client->getEventTarget()); EVENTQUEUE->removeHandler(IScreen::getClipboardGrabbedEvent(), client->getEventTarget()); - EVENTQUEUE->removeHandler(IScreen::getClipboardChangedEvent(), + EVENTQUEUE->removeHandler(CClientProxy::getClipboardChangedEvent(), client->getEventTarget()); // remove from list diff --git a/lib/synergy/IScreen.cpp b/lib/synergy/IScreen.cpp index 1c55dc5c..fadbe8b3 100644 --- a/lib/synergy/IScreen.cpp +++ b/lib/synergy/IScreen.cpp @@ -21,7 +21,6 @@ CEvent::Type IScreen::s_errorEvent = CEvent::kUnknown; CEvent::Type IScreen::s_shapeChangedEvent = CEvent::kUnknown; CEvent::Type IScreen::s_clipboardGrabbedEvent = CEvent::kUnknown; -CEvent::Type IScreen::s_clipboardChangedEvent = CEvent::kUnknown; CEvent::Type IScreen::getErrorEvent() @@ -43,10 +42,3 @@ IScreen::getClipboardGrabbedEvent() return CEvent::registerTypeOnce(s_clipboardGrabbedEvent, "IScreen::clipboardGrabbed"); } - -CEvent::Type -IScreen::getClipboardChangedEvent() -{ - return CEvent::registerTypeOnce(s_clipboardChangedEvent, - "IScreen::clipboardChanged"); -} diff --git a/lib/synergy/IScreen.h b/lib/synergy/IScreen.h index 2f1b4450..a36f8fb1 100644 --- a/lib/synergy/IScreen.h +++ b/lib/synergy/IScreen.h @@ -85,21 +85,12 @@ public: */ static CEvent::Type getClipboardGrabbedEvent(); - //! Get clipboard changed event type - /*! - Returns the clipboard changed event type. This is sent whenever the - contents of the clipboard has changed. The data is a pointer to a - CClipboardInfo. - */ - static CEvent::Type getClipboardChangedEvent(); - //@} private: static CEvent::Type s_errorEvent; static CEvent::Type s_shapeChangedEvent; static CEvent::Type s_clipboardGrabbedEvent; - static CEvent::Type s_clipboardChangedEvent; }; #endif