From 93d74a1fda1883fb6a46eba1f9042db51056c597 Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 16 May 2004 18:04:36 +0000 Subject: [PATCH] Fixed handling of screen resolution changes. --- lib/client/CServerProxy.cpp | 4 +++- lib/server/CClientProxy1_0.cpp | 20 ++++++++++++-------- lib/synergy/ProtocolTypes.h | 9 ++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/client/CServerProxy.cpp b/lib/client/CServerProxy.cpp index 79e6698e..e9f91054 100644 --- a/lib/client/CServerProxy.cpp +++ b/lib/client/CServerProxy.cpp @@ -334,7 +334,8 @@ CServerProxy::sendInfo(const CClientInfo& info) LOG((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d", info.m_x, info.m_y, info.m_w, info.m_h)); CProtocolUtil::writef(m_stream, kMsgDInfo, info.m_x, info.m_y, - info.m_w, info.m_h, 0, 0, 0); + info.m_w, info.m_h, 0, + info.m_mx, info.m_my); } KeyID @@ -779,6 +780,7 @@ CServerProxy::queryInfo() { CClientInfo info; m_client->getShape(info.m_x, info.m_y, info.m_w, info.m_h); + m_client->getCursorPos(info.m_mx, info.m_my); sendInfo(info); } diff --git a/lib/server/CClientProxy1_0.cpp b/lib/server/CClientProxy1_0.cpp index 2bb412ce..3d2bd7e0 100644 --- a/lib/server/CClientProxy1_0.cpp +++ b/lib/server/CClientProxy1_0.cpp @@ -218,9 +218,11 @@ CClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const } void -CClientProxy1_0::getCursorPos(SInt32&, SInt32&) const +CClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const { - assert(0 && "shouldn't be called"); + // note -- this returns the cursor pos from when we last got client info + x = m_info.m_mx; + y = m_info.m_my; } void @@ -372,9 +374,9 @@ bool CClientProxy1_0::recvInfo() { // parse the message - SInt16 x, y, w, h, dummy1, dummy2, dummy3; + SInt16 x, y, w, h, dummy1, mx, my; if (!CProtocolUtil::readf(getStream(), kMsgDInfo + 4, - &x, &y, &w, &h, &dummy1, &dummy2, &dummy3)) { + &x, &y, &w, &h, &dummy1, &mx, &my)) { return false; } LOG((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d", getName().c_str(), x, y, w, h)); @@ -385,10 +387,12 @@ CClientProxy1_0::recvInfo() } // save - m_info.m_x = x; - m_info.m_y = y; - m_info.m_w = w; - m_info.m_h = h; + m_info.m_x = x; + m_info.m_y = y; + m_info.m_w = w; + m_info.m_h = h; + m_info.m_mx = mx; + m_info.m_my = my; // acknowledge receipt LOG((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str())); diff --git a/lib/synergy/ProtocolTypes.h b/lib/synergy/ProtocolTypes.h index 4fd6d475..b4b8ae22 100644 --- a/lib/synergy/ProtocolTypes.h +++ b/lib/synergy/ProtocolTypes.h @@ -201,7 +201,7 @@ static const char kMsgDClipboard[] = "DCLP%1i%4i%s"; // $2 = coordinate of topmost pixel on secondary screen, // $3 = width of secondary screen in pixels, // $4 = height of secondary screen in pixels, -// $5 = size of warp zone, +// $5 = size of warp zone, (obsolete) // $6, $7 = the x,y position of the mouse on the secondary screen. // // the secondary screen must send this message in response to the @@ -274,8 +274,11 @@ public: //! Obsolete (jump zone size) SInt32 obsolete1; - //! Obsolete (mouse position) - SInt32 obsolete2, obsolete3; + //! Mouse position + /*! + The current location of the mouse cursor. + */ + SInt32 m_mx, m_my; }; #endif