From b97130cf20e3d61df39dd90dffd4114edeccf4f8 Mon Sep 17 00:00:00 2001 From: Quantum Date: Wed, 27 Jan 2021 16:55:14 -0500 Subject: [PATCH] [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. --- host/platform/Windows/src/mousehook.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/host/platform/Windows/src/mousehook.c b/host/platform/Windows/src/mousehook.c index 6a80f2a2..1db57db9 100644 --- a/host/platform/Windows/src/mousehook.c +++ b/host/platform/Windows/src/mousehook.c @@ -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,