This should fix multimon support on win32.
This commit is contained in:
parent
380369d331
commit
125e81c92e
|
@ -383,11 +383,14 @@ CMSWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
|
|||
|
||||
// move the mouse directly to target position if motion is simple
|
||||
if (simple) {
|
||||
SInt32 x0, y0, w, h;
|
||||
m_screen->getShape(x0, y0, w, h);
|
||||
// when using absolute positioning with mouse_event(),
|
||||
// the normalized device coordinates range over only
|
||||
// the primary screen.
|
||||
SInt32 w = GetSystemMetrics(SM_CXSCREEN);
|
||||
SInt32 h = GetSystemMetrics(SM_CYSCREEN);
|
||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||
(DWORD)((65535.99 * (x - x0)) / (w - 1)),
|
||||
(DWORD)((65535.99 * (y - y0)) / (h - 1)),
|
||||
(DWORD)((65536.0 * x) / w),
|
||||
(DWORD)((65536.0 * y) / h),
|
||||
0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -217,12 +217,9 @@ 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;
|
||||
// get position
|
||||
SInt32 x = (SInt32)info->pt.x;
|
||||
SInt32 y = (SInt32)info->pt.y;
|
||||
|
||||
// relay the motion
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_MOUSE_MOVE, x, y);
|
||||
|
@ -231,10 +228,7 @@ mouseHook(int code, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
else {
|
||||
// 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.
|
||||
// check for mouse inside jump zone
|
||||
bool inside = false;
|
||||
const MOUSEHOOKSTRUCT* info = (const MOUSEHOOKSTRUCT*)lParam;
|
||||
SInt32 x = (SInt32)info->pt.x;
|
||||
|
@ -254,15 +248,11 @@ mouseHook(int code, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
// if inside then eat event and notify our window
|
||||
if (inside) {
|
||||
x += g_xScreen;
|
||||
y += g_yScreen;
|
||||
restoreCursor();
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_MOUSE_MOVE, x, y);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
x += g_xScreen;
|
||||
y += g_yScreen;
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_MOUSE_MOVE, x, y);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue