mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 08:36:28 +00:00
[host] correct cursor visibility information
This commit is contained in:
parent
0e8678b182
commit
f36fd5ac1a
@ -389,47 +389,6 @@ unsigned int Capture::DXGI::Capture()
|
|||||||
return GRAB_STATUS_ERROR;
|
return GRAB_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we have a mouse update
|
|
||||||
if (frameInfo.LastMouseUpdateTime.QuadPart)
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
m_lastCursorX != frameInfo.PointerPosition.Position.x ||
|
|
||||||
m_lastCursorY != frameInfo.PointerPosition.Position.y
|
|
||||||
) {
|
|
||||||
ret |= GRAB_STATUS_CURSOR;
|
|
||||||
cursor.hasPos = true;
|
|
||||||
cursor.x = m_lastCursorX = frameInfo.PointerPosition.Position.x;
|
|
||||||
cursor.y = m_lastCursorY = frameInfo.PointerPosition.Position.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_lastMouseVis != frameInfo.PointerPosition.Visible)
|
|
||||||
{
|
|
||||||
ret |= GRAB_STATUS_CURSOR;
|
|
||||||
m_lastMouseVis = frameInfo.PointerPosition.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor.visible = m_lastMouseVis == TRUE;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
cursor.visible = m_lastMouseVis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the pointer shape has changed
|
// if the pointer shape has changed
|
||||||
if (frameInfo.PointerShapeBufferSize > 0)
|
if (frameInfo.PointerShapeBufferSize > 0)
|
||||||
{
|
{
|
||||||
@ -488,6 +447,42 @@ unsigned int Capture::DXGI::Capture()
|
|||||||
m_hotSpot.y = shapeInfo.HotSpot.y;
|
m_hotSpot.y = shapeInfo.HotSpot.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we have a mouse update
|
||||||
|
if (frameInfo.LastMouseUpdateTime.QuadPart)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
m_lastCursorX != frameInfo.PointerPosition.Position.x ||
|
||||||
|
m_lastCursorY != frameInfo.PointerPosition.Position.y
|
||||||
|
) {
|
||||||
|
ret |= GRAB_STATUS_CURSOR;
|
||||||
|
cursor.hasPos = true;
|
||||||
|
cursor.x = m_lastCursorX = frameInfo.PointerPosition.Position.x;
|
||||||
|
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;
|
||||||
|
cursor.visible = m_lastMouseVis == TRUE;
|
||||||
|
|
||||||
if (ret & GRAB_STATUS_CURSOR)
|
if (ret & GRAB_STATUS_CURSOR)
|
||||||
{
|
{
|
||||||
// push the cursor update into the queue
|
// push the cursor update into the queue
|
||||||
|
@ -360,9 +360,6 @@ DWORD Service::CursorThread()
|
|||||||
flags |= KVMFR_CURSOR_FLAG_POS;
|
flags |= KVMFR_CURSOR_FLAG_POS;
|
||||||
cursor->x = ci.x;
|
cursor->x = ci.x;
|
||||||
cursor->y = ci.y;
|
cursor->y = ci.y;
|
||||||
|
|
||||||
if (ci.visible)
|
|
||||||
flags |= KVMFR_CURSOR_FLAG_VISIBLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci.shape)
|
if (ci.shape)
|
||||||
@ -384,8 +381,11 @@ DWORD Service::CursorThread()
|
|||||||
memcpy(m_cursorData, ci.shape->buffer, ci.shape->bufferSize);
|
memcpy(m_cursorData, ci.shape->buffer, ci.shape->bufferSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flags |= KVMFR_CURSOR_FLAG_UPDATE;
|
|
||||||
|
|
||||||
|
if (ci.visible)
|
||||||
|
flags |= KVMFR_CURSOR_FLAG_VISIBLE;
|
||||||
|
|
||||||
|
flags |= KVMFR_CURSOR_FLAG_UPDATE;
|
||||||
cursor->flags = flags;
|
cursor->flags = flags;
|
||||||
m_capture->FreeCursor(ci);
|
m_capture->FreeCursor(ci);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user