libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.91k stars 1.83k forks source link

Add SDL_HINT_WINDOWS_CLIPCURSOR_UPDATE_INTERVAL_MS #8006

Closed expikr closed 4 months ago

expikr commented 1 year ago

Make this value customizable, where a value of zero disables the periodic refresh:

https://github.com/libsdl-org/SDL/blob/376a3cd100a3d59e887496c75a1ac49ab4a2d8ec/src/video/windows/SDL_windowsevents.c#L1729

This solves two birds with one stone:

  1. The frequency can be increased for developers who desire it, such as with the scenario raised by @Susko3 (https://github.com/libsdl-org/SDL/issues/7890) which is outside of SDL's control and so may require such a workaround.

  2. The periodic check can be disabled for debugging purposes, for developers that manually manipulate the ClipCursor state and do not want SDL constantly stepping over their toes. There does not appear to be a way for developers to manipulate SDL_WindowData.skip_update_clipcursor so it makes more sense to customize the interval itself, and in any case it's probably more versatile since it simultaneously enables (1.)

Susko3 commented 1 year ago

This doesn't fix my issue, as the game in question seems to basically be doing while(1) ClipCursor(NULL);.

expikr commented 1 year ago

I just meant that it can be a temporary workaround before WoT fixes it on their end, by increasing the frequency of that refresh to counteract their ClipCursor calls.

slouken commented 7 months ago

FYI, I'm doing a bunch of work on raw input on Windows and I plan to come back to your PRs soon.

slouken commented 4 months ago

Feel free to put together a PR for this!