[host] don't spam the client with mouse updates when nothing has changed

This commit is contained in:
Geoffrey McRae 2017-12-13 02:29:53 +11:00
parent 5cfae05cae
commit 4b4aca841c
3 changed files with 24 additions and 6 deletions

View File

@ -248,11 +248,25 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame)
// if we have a mouse update
if (frameInfo.LastMouseUpdateTime.QuadPart)
{
if (
m_lastMousePos.x != frameInfo.PointerPosition.Position.x ||
m_lastMousePos.y != frameInfo.PointerPosition.Position.y
) {
cursorUpdate = true;
frame.cursor.hasPos = true;
frame.cursor.visible = frameInfo.PointerPosition.Visible;
frame.cursor.x = frameInfo.PointerPosition.Position.x;
frame.cursor.y = frameInfo.PointerPosition.Position.x;
frame.cursor.y = frameInfo.PointerPosition.Position.y;
m_lastMousePos.x = frameInfo.PointerPosition.Position.x;
m_lastMousePos.y = frameInfo.PointerPosition.Position.y;
}
if (m_lastMouseVis != frameInfo.PointerPosition.Visible)
{
cursorUpdate = true;
m_lastMouseVis = frameInfo.PointerPosition.Visible;
}
frame.cursor.visible = m_lastMouseVis;
}
// if the pointer shape has changed
@ -293,7 +307,7 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame)
frame.cursor.dataSize = m_pointerSize;
}
if (frameInfo.AccumulatedFrames == 1)
if (frameInfo.AccumulatedFrames > 0)
break;
m_dup->ReleaseFrame();

View File

@ -72,5 +72,7 @@ namespace Capture
BYTE * m_pointer;
UINT m_pointerBufSize;
UINT m_pointerSize;
BOOL m_lastMouseVis;
POINT m_lastMousePos;
};
};

View File

@ -240,6 +240,8 @@ bool Service::Process()
// tell the host where the cursor is
m_header->flags |= KVMFR_HEADER_FLAG_CURSOR;
m_header->cursor.flags |= KVMFR_CURSOR_FLAG_POS;
if (frame.cursor.visible)
m_header->cursor.flags |= KVMFR_CURSOR_FLAG_VISIBLE;
m_header->cursor.x = frame.cursor.x;
m_header->cursor.y = frame.cursor.y;
}