mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[host] use a global hook to obtain cursor move pos
This commit is contained in:
@@ -539,8 +539,6 @@ 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 we have a mouse update
|
||||
@@ -556,24 +554,6 @@ unsigned int Capture::DXGI::Capture()
|
||||
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;
|
||||
|
@@ -102,6 +102,5 @@ namespace Capture
|
||||
|
||||
int m_lastCursorX, m_lastCursorY;
|
||||
BOOL m_lastMouseVis;
|
||||
POINT m_hotSpot;
|
||||
};
|
||||
};
|
@@ -41,6 +41,7 @@ NvFBC::NvFBC() :
|
||||
m_optNoCrop(false),
|
||||
m_optNoWait(false),
|
||||
m_initialized(false),
|
||||
m_first(true),
|
||||
m_hDLL(NULL),
|
||||
m_nvFBC(NULL)
|
||||
{
|
||||
@@ -60,6 +61,7 @@ bool NvFBC::Initialize(CaptureOptions * options)
|
||||
if (m_initialized)
|
||||
DeInitialize();
|
||||
|
||||
m_first = true;
|
||||
m_options = options;
|
||||
m_optNoCrop = false;
|
||||
|
||||
@@ -345,7 +347,11 @@ unsigned int Capture::NvFBC::Capture()
|
||||
return GRAB_STATUS_REINIT;
|
||||
}
|
||||
|
||||
return GRAB_STATUS_OK | GRAB_STATUS_FRAME;
|
||||
// turn off the cursor on the first frame as NvFBC is drawing it
|
||||
if (m_first)
|
||||
return GRAB_STATUS_OK | GRAB_STATUS_FRAME | GRAB_STATUS_CURSOR;
|
||||
else
|
||||
return GRAB_STATUS_OK | GRAB_STATUS_FRAME;
|
||||
}
|
||||
|
||||
bool Capture::NvFBC::GetCursor(CursorInfo & cursor)
|
||||
@@ -353,6 +359,13 @@ bool Capture::NvFBC::GetCursor(CursorInfo & cursor)
|
||||
cursor.hasShape = false;
|
||||
cursor.hasPos = false;
|
||||
cursor.visible = false;
|
||||
|
||||
if (m_first)
|
||||
{
|
||||
m_first = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -59,6 +59,7 @@ namespace Capture
|
||||
bool m_optNoWait;
|
||||
|
||||
bool m_initialized;
|
||||
bool m_first;
|
||||
HMODULE m_hDLL;
|
||||
|
||||
NvFBC_CreateFunctionExType m_fnCreateEx;
|
||||
|
Reference in New Issue
Block a user