From afb9ff9507f013cc413f091f558479433508ba83 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 30 Aug 2019 08:03:19 -0700 Subject: [PATCH] Fixed bug where the Steam overlay would generate an event and stop input processing for the frame. --- src/video/windows/SDL_windowsevents.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index ed73b7123..cc6d5aa5a 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -1119,6 +1119,7 @@ WIN_PumpEvents(_THIS) const Uint8 *keystate; MSG msg; DWORD start_ticks = GetTickCount(); + int new_messages = 0; if (g_WindowsEnableMessageLoop) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { @@ -1132,7 +1133,15 @@ WIN_PumpEvents(_THIS) /* Make sure we don't busy loop here forever if there are lots of events coming in */ if (SDL_TICKS_PASSED(msg.time, start_ticks)) { - break; + /* We might get a few new messages generated by the Steam overlay or other application hooks + In this case those messages will be processed before any pending input, so we want to continue after those messages. + (thanks to Peter Deayton for his investigation here) + */ + const int MAX_NEW_MESSAGES = 3; + ++new_messages; + if (new_messages > MAX_NEW_MESSAGES) { + break; + } } } }