mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[host] correct mouse position with hotspot offset
This commit is contained in:
parent
ce4f1be2a6
commit
0e8678b182
@ -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;
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user