[host] nvfbc: generate cursor position update on startup

Before this commit, the NvFBC backend only generated the first cursor
position update when the mouse moves. Therefore, if the user does
not move the mouse, the cursor will be shown at (0, 0), which is not
ideal.

This commit changes this behaviour to unconditionally generate a
cursor update when the mouse hook initializes.
This commit is contained in:
Quantum 2021-01-27 16:55:14 -05:00 committed by Geoffrey McRae
parent 05f2305fa0
commit b97130cf20

View File

@ -56,6 +56,13 @@ static bool switchDesktopAndHook(void)
}
CloseDesktop(desk);
POINT position;
GetCursorPos(&position);
mouseHook.x = position.x;
mouseHook.y = position.y;
mouseHook.callback(position.x, position.y);
mouseHook.hook = SetWindowsHookEx(WH_MOUSE_LL, mouseHook_hook, NULL, 0);
if (!mouseHook.hook)
{
@ -84,11 +91,11 @@ static DWORD WINAPI threadProc(LPVOID lParam) {
return 0;
}
mouseHook.callback = (MouseHookFn)lParam;
if (!switchDesktopAndHook())
return 0;
mouseHook.installed = true;
mouseHook.callback = (MouseHookFn)lParam;
HWINEVENTHOOK eventHook = SetWinEventHook(
EVENT_SYSTEM_DESKTOPSWITCH, EVENT_SYSTEM_DESKTOPSWITCH, NULL,