Hash :
1fa154fd
Author :
Date :
2021-10-13T09:33:54
Fix weak enforcement of timeouts in SDL_WaitEventTimeout_Device. This will loop pumping events and waiting for a system event to come in. However not all system events will turn into an SDL event. It's not unusual for a Windows message to be some internal thing that SDL doesn't convert into a message. In that case the loop will simple circle but not exit. As long as such messages are coming in the loop will continue to run regardless of the timeout. When messages finally stop it'll still wait for the full timeout so you can have arbitrarily long delays.
Instead do an absolute elapsed time check since the start of the wait. If that is exceeded during any iteration the routine exits as the timeout has elapsed.