Fixed problem with multimonitor on OS X. The bug was simply that
the cursor wasn't being parked in the center of the main screen but instead at the center of the total display surface. This could place it off or dangerously close to the edge of the transparent window that covers the main screen and prevent synergy from capturing mouse motion.
This commit is contained in:
parent
7c7b41d751
commit
fe044cfab1
|
@ -52,7 +52,7 @@ COSXScreen::COSXScreen(bool isPrimary) :
|
||||||
Rect bounds = { 100, 100, 101, 101 };
|
Rect bounds = { 100, 100, 101, 101 };
|
||||||
|
|
||||||
// m_hiddenWindow is a window meant to let us get mouse moves
|
// m_hiddenWindow is a window meant to let us get mouse moves
|
||||||
// when the focus is on this computer. If you get your event
|
// when the focus is on another computer. If you get your event
|
||||||
// from the application event target you'll get every mouse
|
// from the application event target you'll get every mouse
|
||||||
// moves. On the other hand the Window event target will only
|
// moves. On the other hand the Window event target will only
|
||||||
// get events when the mouse moves over the window.
|
// get events when the mouse moves over the window.
|
||||||
|
@ -428,7 +428,6 @@ COSXScreen::leave()
|
||||||
updateKeys();
|
updateKeys();
|
||||||
|
|
||||||
// warp to center
|
// warp to center
|
||||||
// FIXME -- this should be the center of the main monitor
|
|
||||||
warpCursor(m_xCenter, m_yCenter);
|
warpCursor(m_xCenter, m_yCenter);
|
||||||
|
|
||||||
// capture events
|
// capture events
|
||||||
|
@ -940,16 +939,14 @@ COSXScreen::updateScreenShape()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGDirectDisplayID* displays =
|
CGDirectDisplayID* displays = new CGDirectDisplayID[displayCount];
|
||||||
(CGDirectDisplayID*)malloc(displayCount * sizeof(CGDirectDisplayID));
|
|
||||||
|
|
||||||
if (displays == NULL) {
|
if (displays == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CGGetActiveDisplayList(displayCount,
|
if (CGGetActiveDisplayList(displayCount,
|
||||||
displays, &displayCount) != CGDisplayNoErr) {
|
displays, &displayCount) != CGDisplayNoErr) {
|
||||||
free(displays);
|
delete[] displays;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,11 +964,18 @@ COSXScreen::updateScreenShape()
|
||||||
m_h = (SInt32)totalBounds.size.height;
|
m_h = (SInt32)totalBounds.size.height;
|
||||||
|
|
||||||
// get center of default screen
|
// get center of default screen
|
||||||
// XXX -- this should compute the center of displays[0]
|
GDHandle mainScreen = GetMainDevice();
|
||||||
|
if (mainScreen != NULL) {
|
||||||
|
const Rect& rect = (*mainScreen)->gdRect;
|
||||||
|
m_xCenter = (rect.left + rect.right) / 2;
|
||||||
|
m_yCenter = (rect.top + rect.bottom) / 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
m_xCenter = m_x + (m_w >> 1);
|
m_xCenter = m_x + (m_w >> 1);
|
||||||
m_yCenter = m_y + (m_h >> 1);
|
m_yCenter = m_y + (m_h >> 1);
|
||||||
|
}
|
||||||
|
|
||||||
free(displays);
|
delete[] displays;
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d on %u %s", m_x, m_y, m_w, m_h, displayCount, (displayCount == 1) ? "display" : "displays"));
|
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d on %u %s", m_x, m_y, m_w, m_h, displayCount, (displayCount == 1) ? "display" : "displays"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue