moved try/catch block from CMSWindowsScreen to CPrimaryClient.

this means CMSWindowsScreen doesn't need to include XSynergy.h.
This commit is contained in:
crs 2002-07-29 16:06:52 +00:00
parent 5c4e4fdf08
commit 50eee03f6d
2 changed files with 21 additions and 22 deletions

View File

@ -5,7 +5,6 @@
#include "CClipboard.h"
#include "IMSWindowsScreenEventHandler.h"
#include "IScreenReceiver.h"
#include "XSynergy.h"
#include "CThread.h"
#include "CLock.h"
#include "TMethodJob.h"
@ -278,15 +277,10 @@ CMSWindowsScreen::checkClipboards()
// least the clipboard itself will work.
HWND clipboardOwner = GetClipboardOwner();
if (m_clipboardOwner != clipboardOwner) {
try {
m_clipboardOwner = clipboardOwner;
if (m_clipboardOwner != m_window && m_clipboardOwner != NULL) {
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
catch (XBadClient&) {
// ignore
m_clipboardOwner = clipboardOwner;
if (m_clipboardOwner != m_window && m_clipboardOwner != NULL) {
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
}
@ -509,16 +503,10 @@ CMSWindowsScreen::onEvent(CEvent* event)
// ownership, or now it's owned by nobody, which will happen if
// we owned it and switched desktops because we destroy our
// window to do that).
try {
m_clipboardOwner = GetClipboardOwner();
if (m_clipboardOwner != m_window && m_clipboardOwner != NULL) {
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
catch (XBadClient&) {
// ignore. this can happen if we receive this event
// before we've fully started up.
m_clipboardOwner = GetClipboardOwner();
if (m_clipboardOwner != m_window && m_clipboardOwner != NULL) {
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
return true;

View File

@ -1,5 +1,6 @@
#include "CPrimaryClient.h"
#include "IServer.h"
#include "XSynergy.h"
#include "CPrimaryScreen.h"
#include "CClipboard.h"
#include "CLog.h"
@ -81,13 +82,23 @@ void
CPrimaryClient::onInfoChanged(const CClientInfo& info)
{
m_info = info;
m_server->onInfoChanged(getName(), m_info);
try {
m_server->onInfoChanged(getName(), m_info);
}
catch (XBadClient&) {
// ignore
}
}
bool
CPrimaryClient::onGrabClipboard(ClipboardID id)
{
return m_server->onGrabClipboard(getName(), id, m_seqNum);
try {
return m_server->onGrabClipboard(getName(), id, m_seqNum);
}
catch (XBadClient&) {
return false;
}
}
void