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

View File

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