mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 19:38:14 +00:00
Fix broken use of MsgWaitForMultipleObjects.
- Timeout < 0 was not handled properly - Return value for success is WAIT_OBJECT_0 + nCount, not positive value (cherry picked from commit69f2bd151e
) (cherry picked from commit4ae87e215e
)
This commit is contained in:

committed by
Sam Lantinga

parent
a24e2bfc76
commit
c4fc20a033
@@ -1803,7 +1803,10 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
|
|||||||
int WIN_WaitEventTimeout(_THIS, int timeout)
|
int WIN_WaitEventTimeout(_THIS, int timeout)
|
||||||
{
|
{
|
||||||
if (g_WindowsEnableMessageLoop) {
|
if (g_WindowsEnableMessageLoop) {
|
||||||
if (MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeout, QS_ALLINPUT)) {
|
DWORD dwMilliseconds, ret;
|
||||||
|
dwMilliseconds = timeout < 0 ? INFINITE : (DWORD)timeout;
|
||||||
|
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, dwMilliseconds, QS_ALLINPUT);
|
||||||
|
if (ret == WAIT_OBJECT_0) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user