removed IPrimaryReceiver in favor of IServer, which required a few
minor changes to support IPrimaryReciever's functionality. this does mean that the IPrimaryScreen class will be calling some methods with dummy arguments. those are documented in CPrimaryClient.
This commit is contained in:
parent
64232c7854
commit
f90076938b
|
@ -2,7 +2,6 @@
|
|||
#include "CServer.h"
|
||||
#include "CClipboard.h"
|
||||
#include "CProtocolUtil.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "XSynergy.h"
|
||||
#include "IInputStream.h"
|
||||
#include "IOutputStream.h"
|
||||
|
@ -245,25 +244,25 @@ void
|
|||
CClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
x = m_x;
|
||||
y = m_y;
|
||||
w = m_w;
|
||||
h = m_h;
|
||||
x = m_info.m_x;
|
||||
y = m_info.m_y;
|
||||
w = m_info.m_w;
|
||||
h = m_info.m_h;
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_0::getCenter(SInt32& x, SInt32& y) const
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
x = m_cx;
|
||||
y = m_cy;
|
||||
x = m_info.m_mx;
|
||||
y = m_info.m_my;
|
||||
}
|
||||
|
||||
SInt32
|
||||
CClientProxy1_0::getJumpZoneSize() const
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
return m_zoneSize;
|
||||
return m_info.m_zoneSize;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -273,23 +272,32 @@ CClientProxy1_0::recvInfo(bool notify)
|
|||
CLock lock(&m_mutex);
|
||||
|
||||
// parse the message
|
||||
SInt16 x, y, w, h, zoneSize, mx, my;
|
||||
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4,
|
||||
&m_x, &m_y, &m_w, &m_h,
|
||||
&m_zoneSize, &m_cx, &m_cy);
|
||||
log((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d, zone=%d, pos=%d,%d", getName().c_str(), m_x, m_y, m_w, m_h, m_zoneSize, m_cx, m_cy));
|
||||
&x, &y, &w, &h, &zoneSize, &mx, &my);
|
||||
log((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d, zone=%d, pos=%d,%d", getName().c_str(), x, y, w, h, zoneSize, mx, my));
|
||||
|
||||
// validate
|
||||
if (m_w <= 0 || m_h <= 0 || m_zoneSize < 0) {
|
||||
if (w <= 0 || h <= 0 || zoneSize < 0) {
|
||||
throw XBadClient();
|
||||
}
|
||||
if (m_cx < m_x || m_cy < m_y || m_cx >= m_x + m_w || m_cy >= m_y + m_h) {
|
||||
if (mx < x || my < y || mx >= x + w || my >= y + h) {
|
||||
throw XBadClient();
|
||||
}
|
||||
|
||||
// save
|
||||
m_info.m_x = x;
|
||||
m_info.m_y = y;
|
||||
m_info.m_w = w;
|
||||
m_info.m_h = h;
|
||||
m_info.m_zoneSize = zoneSize;
|
||||
m_info.m_mx = mx;
|
||||
m_info.m_my = my;
|
||||
}
|
||||
|
||||
// tell server of change
|
||||
if (notify) {
|
||||
getServer()->onInfoChanged(getName());
|
||||
getServer()->onInfoChanged(getName(), m_info);
|
||||
}
|
||||
|
||||
// acknowledge receipt
|
||||
|
@ -333,5 +341,5 @@ CClientProxy1_0::recvGrabClipboard()
|
|||
|
||||
// send update. this calls us back to reset our clipboard dirty flag
|
||||
// so don't hold a lock during the call.
|
||||
getServer()->onGrabClipboard(id, seqNum, getName());
|
||||
getServer()->onGrabClipboard(getName(), id, seqNum);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define CCLIENTPROXY1_0_H
|
||||
|
||||
#include "CClientProxy.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "CMutex.h"
|
||||
|
||||
class CClientProxy1_0 : public CClientProxy {
|
||||
|
@ -42,10 +43,7 @@ private:
|
|||
|
||||
private:
|
||||
CMutex m_mutex;
|
||||
SInt16 m_x, m_y;
|
||||
SInt16 m_w, m_h;
|
||||
SInt16 m_zoneSize;
|
||||
SInt16 m_cx, m_cy;
|
||||
CClientInfo m_info;
|
||||
bool m_clipboardDirty[kClipboardEnd];
|
||||
};
|
||||
|
||||
|
|
|
@ -75,27 +75,22 @@ CPrimaryClient::onError()
|
|||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::onInfoChanged(SInt32 x, SInt32 y, SInt32 w, SInt32 h,
|
||||
SInt32 zoneSize, SInt32 cx, SInt32 cy)
|
||||
CPrimaryClient::onInfoChanged(const CString&, const CClientInfo& info)
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
m_w = w;
|
||||
m_h = h;
|
||||
m_zoneSize = zoneSize;
|
||||
m_cx = cx;
|
||||
m_cy = cy;
|
||||
m_server->onInfoChanged(getName());
|
||||
m_info = info;
|
||||
m_server->onInfoChanged(getName(), m_info);
|
||||
}
|
||||
|
||||
bool
|
||||
CPrimaryClient::onGrabClipboard(ClipboardID id)
|
||||
CPrimaryClient::onGrabClipboard(const CString&, ClipboardID id, UInt32)
|
||||
{
|
||||
m_clipboardOwner[id] = m_server->onGrabClipboard(id, m_seqNum, getName());
|
||||
bool result = m_server->onGrabClipboard(getName(), id, m_seqNum);
|
||||
m_clipboardOwner[id] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
CPrimaryClient::onClipboardChanged(ClipboardID id, const CString& data)
|
||||
void
|
||||
CPrimaryClient::onClipboardChanged(ClipboardID id, UInt32, const CString& data)
|
||||
{
|
||||
m_server->onClipboardChanged(id, m_seqNum, data);
|
||||
}
|
||||
|
@ -288,21 +283,21 @@ CPrimaryClient::getName() const
|
|||
void
|
||||
CPrimaryClient::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||
{
|
||||
x = m_x;
|
||||
y = m_y;
|
||||
w = m_w;
|
||||
h = m_h;
|
||||
x = m_info.m_x;
|
||||
y = m_info.m_y;
|
||||
w = m_info.m_w;
|
||||
h = m_info.m_h;
|
||||
}
|
||||
|
||||
void
|
||||
CPrimaryClient::getCenter(SInt32& x, SInt32& y) const
|
||||
{
|
||||
x = m_cx;
|
||||
y = m_cy;
|
||||
x = m_info.m_mx;
|
||||
y = m_info.m_my;
|
||||
}
|
||||
|
||||
SInt32
|
||||
CPrimaryClient::getJumpZoneSize() const
|
||||
{
|
||||
return m_zoneSize;
|
||||
return m_info.m_zoneSize;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#ifndef CPRIMARYCLIENT_H
|
||||
#define CPRIMARYCLIENT_H
|
||||
|
||||
#include "IPrimaryReceiver.h"
|
||||
#include "IServer.h"
|
||||
#include "IClient.h"
|
||||
#include "ProtocolTypes.h"
|
||||
|
||||
class IClipboard;
|
||||
class IPrimaryScreen;
|
||||
class IServer;
|
||||
|
||||
class CPrimaryClient : public IPrimaryReceiver, public IClient {
|
||||
class CPrimaryClient : public IServer, public IClient {
|
||||
public:
|
||||
CPrimaryClient(IServer*, const CString& name);
|
||||
~CPrimaryClient();
|
||||
|
@ -32,14 +33,14 @@ public:
|
|||
// returns the state of the toggle keys on the primary screen
|
||||
KeyModifierMask getToggleMask() const;
|
||||
|
||||
// IPrimaryReceiver overrides
|
||||
// IServer overrides
|
||||
// onInfoChanged() ignores the client name.
|
||||
// onGrabClipboard() ignores the client name and sequence number.
|
||||
// onClipboardChanged() ignores the sequence number.
|
||||
virtual void onError();
|
||||
virtual void onInfoChanged(SInt32 xScreen, SInt32 yScreen,
|
||||
SInt32 wScreen, SInt32 hScreen,
|
||||
SInt32 zoneSize,
|
||||
SInt32 xMouse, SInt32 yMouse);
|
||||
virtual bool onGrabClipboard(ClipboardID);
|
||||
virtual bool onClipboardChanged(ClipboardID, const CString& data);
|
||||
virtual void onInfoChanged(const CString&, const CClientInfo&);
|
||||
virtual bool onGrabClipboard(const CString&, ClipboardID, UInt32);
|
||||
virtual void onClipboardChanged(ClipboardID, UInt32, const CString&);
|
||||
virtual void onKeyDown(KeyID, KeyModifierMask);
|
||||
virtual void onKeyUp(KeyID, KeyModifierMask);
|
||||
virtual void onKeyRepeat(KeyID, KeyModifierMask, SInt32 count);
|
||||
|
@ -80,11 +81,8 @@ private:
|
|||
IPrimaryScreen* m_screen;
|
||||
CString m_name;
|
||||
UInt32 m_seqNum;
|
||||
SInt16 m_x, m_y;
|
||||
SInt16 m_w, m_h;
|
||||
SInt16 m_zoneSize;
|
||||
SInt16 m_cx, m_cy;
|
||||
bool m_clipboardOwner[kClipboardEnd];
|
||||
CClientInfo m_info;
|
||||
bool m_clipboardOwner[kClipboardEnd]; // FIXME -- unneeded?
|
||||
bool m_clipboardDirty[kClipboardEnd];
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "ProtocolTypes.h"
|
||||
#include "XScreen.h"
|
||||
#include "XSynergy.h"
|
||||
#include "CNetworkAddress.h"
|
||||
// XXX #include "CNetworkAddress.h"
|
||||
#include "IDataSocket.h"
|
||||
#include "IListenSocket.h"
|
||||
#include "ISocketFactory.h"
|
||||
|
@ -235,7 +235,7 @@ CServer::onError()
|
|||
}
|
||||
|
||||
void
|
||||
CServer::onInfoChanged(const CString& name)
|
||||
CServer::onInfoChanged(const CString& name, const CClientInfo& info)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
|
||||
|
@ -249,17 +249,10 @@ CServer::onInfoChanged(const CString& name)
|
|||
|
||||
// update the remote mouse coordinates
|
||||
if (client == m_active) {
|
||||
client->getCenter(m_x, m_y);
|
||||
m_x = info.m_mx;
|
||||
m_y = info.m_my;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
SInt32 x, y, w, h, mx, my;
|
||||
client->getShape(x, y, w, h);
|
||||
client->getCenter(mx, my);
|
||||
log((CLOG_INFO "screen \"%s\" shape=%d,%d %dx%d zone=%d pos=%d,%d", name.c_str(), x, y, w, h, client->getJumpZoneSize(), m_x, m_y));
|
||||
}
|
||||
#endif
|
||||
log((CLOG_INFO "screen \"%s\" shape=%d,%d %dx%d zone=%d pos=%d,%d", name.c_str(), info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
|
||||
|
||||
// handle resolution change to primary screen
|
||||
if (client == m_primaryClient) {
|
||||
|
@ -272,27 +265,10 @@ CServer::onInfoChanged(const CString& name)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CServer::onGrabClipboard(ClipboardID id)
|
||||
bool
|
||||
CServer::onGrabClipboard(const CString& name, ClipboardID id, UInt32 seqNum)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
assert(m_primaryClient != NULL);
|
||||
grabClipboardNoLock(id, 0, m_primaryClient->getName());
|
||||
}
|
||||
|
||||
bool
|
||||
CServer::onGrabClipboard(ClipboardID id, UInt32 seqNum, const CString& client)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
return grabClipboardNoLock(id, seqNum, client);
|
||||
}
|
||||
|
||||
bool
|
||||
CServer::grabClipboardNoLock(ClipboardID id,
|
||||
UInt32 seqNum, const CString& name)
|
||||
{
|
||||
// note -- must be locked on entry
|
||||
CClipboardInfo& clipboard = m_clipboards[id];
|
||||
|
||||
// screen must be connected
|
||||
CClientList::iterator grabber = m_clients.find(name);
|
||||
|
@ -302,6 +278,7 @@ CServer::grabClipboardNoLock(ClipboardID id,
|
|||
|
||||
// ignore grab if sequence number is old. always allow primary
|
||||
// screen to grab.
|
||||
CClipboardInfo& clipboard = m_clipboards[id];
|
||||
if (name != m_primaryClient->getName() &&
|
||||
seqNum < clipboard.m_clipboardSeqNum) {
|
||||
log((CLOG_INFO "ignored screen \"%s\" grab of clipboard %d", name.c_str(), id));
|
||||
|
@ -337,8 +314,7 @@ CServer::grabClipboardNoLock(ClipboardID id,
|
|||
}
|
||||
|
||||
void
|
||||
CServer::onClipboardChanged(ClipboardID id,
|
||||
UInt32 seqNum, const CString& data)
|
||||
CServer::onClipboardChanged(ClipboardID id, UInt32 seqNum, const CString& data)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
onClipboardChangedNoLock(id, seqNum, data);
|
||||
|
@ -760,7 +736,8 @@ CServer::switchScreen(IClient* dst, SInt32 x, SInt32 y, bool screenSaver)
|
|||
if (clipboard.m_clipboardOwner == m_primaryClient->getName()) {
|
||||
CString clipboardData;
|
||||
m_primaryClient->getClipboard(id, clipboardData);
|
||||
onClipboardChangedNoLock(id, m_seqNum, clipboardData);
|
||||
onClipboardChangedNoLock(id,
|
||||
clipboard.m_clipboardSeqNum, clipboardData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
#include "IServer.h"
|
||||
#include "CConfig.h"
|
||||
#include "CClipboard.h"
|
||||
#include "ClipboardTypes.h"
|
||||
#include "KeyTypes.h"
|
||||
#include "MouseTypes.h"
|
||||
#include "CNetworkAddress.h"
|
||||
#include "CCondVar.h"
|
||||
#include "CMutex.h"
|
||||
#include "CThread.h"
|
||||
|
@ -59,11 +55,9 @@ public:
|
|||
|
||||
// IServer overrides
|
||||
virtual void onError();
|
||||
virtual void onInfoChanged(const CString& clientName);
|
||||
virtual bool onGrabClipboard(ClipboardID,
|
||||
UInt32 seqNum, const CString& clientName);
|
||||
virtual void onClipboardChanged(ClipboardID,
|
||||
UInt32 seqNum, const CString& data);
|
||||
virtual void onInfoChanged(const CString&, const CClientInfo&);
|
||||
virtual bool onGrabClipboard(const CString&, ClipboardID, UInt32);
|
||||
virtual void onClipboardChanged(ClipboardID, UInt32, const CString&);
|
||||
virtual void onKeyDown(KeyID, KeyModifierMask);
|
||||
virtual void onKeyUp(KeyID, KeyModifierMask);
|
||||
virtual void onKeyRepeat(KeyID, KeyModifierMask, SInt32 count);
|
||||
|
@ -72,7 +66,6 @@ public:
|
|||
virtual bool onMouseMovePrimary(SInt32 x, SInt32 y);
|
||||
virtual void onMouseMoveSecondary(SInt32 dx, SInt32 dy);
|
||||
virtual void onMouseWheel(SInt32 delta);
|
||||
virtual void onGrabClipboard(ClipboardID);
|
||||
virtual void onScreenSaver(bool activated);
|
||||
|
||||
protected:
|
||||
|
@ -85,10 +78,6 @@ private:
|
|||
bool onMouseMovePrimaryNoLock(SInt32 x, SInt32 y);
|
||||
void onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy);
|
||||
|
||||
// grab the clipboard
|
||||
bool grabClipboardNoLock(ClipboardID,
|
||||
UInt32 seqNum, const CString& clientName);
|
||||
|
||||
// set the clipboard
|
||||
void onClipboardChangedNoLock(ClipboardID,
|
||||
UInt32 seqNum, const CString& data);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "CXWindowsPrimaryScreen.h"
|
||||
#include "IPrimaryReceiver.h"
|
||||
#include "CXWindowsClipboard.h"
|
||||
#include "CXWindowsScreenSaver.h"
|
||||
#include "CXWindowsUtil.h"
|
||||
#include "CClipboard.h"
|
||||
#include "IServer.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "CThread.h"
|
||||
#include "CLog.h"
|
||||
#include "CStopwatch.h"
|
||||
|
@ -20,8 +21,8 @@
|
|||
// CXWindowsPrimaryScreen
|
||||
//
|
||||
|
||||
CXWindowsPrimaryScreen::CXWindowsPrimaryScreen(IPrimaryReceiver* receiver) :
|
||||
m_receiver(receiver),
|
||||
CXWindowsPrimaryScreen::CXWindowsPrimaryScreen(IServer* server) :
|
||||
m_server(server),
|
||||
m_active(false),
|
||||
m_window(None)
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ CXWindowsPrimaryScreen::run()
|
|||
if (xevent.xclient.message_type == m_atomScreenSaver ||
|
||||
xevent.xclient.format == 32) {
|
||||
// screen saver activation/deactivation event
|
||||
m_receiver->onScreenSaver(xevent.xclient.data.l[0] != 0);
|
||||
m_server->onScreenSaver(xevent.xclient.data.l[0] != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -76,12 +77,12 @@ CXWindowsPrimaryScreen::run()
|
|||
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
|
||||
const KeyID key = mapKey(&xevent.xkey);
|
||||
if (key != kKeyNone) {
|
||||
m_receiver->onKeyDown(key, mask);
|
||||
m_server->onKeyDown(key, mask);
|
||||
if (key == XK_Caps_Lock && m_capsLockHalfDuplex) {
|
||||
m_receiver->onKeyUp(key, mask | KeyModifierCapsLock);
|
||||
m_server->onKeyUp(key, mask | KeyModifierCapsLock);
|
||||
}
|
||||
else if (key == XK_Num_Lock && m_numLockHalfDuplex) {
|
||||
m_receiver->onKeyUp(key, mask | KeyModifierNumLock);
|
||||
m_server->onKeyUp(key, mask | KeyModifierNumLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,12 +112,12 @@ CXWindowsPrimaryScreen::run()
|
|||
// no press event follows so it's a plain release
|
||||
log((CLOG_DEBUG1 "event: KeyRelease code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
||||
if (key == XK_Caps_Lock && m_capsLockHalfDuplex) {
|
||||
m_receiver->onKeyDown(key, mask);
|
||||
m_server->onKeyDown(key, mask);
|
||||
}
|
||||
else if (key == XK_Num_Lock && m_numLockHalfDuplex) {
|
||||
m_receiver->onKeyDown(key, mask);
|
||||
m_server->onKeyDown(key, mask);
|
||||
}
|
||||
m_receiver->onKeyUp(key, mask);
|
||||
m_server->onKeyUp(key, mask);
|
||||
}
|
||||
else {
|
||||
// found a press event following so it's a repeat.
|
||||
|
@ -124,7 +125,7 @@ CXWindowsPrimaryScreen::run()
|
|||
// repeats but we'll just send a repeat of 1.
|
||||
// note that we discard the press event.
|
||||
log((CLOG_DEBUG1 "event: repeat code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
||||
m_receiver->onKeyRepeat(key, mask, 1);
|
||||
m_server->onKeyRepeat(key, mask, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +136,7 @@ CXWindowsPrimaryScreen::run()
|
|||
log((CLOG_DEBUG1 "event: ButtonPress button=%d", xevent.xbutton.button));
|
||||
const ButtonID button = mapButton(xevent.xbutton.button);
|
||||
if (button != kButtonNone) {
|
||||
m_receiver->onMouseDown(button);
|
||||
m_server->onMouseDown(button);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -145,15 +146,15 @@ CXWindowsPrimaryScreen::run()
|
|||
log((CLOG_DEBUG1 "event: ButtonRelease button=%d", xevent.xbutton.button));
|
||||
const ButtonID button = mapButton(xevent.xbutton.button);
|
||||
if (button != kButtonNone) {
|
||||
m_receiver->onMouseUp(button);
|
||||
m_server->onMouseUp(button);
|
||||
}
|
||||
else if (xevent.xbutton.button == 4) {
|
||||
// wheel forward (away from user)
|
||||
m_receiver->onMouseWheel(120);
|
||||
m_server->onMouseWheel(120);
|
||||
}
|
||||
else if (xevent.xbutton.button == 5) {
|
||||
// wheel backward (toward user)
|
||||
m_receiver->onMouseWheel(-120);
|
||||
m_server->onMouseWheel(-120);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -184,7 +185,7 @@ CXWindowsPrimaryScreen::run()
|
|||
}
|
||||
else if (!m_active) {
|
||||
// motion on primary screen
|
||||
m_receiver->onMouseMovePrimary(m_x, m_y);
|
||||
m_server->onMouseMovePrimary(m_x, m_y);
|
||||
}
|
||||
else {
|
||||
// motion on secondary screen. warp mouse back to
|
||||
|
@ -215,7 +216,7 @@ CXWindowsPrimaryScreen::run()
|
|||
// warping to the primary screen's enter position,
|
||||
// effectively overriding it.
|
||||
if (x != 0 || y != 0) {
|
||||
m_receiver->onMouseMoveSecondary(x, y);
|
||||
m_server->onMouseMoveSecondary(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,8 +270,8 @@ CXWindowsPrimaryScreen::open()
|
|||
}
|
||||
|
||||
// save mouse position
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
m_x = mx;
|
||||
m_y = my;
|
||||
}
|
||||
|
||||
// save position of center of screen
|
||||
|
@ -278,7 +279,15 @@ CXWindowsPrimaryScreen::open()
|
|||
m_yCenter = y + (h >> 1);
|
||||
|
||||
// send screen info
|
||||
m_receiver->onInfoChanged(x, y, w, h, 1, m_x, m_y);
|
||||
CClientInfo info;
|
||||
info.m_x = x;
|
||||
info.m_y = y;
|
||||
info.m_w = w;
|
||||
info.m_h = h;
|
||||
info.m_zoneSize = 1;
|
||||
info.m_mx = m_x;
|
||||
info.m_my = m_y;
|
||||
m_server->onInfoChanged("", info);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -586,14 +595,14 @@ void
|
|||
CXWindowsPrimaryScreen::onUnexpectedClose()
|
||||
{
|
||||
// tell server to shutdown
|
||||
m_receiver->onError();
|
||||
m_server->onError();
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsPrimaryScreen::onLostClipboard(ClipboardID id)
|
||||
{
|
||||
// tell server that the clipboard was grabbed locally
|
||||
m_receiver->onGrabClipboard(id);
|
||||
m_server->onGrabClipboard("", id, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#include "IPrimaryScreen.h"
|
||||
#include "MouseTypes.h"
|
||||
|
||||
class IPrimaryReceiver;
|
||||
class IServer;
|
||||
|
||||
class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
|
||||
public:
|
||||
CXWindowsPrimaryScreen(IPrimaryReceiver*);
|
||||
CXWindowsPrimaryScreen(IServer*);
|
||||
virtual ~CXWindowsPrimaryScreen();
|
||||
|
||||
// IPrimaryScreen overrides
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
static Bool findKeyEvent(Display*, XEvent* xevent, XPointer arg);
|
||||
|
||||
private:
|
||||
IPrimaryReceiver* m_receiver;
|
||||
IServer* m_server;
|
||||
bool m_active;
|
||||
Window m_window;
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
#ifndef IPRIMARYRECEIVER_H
|
||||
#define IPRIMARYRECEIVER_H
|
||||
|
||||
#include "IInterface.h"
|
||||
#include "ClipboardTypes.h"
|
||||
#include "KeyTypes.h"
|
||||
#include "MouseTypes.h"
|
||||
#include "CString.h"
|
||||
|
||||
class IPrimaryReceiver : public IInterface {
|
||||
public:
|
||||
// manipulators
|
||||
|
||||
// notify of serious error. this implies that the primary screen
|
||||
// cannot continue to function.
|
||||
virtual void onError() = 0;
|
||||
|
||||
// notify of info change
|
||||
virtual void onInfoChanged(SInt32 xScreen, SInt32 yScreen,
|
||||
SInt32 wScreen, SInt32 hScreen,
|
||||
SInt32 zoneSize,
|
||||
SInt32 xMouse, SInt32 yMouse) = 0;
|
||||
|
||||
// notify of clipboard grab. returns true if the grab was honored,
|
||||
// false otherwise.
|
||||
virtual bool onGrabClipboard(ClipboardID) = 0;
|
||||
|
||||
// notify of new clipboard data. returns true if the clipboard data
|
||||
// was accepted, false if the change was rejected.
|
||||
virtual bool onClipboardChanged(ClipboardID,
|
||||
const CString& data) = 0;
|
||||
|
||||
// call to notify of events. onMouseMovePrimary() returns
|
||||
// true iff the mouse enters a jump zone and jumps.
|
||||
virtual void onKeyDown(KeyID, KeyModifierMask) = 0;
|
||||
virtual void onKeyUp(KeyID, KeyModifierMask) = 0;
|
||||
virtual void onKeyRepeat(KeyID, KeyModifierMask, SInt32 count) = 0;
|
||||
virtual void onMouseDown(ButtonID) = 0;
|
||||
virtual void onMouseUp(ButtonID) = 0;
|
||||
virtual bool onMouseMovePrimary(SInt32 x, SInt32 y) = 0;
|
||||
virtual void onMouseMoveSecondary(SInt32 dx, SInt32 dy) = 0;
|
||||
virtual void onMouseWheel(SInt32 delta) = 0;
|
||||
virtual void onScreenSaver(bool activated) = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -19,7 +19,6 @@ synergyd_SOURCES = \
|
|||
CPrimaryClient.h \
|
||||
CServer.h \
|
||||
CXWindowsPrimaryScreen.h \
|
||||
IPrimaryReceiver.h \
|
||||
IPrimaryScreen.h \
|
||||
$(NULL)
|
||||
synergyd_LDADD = \
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "MouseTypes.h"
|
||||
#include "CString.h"
|
||||
|
||||
class CClientInfo;
|
||||
|
||||
class IServer : public IInterface {
|
||||
public:
|
||||
// manipulators
|
||||
|
@ -15,13 +17,14 @@ public:
|
|||
// shutdown.
|
||||
virtual void onError() = 0;
|
||||
|
||||
// notify of client info change (maybe IClient should be named IScreen)
|
||||
virtual void onInfoChanged(const CString& clientName) = 0;
|
||||
// notify of client info change
|
||||
virtual void onInfoChanged(const CString& clientName,
|
||||
const CClientInfo&) = 0;
|
||||
|
||||
// notify of clipboard grab. returns true if the grab was honored,
|
||||
// false otherwise.
|
||||
virtual bool onGrabClipboard(ClipboardID,
|
||||
UInt32 seqNum, const CString& clientName) = 0;
|
||||
virtual bool onGrabClipboard(const CString& clientName,
|
||||
ClipboardID, UInt32 seqNum) = 0;
|
||||
|
||||
// notify of new clipboard data
|
||||
virtual void onClipboardChanged(ClipboardID,
|
||||
|
|
|
@ -159,5 +159,23 @@ static const char kMsgEUnknown[] = "EUNK";
|
|||
// primary should disconnect after sending this message.
|
||||
static const char kMsgEBad[] = "EBAD";
|
||||
|
||||
|
||||
//
|
||||
// structures
|
||||
//
|
||||
|
||||
class CClientInfo {
|
||||
public:
|
||||
// the coordinates of the screen
|
||||
SInt32 m_x, m_y;
|
||||
SInt32 m_w, m_h;
|
||||
|
||||
// the size of the jump zone
|
||||
SInt32 m_zoneSize;
|
||||
|
||||
// mouse position
|
||||
SInt32 m_mx, m_my;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue