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:
parent
0b67cdedf6
commit
f7e936faa9
|
@ -310,13 +310,6 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
|
|||
m_y = static_cast<SInt32>(msg->lParam);
|
||||
|
||||
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
|
||||
m_receiver->onMouseMovePrimary(x, y);
|
||||
}
|
||||
|
|
|
@ -357,6 +357,7 @@ CMSWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
|
|||
// motion is simple (i.e. it's on the primary monitor) if there
|
||||
// is only one monitor.
|
||||
bool simple = !m_screen->isMultimon();
|
||||
/* disable attempts to use simple motion with multiple monitors for now
|
||||
if (!simple) {
|
||||
// also simple if motion is within the primary monitor
|
||||
simple = (x >= 0 && x < GetSystemMetrics(SM_CXSCREEN) &&
|
||||
|
@ -374,6 +375,7 @@ CMSWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
|
|||
simple = (x0 == 0 && y0 == 0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// move the mouse directly to target position on NT family or if
|
||||
// not using multiple monitors.
|
||||
|
|
|
@ -209,20 +209,28 @@ mouseHook(int code, WPARAM wParam, LPARAM lParam)
|
|||
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
|
||||
SInt32 x = (SInt32)info->pt.x;
|
||||
SInt32 y = (SInt32)info->pt.y;
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_MOUSE_MOVE, x, y);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
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;
|
||||
const MOUSEHOOKSTRUCT* info = (const MOUSEHOOKSTRUCT*)lParam;
|
||||
SInt32 x = (SInt32)info->pt.x;
|
||||
SInt32 y = (SInt32)info->pt.y;
|
||||
SInt32 x = (SInt32)info->pt.x + g_xScreen;
|
||||
SInt32 y = (SInt32)info->pt.y + g_yScreen;
|
||||
if (!inside && (g_zoneSides & kLeftMask) != 0) {
|
||||
inside = (x < g_xScreen + g_zoneSize);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue