Fix a bug when a Windows XP client sends an invalid mouse position to

the server at initial connect.

PR: ports/114869
Submitted by: ehaupt
This commit is contained in:
Kevin Lo 2007-07-25 01:25:03 +00:00
parent 67f7a2644f
commit dd66eb13d3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=196235
3 changed files with 59 additions and 1 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= synergy
PORTVERSION= 1.3.1
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}2

View file

@ -0,0 +1,28 @@
--- ./lib/server/CClientProxy1_0.cpp.orig 2006-04-02 03:47:03.000000000 +0200
+++ ./lib/server/CClientProxy1_0.cpp 2007-07-24 16:59:59.000000000 +0200
@@ -401,7 +401,7 @@
&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));
+ LOG((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d mouse=%d,%d", getName().c_str(), x, y, w, h, mx, my));
// validate
if (w <= 0 || h <= 0) {
@@ -413,8 +413,14 @@
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;
+
+ if(mx >= x && mx < x+w && my >= y && my < y+h) {
+ m_info.m_mx = mx;
+ m_info.m_my = my;
+ } else {
+ m_info.m_mx = x + w/2;
+ m_info.m_my = y + h/2;
+ }
// acknowledge receipt
LOG((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str()));

View file

@ -0,0 +1,30 @@
--- ./lib/server/CServer.cpp.orig 2006-04-02 03:47:04.000000000 +0200
+++ ./lib/server/CServer.cpp 2007-07-24 16:59:59.000000000 +0200
@@ -434,16 +434,23 @@
SInt32 x, SInt32 y, bool forScreensaver)
{
assert(dst != NULL);
+ assert(m_active != NULL);
+
+ LOG((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", getName(m_active).c_str(), getName(dst).c_str(), x, y));
+
#ifndef NDEBUG
{
SInt32 dx, dy, dw, dh;
dst->getShape(dx, dy, dw, dh);
- assert(x >= dx && y >= dy && x < dx + dw && y < dy + dh);
+
+ if(!(x >= dx && y >= dy && x < dx + dw && y < dy + dh)) {
+ LOG((CLOG_ERR "debug check failed"));
+ LOG((CLOG_ERR "x=%d dx=%d dw=%d", x, dx, dw));
+ LOG((CLOG_ERR "y=%d dy=%d dh=%d", y, dy, dh));
+ assert(0);
+ }
}
#endif
- assert(m_active != NULL);
-
- LOG((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", getName(m_active).c_str(), getName(dst).c_str(), x, y));
// stop waiting to switch
stopSwitch();