mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-08 11:44:10 +00:00
[host] correct mouse position with hotspot offset
This commit is contained in:
@@ -414,13 +414,19 @@ unsigned int Capture::DXGI::Capture()
|
||||
{
|
||||
// always report the mouse position to prevent the guest losing sync (ie: dragging windows)
|
||||
POINT curPos;
|
||||
if (GetCursorPos(&curPos) && (curPos.x != m_lastCursorX || curPos.y != m_lastCursorY))
|
||||
if (GetCursorPos(&curPos))
|
||||
{
|
||||
ret |= GRAB_STATUS_CURSOR;
|
||||
cursor.hasPos = true;
|
||||
cursor.x = m_lastCursorX = curPos.x;
|
||||
cursor.y = m_lastCursorY = curPos.y;
|
||||
cursor.visible = m_lastMouseVis;
|
||||
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;
|
||||
cursor.visible = m_lastMouseVis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,6 +484,8 @@ 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 (ret & GRAB_STATUS_CURSOR)
|
||||
|
@@ -104,5 +104,6 @@ namespace Capture
|
||||
|
||||
int m_lastCursorX, m_lastCursorY;
|
||||
BOOL m_lastMouseVis;
|
||||
POINT m_hotSpot;
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user