diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 7019c47f5..ca1b9bbcd 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1802,29 +1802,8 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) int WIN_WaitEventTimeout(_THIS, int timeout) { - MSG msg; if (g_WindowsEnableMessageLoop) { - BOOL message_result; - UINT_PTR timer_id = 0; - if (timeout > 0) { - timer_id = SetTimer(NULL, 0, timeout, NULL); - message_result = GetMessage(&msg, 0, 0, 0); - KillTimer(NULL, timer_id); - } else if (timeout == 0) { - message_result = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); - } else { - message_result = GetMessage(&msg, 0, 0, 0); - } - if (message_result) { - if (msg.message == WM_TIMER && !msg.hwnd && msg.wParam == timer_id) { - return 0; - } - if (g_WindowsMessageHook) { - g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam); - } - /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */ - TranslateMessage(&msg); - DispatchMessage(&msg); + if (MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeout, QS_ALLINPUT)) { return 1; } else { return 0;