Fix cursor hiding on input (#18445)

The CoreWindow approach to implementing this has proven itself to be bug
prone. This PR switches to using the much better Win32 ShowCursor API,
which uses a reference count. This prevents the exact sort of race
condition we have where we we disable the cursor in our code and the
WinUI code then sets it to a different cursor internally which gets the
system out of sync. There's no WinUI API to just hide the cursor and if
it did, it would probably be a Boolean which would result in the same
issue.

Closes #18400

## Validation Steps Performed
It's difficult to assert the correctness of this approach, outside of
just trying it out (which I did and it works). The good news is that
this uses a static bool to ensure we only hide it exactly once and show
it exactly once and we do the latter on every WM_ACTIVATE message which
should hopefully restore the cursor when tabbing out and back in at
least.
This commit is contained in:
Leonard Hecker
2025-01-21 20:56:50 +01:00
committed by GitHub
parent 25392ea604
commit c56fb1b2d2
5 changed files with 65 additions and 63 deletions

View File

@@ -1354,6 +1354,7 @@ PNMLINK
pntm
POBJECT
Podcast
POINTERUPDATE
POINTSLIST
policheck
POLYTEXTW