From ec435d21d3bde7989b918d9daf85e99802a3b16d Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 16 Nov 2018 08:43:28 +0100 Subject: [PATCH] make cursor visible on unlock for tiberian sun --- inc/main.h | 1 + src/mouse.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/inc/main.h b/inc/main.h index bdd0d4a..f4d6eae 100644 --- a/inc/main.h +++ b/inc/main.h @@ -112,6 +112,7 @@ typedef struct IDirectDrawImpl LONG minimized; DWORD ticklength; BOOL altenter; + BOOL hidecursor; } IDirectDrawImpl; diff --git a/src/mouse.c b/src/mouse.c index 3d52c3b..21417cf 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -257,7 +257,14 @@ void mouse_lock() while (ShowCursor(FALSE) > 0); } else + { + if (ddraw->hidecursor) + { + ddraw->hidecursor = FALSE; + ShowCursor(FALSE); + } ClipCursor(&rc); + } ddraw->locked = TRUE; } @@ -299,6 +306,15 @@ void mouse_unlock() while (ShowCursor(TRUE) < 0); SetCursor(LoadCursor(NULL, IDC_ARROW)); } + else + { + CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) }; + if (GetCursorInfo(&ci) && ci.flags == 0) + { + ddraw->hidecursor = TRUE; + ShowCursor(TRUE); + } + } ClipCursor(NULL); ReleaseCapture();