mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-13 01: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)
|
// always report the mouse position to prevent the guest losing sync (ie: dragging windows)
|
||||||
POINT curPos;
|
POINT curPos;
|
||||||
if (GetCursorPos(&curPos) && (curPos.x != m_lastCursorX || curPos.y != m_lastCursorY))
|
if (GetCursorPos(&curPos))
|
||||||
{
|
{
|
||||||
ret |= GRAB_STATUS_CURSOR;
|
curPos.x -= m_hotSpot.x;
|
||||||
cursor.hasPos = true;
|
curPos.y -= m_hotSpot.y;
|
||||||
cursor.x = m_lastCursorX = curPos.x;
|
|
||||||
cursor.y = m_lastCursorY = curPos.y;
|
if (curPos.x != m_lastCursorX || curPos.y != m_lastCursorY)
|
||||||
cursor.visible = m_lastMouseVis;
|
{
|
||||||
|
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.w = shapeInfo.Width;
|
||||||
cursor.h = shapeInfo.Height;
|
cursor.h = shapeInfo.Height;
|
||||||
cursor.pitch = shapeInfo.Pitch;
|
cursor.pitch = shapeInfo.Pitch;
|
||||||
|
m_hotSpot.x = shapeInfo.HotSpot.x;
|
||||||
|
m_hotSpot.y = shapeInfo.HotSpot.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret & GRAB_STATUS_CURSOR)
|
if (ret & GRAB_STATUS_CURSOR)
|
||||||
|
@ -104,5 +104,6 @@ namespace Capture
|
|||||||
|
|
||||||
int m_lastCursorX, m_lastCursorY;
|
int m_lastCursorX, m_lastCursorY;
|
||||||
BOOL m_lastMouseVis;
|
BOOL m_lastMouseVis;
|
||||||
|
POINT m_hotSpot;
|
||||||
};
|
};
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user