Attempt to fix problems with multimon windows. The mouse position
reported by the synergy hook dll is in a space with 0,0 in the upper-left which is not necessarily the same as the virtual desktop space. So the windows primary screen now accounts for that. On the secondary screen, mouse_event() doesn't seem to accept negative coordinates even on the windows NT family, making monitors with negative coordinates inaccessible via absolute moves. So if the move will be to negative coordinates, use the windows 95 family fallback of absolute moving to 0,0 then relative moving to the final position.
This commit is contained in:
parent
6c1344a0d8
commit
1758ea6f9f
|
@ -310,8 +310,15 @@ 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(m_x, m_y);
|
m_receiver->onMouseMovePrimary(x, y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// motion on secondary screen. warp mouse back to
|
// motion on secondary screen. warp mouse back to
|
||||||
|
|
|
@ -354,9 +354,30 @@ CMSWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
|
||||||
static bool gotSendInput = false;
|
static bool gotSendInput = false;
|
||||||
static SendInput_t SendInput = NULL;
|
static SendInput_t SendInput = NULL;
|
||||||
|
|
||||||
|
// motion is simple (i.e. it's on the primary monitor) if there
|
||||||
|
// is only one monitor.
|
||||||
|
bool simple = !m_screen->isMultimon();
|
||||||
|
if (!simple) {
|
||||||
|
// also simple if motion is within the primary monitor
|
||||||
|
simple = (x >= 0 && x < GetSystemMetrics(SM_CXSCREEN) &&
|
||||||
|
y >= 0 && y < GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
if (!simple && !m_is95Family) {
|
||||||
|
// also simple if not on windows 95 family since the
|
||||||
|
// NT family mouse_event() allows absolute moves to
|
||||||
|
// any monitor.
|
||||||
|
//
|
||||||
|
// note -- this is possibly untrue if the primary
|
||||||
|
// monitor isn't upper-left most so limit it to that
|
||||||
|
// situation.
|
||||||
|
SInt32 x0, y0, w, h;
|
||||||
|
m_screen->getShape(x0, y0, w, h);
|
||||||
|
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.
|
||||||
if (!m_screen->isMultimon() || !m_is95Family) {
|
if (simple) {
|
||||||
SInt32 x0, y0, w, h;
|
SInt32 x0, y0, w, h;
|
||||||
m_screen->getShape(x0, y0, w, h);
|
m_screen->getShape(x0, y0, w, h);
|
||||||
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
|
||||||
|
|
Loading…
Reference in New Issue