From 5733015bcc0ca31f01c73f6ad6ad5da71fa0453a Mon Sep 17 00:00:00 2001 From: Soji Yamakawa Date: Thu, 30 Nov 2023 12:33:12 -0500 Subject: [PATCH] Figured what was flickering the cursor. ShowCursor(TRUE);auto ctr=ShowCursor(FALSE); was the culprit. --- .../src/windows/fswin32wrapper.cpp | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/fssimplewindow/src/windows/fswin32wrapper.cpp b/src/fssimplewindow/src/windows/fswin32wrapper.cpp index cd5a785..b1650a8 100644 --- a/src/fssimplewindow/src/windows/fswin32wrapper.cpp +++ b/src/fssimplewindow/src/windows/fswin32wrapper.cpp @@ -1190,6 +1190,8 @@ int FsGetNativeTextInputEvent(void) return FSNATIVETEXTEVENT_NONE; } +static int showFlag=1; + void FsShowMouseCursor(int showFlag) { // Win32 mouse cursor visibility is controlled by a counter. @@ -1202,16 +1204,23 @@ void FsShowMouseCursor(int showFlag) } else { - // 2023/11/30 - // Something occasionally increases the cursor count and decrease again. - // I need to decrement to -1 to assure the cursor is hidden all the time. - while(-1<=ShowCursor(FALSE)); + while(0<=ShowCursor(FALSE)); } + ::showFlag=showFlag; } int FsIsMouseCursorVisible(void) { - ShowCursor(TRUE); - auto ctr=ShowCursor(FALSE); + int ctr; + if(0!=::showFlag) + { + ShowCursor(TRUE); + ctr=ShowCursor(FALSE); + } + else + { + ShowCursor(FALSE); + ctr=ShowCursor(TRUE); + } return 0<=ctr; }