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.
This commit is contained in:
crs 2004-02-29 17:28:51 +00:00
parent 1ccb92b888
commit c3135b1b1c
7 changed files with 21 additions and 34 deletions

View File

@ -386,10 +386,6 @@ CClient::setupScreen()
getEventTarget(),
new TMethodEventJob<CClient>(this,
&CClient::handleClipboardGrabbed));
EVENTQUEUE->adoptHandler(IScreen::getClipboardChangedEvent(),
getEventTarget(),
new TMethodEventJob<CClient>(this,
&CClient::handleClipboardChanged));
EVENTQUEUE->adoptHandler(CServerProxy::getHandshakeCompleteEvent(),
m_server,
new TMethodEventJob<CClient>(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*)
{

View File

@ -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:

View File

@ -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
{

View File

@ -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

View File

@ -1425,7 +1425,7 @@ CServer::addClient(IClient* client)
client->getEventTarget(),
new TMethodEventJob<CServer>(this,
&CServer::handleClipboardGrabbed, client));
EVENTQUEUE->adoptHandler(IScreen::getClipboardChangedEvent(),
EVENTQUEUE->adoptHandler(CClientProxy::getClipboardChangedEvent(),
client->getEventTarget(),
new TMethodEventJob<CServer>(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

View File

@ -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");
}

View File

@ -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