Another try at fixing broken mouse behavior when a windows system

has multiple monitors with 0,0 of the virtual desktop not at the
upper-left.
This commit is contained in:
crs 2003-01-14 19:46:17 +00:00
parent 0b67cdedf6
commit f7e936faa9
3 changed files with 15 additions and 12 deletions

View File

@ -310,13 +310,6 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
m_y = static_cast<SInt32>(msg->lParam); m_y = static_cast<SInt32>(msg->lParam);
if (!isActive()) { if (!isActive()) {
// shift by origin of virtual screen. the synergy
// hook DLL does not account for
SInt32 w, h;
m_screen->getShape(x, y, w, h);
x += m_x;
y += m_y;
// motion on primary screen // motion on primary screen
m_receiver->onMouseMovePrimary(x, y); m_receiver->onMouseMovePrimary(x, y);
} }

View File

@ -357,6 +357,7 @@ CMSWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
// motion is simple (i.e. it's on the primary monitor) if there // motion is simple (i.e. it's on the primary monitor) if there
// is only one monitor. // is only one monitor.
bool simple = !m_screen->isMultimon(); bool simple = !m_screen->isMultimon();
/* disable attempts to use simple motion with multiple monitors for now
if (!simple) { if (!simple) {
// also simple if motion is within the primary monitor // also simple if motion is within the primary monitor
simple = (x >= 0 && x < GetSystemMetrics(SM_CXSCREEN) && simple = (x >= 0 && x < GetSystemMetrics(SM_CXSCREEN) &&
@ -374,6 +375,7 @@ CMSWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
simple = (x0 == 0 && y0 == 0); simple = (x0 == 0 && y0 == 0);
} }
} }
*/
// move the mouse directly to target position on NT family or if // move the mouse directly to target position on NT family or if
// not using multiple monitors. // not using multiple monitors.

View File

@ -209,20 +209,28 @@ mouseHook(int code, WPARAM wParam, LPARAM lParam)
hideCursor(thread); hideCursor(thread);
} }
// get position. it seems the positions are not
// in virtual desktop coordinates but in a similar
// space with 0,0 at the upper-left. translate
// into virtual desktop coordinates.
SInt32 x = (SInt32)info->pt.x + g_xScreen;
SInt32 y = (SInt32)info->pt.y + g_yScreen;
// relay the motion // relay the motion
SInt32 x = (SInt32)info->pt.x;
SInt32 y = (SInt32)info->pt.y;
PostThreadMessage(g_threadID, SYNERGY_MSG_MOUSE_MOVE, x, y); PostThreadMessage(g_threadID, SYNERGY_MSG_MOUSE_MOVE, x, y);
} }
return 1; return 1;
} }
} }
else { else {
// check for mouse inside jump zone // check for mouse inside jump zone. it seems the positions
// are not in virtual desktop coordinates but in a similar
// space with 0,0 at the upper-left. translate into virtual
// desktop coordinates.
bool inside = false; bool inside = false;
const MOUSEHOOKSTRUCT* info = (const MOUSEHOOKSTRUCT*)lParam; const MOUSEHOOKSTRUCT* info = (const MOUSEHOOKSTRUCT*)lParam;
SInt32 x = (SInt32)info->pt.x; SInt32 x = (SInt32)info->pt.x + g_xScreen;
SInt32 y = (SInt32)info->pt.y; SInt32 y = (SInt32)info->pt.y + g_yScreen;
if (!inside && (g_zoneSides & kLeftMask) != 0) { if (!inside && (g_zoneSides & kLeftMask) != 0) {
inside = (x < g_xScreen + g_zoneSize); inside = (x < g_xScreen + g_zoneSize);
} }