applied refactoring to win32 code.

This commit is contained in:
crs 2002-07-11 13:13:37 +00:00
parent 3468f3d503
commit feeb15a08d
18 changed files with 201 additions and 164 deletions

View File

@ -191,8 +191,7 @@ CClient::close()
}
void
CClient::enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, bool)
CClient::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool)
{
{
CLock lock(&m_mutex);
@ -216,6 +215,8 @@ CClient::leave()
sendClipboard(id);
}
}
return true;
}
void

View File

@ -1,5 +1,5 @@
#include "CMSWindowsSecondaryScreen.h"
#include "CClient.h"
#include "IScreenReceiver.h"
#include "CClipboard.h"
#include "CMSWindowsClipboard.h"
#include "CMSWindowsScreenSaver.h"
@ -22,8 +22,9 @@
// CMSWindowsSecondaryScreen
//
CMSWindowsSecondaryScreen::CMSWindowsSecondaryScreen() :
m_client(NULL),
CMSWindowsSecondaryScreen::CMSWindowsSecondaryScreen(
IScreenReceiver* receiver) :
m_receiver(receiver),
m_threadID(0),
m_lastThreadID(0),
m_desk(NULL),
@ -32,6 +33,8 @@ CMSWindowsSecondaryScreen::CMSWindowsSecondaryScreen() :
m_active(false),
m_nextClipboardWindow(NULL)
{
assert(m_receiver != NULL);
m_is95Family = CPlatform::isWindows95Family();
// make sure this thread has a message queue
@ -78,14 +81,8 @@ CMSWindowsSecondaryScreen::stop()
}
void
CMSWindowsSecondaryScreen::open(CClient* client)
CMSWindowsSecondaryScreen::open()
{
assert(m_client == NULL);
assert(client != NULL);
// set the client
m_client = client;
// open the display
openDisplay();
@ -109,8 +106,6 @@ CMSWindowsSecondaryScreen::open(CClient* client)
void
CMSWindowsSecondaryScreen::close()
{
assert(m_client != NULL);
// release keys that are logically pressed
releaseKeys();
@ -119,9 +114,6 @@ CMSWindowsSecondaryScreen::close()
// close the display
closeDisplay();
// done with client
m_client = NULL;
}
void
@ -189,8 +181,8 @@ CMSWindowsSecondaryScreen::leave()
if (m_clipboardOwner != clipboardOwner) {
m_clipboardOwner = clipboardOwner;
if (m_clipboardOwner != m_window) {
m_client->onClipboardChanged(kClipboardClipboard);
m_client->onClipboardChanged(kClipboardSelection);
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
}
@ -555,8 +547,8 @@ CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
// window to do that).
m_clipboardOwner = GetClipboardOwner();
if (m_clipboardOwner != m_window && m_clipboardOwner != NULL) {
m_client->onClipboardChanged(kClipboardClipboard);
m_client->onClipboardChanged(kClipboardSelection);
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
return 0;
@ -573,7 +565,13 @@ CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
// screen resolution has changed
updateScreenShape();
m_multimon = isMultimon();
m_client->onResolutionChanged();
// send new info
CClientInfo info;
getShape(info.m_x, info.m_y, info.m_w, info.m_h);
getMousePos(info.m_mx, info.m_my);
info.m_zoneSize = getJumpZoneSize();
m_receiver->onInfoChanged(info);
return 0;
}

View File

@ -13,16 +13,18 @@
#include "CString.h"
#include "stdvector.h"
class IScreenReceiver;
class CMSWindowsSecondaryScreen : public CMSWindowsScreen,
public ISecondaryScreen {
public:
CMSWindowsSecondaryScreen();
CMSWindowsSecondaryScreen(IScreenReceiver*);
virtual ~CMSWindowsSecondaryScreen();
// ISecondaryScreen overrides
virtual void run();
virtual void stop();
virtual void open(CClient*);
virtual void open();
virtual void close();
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute,
KeyModifierMask mask);
@ -95,7 +97,7 @@ private:
private:
CMutex m_mutex;
CClient* m_client;
IScreenReceiver* m_receiver;
// true if windows 95/98/me
bool m_is95Family;

View File

@ -239,6 +239,7 @@ CServerProxy::onGrabClipboard(ClipboardID id)
log((CLOG_DEBUG1 "sending clipboard %d changed", id));
CLock lock(&m_mutex);
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, m_seqNum);
return true;
}
void
@ -253,7 +254,7 @@ void
CServerProxy::flushCompressedMouse()
{
bool send = false;
SInt32 x, y;
SInt32 x = 0, y = 0;
{
CLock lock(&m_mutex);
if (m_compressMouse) {

View File

@ -108,6 +108,10 @@ SOURCE=.\client.rc
SOURCE=.\CMSWindowsSecondaryScreen.cpp
# End Source File
# Begin Source File
SOURCE=.\CServerProxy.cpp
# End Source File
# End Group
# Begin Group "Header Files"
@ -120,6 +124,18 @@ SOURCE=.\CClient.h
SOURCE=.\CMSWindowsSecondaryScreen.h
# End Source File
# Begin Source File
SOURCE=.\CServerProxy.h
# End Source File
# Begin Source File
SOURCE=.\ISecondaryScreen.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Resource Files"

View File

@ -1,8 +1,11 @@
#include "CMSWindowsPrimaryScreen.h"
#include "CServer.h"
#include "IScreenReceiver.h"
#include "IPrimaryScreenReceiver.h"
#include "CMSWindowsClipboard.h"
#include "CMSWindowsScreenSaver.h"
#include "CPlatform.h"
#include "CClipboard.h"
#include "ProtocolTypes.h"
#include "XScreen.h"
#include "XSynergy.h"
#include "CThread.h"
@ -13,8 +16,11 @@
// CMSWindowsPrimaryScreen
//
CMSWindowsPrimaryScreen::CMSWindowsPrimaryScreen() :
m_server(NULL),
CMSWindowsPrimaryScreen::CMSWindowsPrimaryScreen(
IScreenReceiver* receiver,
IPrimaryScreenReceiver* primaryReceiver) :
m_receiver(receiver),
m_primaryReceiver(primaryReceiver),
m_threadID(0),
m_desk(NULL),
m_deskName(),
@ -25,19 +31,24 @@ CMSWindowsPrimaryScreen::CMSWindowsPrimaryScreen() :
m_nextClipboardWindow(NULL),
m_clipboardOwner(NULL)
{
assert(m_receiver != NULL);
assert(m_primaryReceiver != NULL);
// load the hook library
m_hookLibrary = LoadLibrary("synrgyhk");
if (m_hookLibrary == NULL) {
log((CLOG_ERR "failed to load hook library"));
throw XScreenOpenFailure();
}
m_setSides = (SetSidesFunc)GetProcAddress(m_hookLibrary, "setSides");
m_setZone = (SetZoneFunc)GetProcAddress(m_hookLibrary, "setZone");
m_setRelay = (SetRelayFunc)GetProcAddress(m_hookLibrary, "setRelay");
m_install = (InstallFunc)GetProcAddress(m_hookLibrary, "install");
m_uninstall = (UninstallFunc)GetProcAddress(m_hookLibrary, "uninstall");
m_init = (InitFunc)GetProcAddress(m_hookLibrary, "init");
m_cleanup = (CleanupFunc)GetProcAddress(m_hookLibrary, "cleanup");
if (m_setZone == NULL ||
if (m_setSides == NULL ||
m_setZone == NULL ||
m_setRelay == NULL ||
m_install == NULL ||
m_uninstall == NULL ||
@ -114,14 +125,8 @@ CMSWindowsPrimaryScreen::stop()
}
void
CMSWindowsPrimaryScreen::open(CServer* server)
CMSWindowsPrimaryScreen::open()
{
assert(m_server == NULL);
assert(server != NULL);
// set the server
m_server = server;
// open the display
openDisplay();
@ -137,9 +142,12 @@ CMSWindowsPrimaryScreen::open(CServer* server)
m_y = pos.y;
// send screen info
SInt32 x, y, w, h;
getScreenShape(x, y, w, h);
m_server->setInfo(x, y, w, h, getJumpZoneSize(), m_x, m_y);
CClientInfo info;
getScreenShape(info.m_x, info.m_y, info.m_w, info.m_h);
info.m_zoneSize = getJumpZoneSize();
info.m_mx = m_x;
info.m_my = m_y;
m_receiver->onInfoChanged(info);
// compute center pixel of primary screen
m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
@ -148,6 +156,9 @@ CMSWindowsPrimaryScreen::open(CServer* server)
// get keyboard state
updateKeys();
// set jump zones
m_setZone(info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize);
// enter the screen
enterNoWarp();
}
@ -155,13 +166,8 @@ CMSWindowsPrimaryScreen::open(CServer* server)
void
CMSWindowsPrimaryScreen::close()
{
assert(m_server != NULL);
// close the display
closeDisplay();
// done with server
m_server = NULL;
}
void
@ -194,7 +200,7 @@ CMSWindowsPrimaryScreen::leave()
}
// relay all mouse and keyboard events
m_setRelay();
m_setRelay(true);
// get state of keys as we leave
updateKeys();
@ -239,8 +245,8 @@ CMSWindowsPrimaryScreen::leave()
try {
m_clipboardOwner = clipboardOwner;
if (m_clipboardOwner != m_window) {
m_server->grabClipboard(kClipboardClipboard);
m_server->grabClipboard(kClipboardSelection);
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
catch (XBadClient&) {
@ -252,14 +258,9 @@ CMSWindowsPrimaryScreen::leave()
}
void
CMSWindowsPrimaryScreen::onConfigure()
CMSWindowsPrimaryScreen::reconfigure(UInt32 activeSides)
{
if ((m_is95Family || m_desk != NULL) && !m_active) {
SInt32 x, y, w, h;
getScreenShape(x, y, w, h);
m_setZone(m_server->getActivePrimarySides(),
x, y, w, h, getJumpZoneSize());
}
m_setSides(activeSides);
}
void
@ -308,19 +309,6 @@ CMSWindowsPrimaryScreen::grabClipboard(ClipboardID /*id*/)
}
}
void
CMSWindowsPrimaryScreen::getShape(
SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
{
getScreenShape(x, y, w, h);
}
SInt32
CMSWindowsPrimaryScreen::getJumpZoneSize() const
{
return 1;
}
void
CMSWindowsPrimaryScreen::getClipboard(ClipboardID /*id*/,
IClipboard* dst) const
@ -390,17 +378,10 @@ CMSWindowsPrimaryScreen::isLockedToScreen() const
return false;
}
bool
CMSWindowsPrimaryScreen::isScreenSaverActive() const
{
return getScreenSaver()->isActive();
}
void
CMSWindowsPrimaryScreen::onOpenDisplay()
{
assert(m_window == NULL);
assert(m_server != NULL);
// save thread id. we'll need to pass this to the hook library.
m_threadID = GetCurrentThreadId();
@ -478,11 +459,11 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
const SInt32 repeat = (SInt32)(msg->lParam & 0xffff);
if (repeat >= 2) {
log((CLOG_DEBUG1 "event: key repeat key=%d mask=0x%04x count=%d", key, mask, repeat));
m_server->onKeyRepeat(key, mask, repeat);
m_primaryReceiver->onKeyRepeat(key, mask, repeat);
}
else {
log((CLOG_DEBUG1 "event: key press key=%d mask=0x%04x", key, mask));
m_server->onKeyDown(key, mask);
m_primaryReceiver->onKeyDown(key, mask);
}
// update key state
@ -491,7 +472,7 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
else {
// key release
log((CLOG_DEBUG1 "event: key release key=%d mask=0x%04x", key, mask));
m_server->onKeyUp(key, mask);
m_primaryReceiver->onKeyUp(key, mask);
// update key state
updateKey(msg->wParam, false);
@ -520,7 +501,7 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
case WM_RBUTTONDOWN:
log((CLOG_DEBUG1 "event: button press button=%d", button));
if (button != kButtonNone) {
m_server->onMouseDown(button);
m_primaryReceiver->onMouseDown(button);
m_keys[s_vkButton[button]] |= 0x80;
}
break;
@ -530,7 +511,7 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
case WM_RBUTTONUP:
log((CLOG_DEBUG1 "event: button release button=%d", button));
if (button != kButtonNone) {
m_server->onMouseUp(button);
m_primaryReceiver->onMouseUp(button);
m_keys[s_vkButton[button]] &= ~0x80;
}
break;
@ -542,7 +523,7 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
// ignore message if posted prior to last mark change
if (m_markReceived == m_mark) {
log((CLOG_ERR "event: button wheel delta=%d %d", msg->wParam, msg->lParam));
m_server->onMouseWheel(msg->wParam);
m_primaryReceiver->onMouseWheel(msg->wParam);
}
return true;
@ -552,7 +533,7 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
SInt32 x = static_cast<SInt32>(msg->wParam);
SInt32 y = static_cast<SInt32>(msg->lParam);
if (!m_active) {
m_server->onMouseMovePrimary(x, y);
m_primaryReceiver->onMouseMovePrimary(x, y);
}
else {
// compute motion delta. this is relative to the
@ -572,7 +553,7 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
warpCursorToCenter();
// send motion
m_server->onMouseMoveSecondary(x, y);
m_primaryReceiver->onMouseMoveSecondary(x, y);
}
}
else {
@ -591,11 +572,11 @@ CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
case SYNERGY_MSG_SCREEN_SAVER:
if (msg->wParam != 0) {
if (getScreenSaver()->checkStarted(msg->message, FALSE, 0)) {
m_server->onScreenSaver(true);
m_primaryReceiver->onScreenSaver(true);
}
}
else {
m_server->onScreenSaver(false);
m_primaryReceiver->onScreenSaver(false);
}
return true;
@ -655,8 +636,8 @@ CMSWindowsPrimaryScreen::onEvent(HWND hwnd, UINT msg,
try {
m_clipboardOwner = GetClipboardOwner();
if (m_clipboardOwner != m_window) {
m_server->grabClipboard(kClipboardClipboard);
m_server->grabClipboard(kClipboardSelection);
m_receiver->onGrabClipboard(kClipboardClipboard);
m_receiver->onGrabClipboard(kClipboardSelection);
}
}
catch (XBadClient&) {
@ -696,13 +677,21 @@ CMSWindowsPrimaryScreen::onEvent(HWND hwnd, UINT msg,
// tell hook about resize if not active
else {
onConfigure();
m_setZone(x, y, w, h, getJumpZoneSize());
}
// send new screen info
POINT pos;
GetCursorPos(&pos);
m_server->setInfo(x, y, w, h, getJumpZoneSize(), pos.x, pos.y);
CClientInfo info;
info.m_x = x;
info.m_y = y;
info.m_w = w;
info.m_h = h;
info.m_zoneSize = getJumpZoneSize();
info.m_mx = pos.x;
info.m_my = pos.y;
m_receiver->onInfoChanged(info);
}
return 0;
@ -727,8 +716,8 @@ CMSWindowsPrimaryScreen::enterNoWarp()
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &dummy, 0);
}
// install jump zones
onConfigure();
// watch jump zones
m_setRelay(false);
// restore active window and hide our window
onEnter();
@ -787,6 +776,12 @@ CMSWindowsPrimaryScreen::onLeave()
return true;
}
SInt32
CMSWindowsPrimaryScreen::getJumpZoneSize() const
{
return 1;
}
void
CMSWindowsPrimaryScreen::nextMark()
{
@ -956,8 +951,8 @@ CMSWindowsPrimaryScreen::switchDesktop(HDESK desk)
onLeave();
}
else {
// set jump zones
onConfigure();
// watch jump zones
m_setRelay(false);
// all messages prior to now are invalid
nextMark();

View File

@ -2,36 +2,36 @@
#define CMSWINDOWSPRIMARYSCREEN_H
#include "CMSWindowsScreen.h"
#include "IPrimaryScreen.h"
#include "CSynergyHook.h"
#include "MouseTypes.h"
#include "IPrimaryScreen.h"
#include "CString.h"
class IScreenReceiver;
class IPrimaryScreenReceiver;
class CMSWindowsPrimaryScreen : public CMSWindowsScreen, public IPrimaryScreen {
public:
typedef bool (CMSWindowsPrimaryScreen::*HookMethod)(int, WPARAM, LPARAM);
CMSWindowsPrimaryScreen();
CMSWindowsPrimaryScreen(IScreenReceiver*, IPrimaryScreenReceiver*);
virtual ~CMSWindowsPrimaryScreen();
// IPrimaryScreen overrides
virtual void run();
virtual void stop();
virtual void open(CServer*);
virtual void open();
virtual void close();
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute, bool);
virtual bool leave();
virtual void onConfigure();
virtual void reconfigure(UInt32 activeSides);
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
virtual void setClipboard(ClipboardID, const IClipboard*);
virtual void grabClipboard(ClipboardID);
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
virtual SInt32 getJumpZoneSize() const;
virtual void getClipboard(ClipboardID, IClipboard*) const;
virtual KeyModifierMask getToggleMask() const;
virtual bool isLockedToScreen() const;
virtual bool isScreenSaverActive() const;
protected:
// CMSWindowsScreen overrides
virtual bool onPreTranslate(MSG*);
@ -45,6 +45,8 @@ private:
void onEnter();
bool onLeave();
SInt32 getJumpZoneSize() const;
// warp mouse to center of primary display (used when computing
// motion deltas while mouse is on secondary screen).
void warpCursorToCenter();
@ -67,7 +69,8 @@ private:
void updateKey(UINT vkCode, bool press);
private:
CServer* m_server;
IScreenReceiver* m_receiver;
IPrimaryScreenReceiver* m_primaryReceiver;
// true if windows 95/98/me
bool m_is95Family;
@ -111,6 +114,7 @@ private:
CleanupFunc m_cleanup;
InstallFunc m_install;
UninstallFunc m_uninstall;
SetSidesFunc m_setSides;
SetZoneFunc m_setZone;
SetRelayFunc m_setRelay;
InstallScreenSaverFunc m_installScreenSaver;

View File

@ -43,9 +43,9 @@ CPrimaryClient::stop()
}
void
CPrimaryClient::reconfigure()
CPrimaryClient::reconfigure(UInt32 activeSides)
{
m_screen->reconfigure();
m_screen->reconfigure(activeSides);
}
void

View File

@ -20,7 +20,7 @@ public:
void stop();
// called by server when the configuration changes
void reconfigure();
void reconfigure(UInt32 activeSides);
// accessors

View File

@ -8,7 +8,6 @@
#include "ProtocolTypes.h"
#include "XScreen.h"
#include "XSynergy.h"
// XXX #include "CNetworkAddress.h"
#include "IDataSocket.h"
#include "IListenSocket.h"
#include "ISocketFactory.h"
@ -167,7 +166,7 @@ CServer::setConfig(const CConfig& config)
// tell primary screen about reconfiguration
if (m_primaryClient != NULL) {
m_primaryClient->reconfigure();
m_primaryClient->reconfigure(getActivePrimarySides());
}
return true;
@ -191,8 +190,8 @@ CServer::getConfig(CConfig* config) const
UInt32
CServer::getActivePrimarySides() const
{
// note -- m_mutex must be locked on entry
UInt32 sides = 0;
CLock lock(&m_mutex);
if (!m_config.getNeighbor(getPrimaryScreenName(),
CConfig::kLeft).empty()) {
sides |= CConfig::kLeftMask;
@ -723,7 +722,7 @@ CServer::switchScreen(IClient* dst, SInt32 x, SInt32 y, bool screenSaver)
// update the primary client's clipboards if we're leaving the
// primary screen.
if (m_active == m_primaryClient) {
for (UInt32 id = 0; id < kClipboardEnd; ++id) {
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
CClipboardInfo& clipboard = m_clipboards[id];
if (clipboard.m_clipboardOwner == m_primaryClient->getName()) {
CString clipboardData;
@ -973,14 +972,14 @@ CServer::closeClients(const CConfig& config)
index != m_clientThreads.end(); ) {
const CString& name = index->first;
if (!config.isCanonicalName(name)) {
// save the thread and remove it from m_clientThreads
threads.push_back(index->second);
m_clientThreads.erase(index++);
// lookup IClient with name
CClientList::const_iterator index2 = m_clients.find(name);
assert(index2 != m_clients.end());
// save the thread and remove it from m_clientThreads
threads.push_back(index->second);
m_clientThreads.erase(index++);
// close that client
assert(index2->second != m_primaryClient);
index2->second->close();
@ -1520,6 +1519,9 @@ CServer::openPrimaryScreen()
// open the screen
log((CLOG_DEBUG1 "opening primary screen"));
m_primaryClient->open();
// tell it about the active sides
m_primaryClient->reconfigure(getActivePrimarySides());
}
catch (...) {
if (m_active != NULL) {

View File

@ -50,9 +50,6 @@ public:
// get the primary screen's name
CString getPrimaryScreenName() const;
// get the sides of the primary screen that have neighbors
UInt32 getActivePrimarySides() const;
// IPrimaryScreenReceiver overrides
virtual void onError();
virtual void onKeyDown(KeyID, KeyModifierMask);
@ -76,6 +73,9 @@ protected:
private:
typedef std::list<CThread> CThreadList;
// get the sides of the primary screen that have neighbors
UInt32 getActivePrimarySides() const;
// handle mouse motion
bool onMouseMovePrimaryNoLock(SInt32 x, SInt32 y);
void onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy);

View File

@ -47,8 +47,8 @@ static HANDLE g_keyHookEvent = NULL;
static HHOOK g_keyboardLL = NULL;
static bool g_screenSaver = false;
static bool g_relay = false;
static SInt32 g_zoneSize = 0;
static UInt32 g_zoneSides = 0;
static SInt32 g_zoneSize = 0;
static SInt32 g_xScreen = 0;
static SInt32 g_yScreen = 0;
static SInt32 g_wScreen = 0;
@ -510,8 +510,8 @@ install()
// set defaults
g_relay = false;
g_zoneSize = 0;
g_zoneSides = 0;
g_zoneSize = 0;
g_xScreen = 0;
g_yScreen = 0;
g_wScreen = 0;
@ -681,30 +681,28 @@ uninstallScreenSaver(void)
}
void
setZone(UInt32 sides,
SInt32 x, SInt32 y, SInt32 w, SInt32 h,
SInt32 jumpZoneSize)
setSides(UInt32 sides)
{
g_zoneSize = jumpZoneSize;
g_zoneSides = sides;
g_xScreen = x;
g_yScreen = y;
g_wScreen = w;
g_hScreen = h;
g_relay = false;
restoreCursor();
}
void
setRelay(void)
setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize)
{
g_relay = true;
g_zoneSize = 0;
g_zoneSides = 0;
g_xScreen = 0;
g_yScreen = 0;
g_wScreen = 0;
g_hScreen = 0;
g_zoneSize = jumpZoneSize;
g_xScreen = x;
g_yScreen = y;
g_wScreen = w;
g_hScreen = h;
}
void
setRelay(int enable)
{
g_relay = (enable != 0);
if (!g_relay) {
restoreCursor();
}
}
}

View File

@ -32,9 +32,9 @@ typedef int (*InstallFunc)(void);
typedef int (*UninstallFunc)(void);
typedef int (*InstallScreenSaverFunc)(void);
typedef int (*UninstallScreenSaverFunc)(void);
typedef void (*SetZoneFunc)(UInt32,
SInt32, SInt32, SInt32, SInt32, SInt32);
typedef void (*SetRelayFunc)(void);
typedef void (*SetSidesFunc)(UInt32);
typedef void (*SetZoneFunc)(SInt32, SInt32, SInt32, SInt32, SInt32);
typedef void (*SetRelayFunc)(int);
CSYNERGYHOOK_API int init(DWORD);
CSYNERGYHOOK_API int cleanup(void);
@ -42,10 +42,10 @@ CSYNERGYHOOK_API int install(void);
CSYNERGYHOOK_API int uninstall(void);
CSYNERGYHOOK_API int installScreenSaver(void);
CSYNERGYHOOK_API int uninstallScreenSaver(void);
CSYNERGYHOOK_API void setZone(UInt32 sides,
SInt32 x, SInt32 y, SInt32 w, SInt32 h,
CSYNERGYHOOK_API void setSides(UInt32 sides);
CSYNERGYHOOK_API void setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h,
SInt32 jumpZoneSize);
CSYNERGYHOOK_API void setRelay(void);
CSYNERGYHOOK_API void setRelay(int enable); // relay iff enable != 0
}

View File

@ -397,7 +397,7 @@ CXWindowsPrimaryScreen::leave()
}
void
CXWindowsPrimaryScreen::reconfigure()
CXWindowsPrimaryScreen::reconfigure(UInt32)
{
// do nothing
}

View File

@ -20,7 +20,7 @@ public:
virtual void close();
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute, bool);
virtual bool leave();
virtual void reconfigure();
virtual void reconfigure(UInt32 activeSides);
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
virtual void setClipboard(ClipboardID, const IClipboard*);
virtual void grabClipboard(ClipboardID);

View File

@ -57,10 +57,10 @@ public:
// leave() must not call any receiver methods except onError().
virtual bool leave() = 0;
// called when the configuration has changed. subclasses may need
// to adjust things (like the jump zones) after the configuration
// changes.
virtual void reconfigure() = 0;
// called when the configuration has changed. activeSides is a
// bitmask of CConfig::EDirectionMask indicating which sides of
// the primary screen are linked to clients.
virtual void reconfigure(UInt32 activeSides) = 0;
// warp the cursor to the given position
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute) = 0;

View File

@ -94,6 +94,14 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\CClientProxy.cpp
# End Source File
# Begin Source File
SOURCE=.\CClientProxy1_0.cpp
# End Source File
# Begin Source File
SOURCE=.\CConfig.cpp
# End Source File
# Begin Source File
@ -106,18 +114,14 @@ SOURCE=.\CMSWindowsPrimaryScreen.cpp
# End Source File
# Begin Source File
SOURCE=.\CPrimaryClient.cpp
# End Source File
# Begin Source File
SOURCE=.\CServer.cpp
# End Source File
# Begin Source File
SOURCE=.\CServerProtocol.cpp
# End Source File
# Begin Source File
SOURCE=.\CServerProtocol1_0.cpp
# End Source File
# Begin Source File
SOURCE=.\server.cpp
# End Source File
# Begin Source File
@ -130,6 +134,14 @@ SOURCE=.\server.rc
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\CClientProxy.h
# End Source File
# Begin Source File
SOURCE=.\CClientProxy1_0.h
# End Source File
# Begin Source File
SOURCE=.\CConfig.h
# End Source File
# Begin Source File
@ -142,15 +154,15 @@ SOURCE=.\CMSWindowsPrimaryScreen.h
# End Source File
# Begin Source File
SOURCE=.\CPrimaryClient.h
# End Source File
# Begin Source File
SOURCE=.\CServer.h
# End Source File
# Begin Source File
SOURCE=.\CServerProtocol.h
# End Source File
# Begin Source File
SOURCE=.\CServerProtocol1_0.h
SOURCE=.\IPrimaryScreen.h
# End Source File
# Begin Source File

View File

@ -143,19 +143,27 @@ SOURCE=.\CTCPSocketFactory.h
# End Source File
# Begin Source File
SOURCE=.\IClient.h
# End Source File
# Begin Source File
SOURCE=.\IClipboard.h
# End Source File
# Begin Source File
SOURCE=.\IPrimaryScreen.h
SOURCE=.\IPrimaryScreenReceiver.h
# End Source File
# Begin Source File
SOURCE=.\ISecondaryScreen.h
SOURCE=.\IScreenReceiver.h
# End Source File
# Begin Source File
SOURCE=.\IServerProtocol.h
SOURCE=.\IScreenSaver.h
# End Source File
# Begin Source File
SOURCE=.\IServer.h
# End Source File
# Begin Source File