Improve Windows raw input thread handling#15239
Conversation
256413a to
fc983e8
Compare
|
Just a small update to preemptively guard against an unlikely error scenario. |
|
After testing this in my game, I realized that |
e97c76c to
ad45bc6
Compare
|
Updated to avoid declaring variables between goto/label. |
ad45bc6 to
abd1855
Compare
abd1855 to
7182e71
Compare
| return SDL_Unsupported(); | ||
| } | ||
|
|
||
| bool WIN_SetRawKeyboardFlag_Inputsink(SDL_VideoDevice *_this, bool enabled) |
There was a problem hiding this comment.
Did you mean to include this here?
There was a problem hiding this comment.
I sent it as a separate commit because I was already touching code near that and it's a minor change. Do you want me to drop it?
I did just notice that I messed up the splitting for the second commit, though, I'll fix that.
There was a problem hiding this comment.
No, that's fine, I didn't realize it was just missing.
CreateEvent/CreateThread return NULL on failure.
The thread is still created once and only shut down on WIN_VideoQuit, but the thread will unregister the devices when they're disabled to avoid wasting time processing raw input that won't be appreciated by anyone. This also allows RIDEV_NOLEGACY to be set on the devices, otherwise they swallow up the WM_MOUSE* events that would be going to the main thread when relative mode is disabled. That's out of scope for this change, though.
7182e71 to
3402461
Compare
|
Merged, thanks! |
Description
This is a followup to commits 43e90c7 and b9c227e.
The thread is still created once and only shut down on
WIN_VideoQuit,but the thread will unregister the devices when they're disabled to avoid
wasting time processing raw input that won't be appreciated by anyone.
This also allows
RIDEV_NOLEGACYto be set on the devices, otherwise theyswallow up the
WM_MOUSE*events that would be going to the main threadwhen relative mode is disabled. That's out of scope for this change, though.
Also, fixed up some existing issues in the first 2 commits.