[host] use a global hook to obtain cursor move pos

This commit is contained in:
Geoffrey McRae
2019-01-11 23:58:50 +11:00
parent 5518ccb795
commit 1ef61f6cd3
7 changed files with 124 additions and 80 deletions

View File

@@ -539,8 +539,6 @@ unsigned int Capture::DXGI::Capture()
cursor.w = shapeInfo.Width;
cursor.h = shapeInfo.Height;
cursor.pitch = shapeInfo.Pitch;
m_hotSpot.x = shapeInfo.HotSpot.x;
m_hotSpot.y = shapeInfo.HotSpot.y;
}
// if we have a mouse update
@@ -556,24 +554,6 @@ unsigned int Capture::DXGI::Capture()
cursor.y = m_lastCursorY = frameInfo.PointerPosition.Position.y;
}
}
else
{
// always report the mouse position to prevent the guest losing sync (ie: dragging windows)
POINT curPos;
if (GetCursorPos(&curPos))
{
curPos.x -= m_hotSpot.x;
curPos.y -= m_hotSpot.y;
if (curPos.x != m_lastCursorX || curPos.y != m_lastCursorY)
{
ret |= GRAB_STATUS_CURSOR;
cursor.hasPos = true;
cursor.x = m_lastCursorX = curPos.x;
cursor.y = m_lastCursorY = curPos.y;
}
}
}
if (m_lastMouseVis != frameInfo.PointerPosition.Visible)
m_lastMouseVis = frameInfo.PointerPosition.Visible;