Skip to content

Commit

Permalink
Figured what was flickering the cursor. ShowCursor(TRUE);auto ctr=Sho…
Browse files Browse the repository at this point in the history
…wCursor(FALSE); was the culprit.
  • Loading branch information
captainys committed Nov 30, 2023
1 parent 0c2caa7 commit 91054b9
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/externals/fssimplewindow/src/windows/fswin32wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}

0 comments on commit 91054b9

Please sign in to comment.