Fixed bug where the Steam overlay would generate an event and stop input processing for the frame.
authorSam Lantinga <slouken@libsdl.org>
Fri, 30 Aug 2019 08:03:19 -0700
changeset 1304499f2845397a4
parent 13043 3cdcccbeec91
child 13045 8254c364ec4a
Fixed bug where the Steam overlay would generate an event and stop input processing for the frame.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Fri Aug 30 11:35:20 2019 +0300
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Fri Aug 30 08:03:19 2019 -0700
     1.3 @@ -1119,6 +1119,7 @@
     1.4      const Uint8 *keystate;
     1.5      MSG msg;
     1.6      DWORD start_ticks = GetTickCount();
     1.7 +    int new_messages = 0;
     1.8  
     1.9      if (g_WindowsEnableMessageLoop) {
    1.10          while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
    1.11 @@ -1132,7 +1133,15 @@
    1.12  
    1.13              /* Make sure we don't busy loop here forever if there are lots of events coming in */
    1.14              if (SDL_TICKS_PASSED(msg.time, start_ticks)) {
    1.15 -                break;
    1.16 +                /* We might get a few new messages generated by the Steam overlay or other application hooks
    1.17 +                   In this case those messages will be processed before any pending input, so we want to continue after those messages.
    1.18 +                   (thanks to Peter Deayton for his investigation here)
    1.19 +                 */
    1.20 +                const int MAX_NEW_MESSAGES = 3;
    1.21 +                ++new_messages;
    1.22 +                if (new_messages > MAX_NEW_MESSAGES) {
    1.23 +                    break;
    1.24 +                }
    1.25              }
    1.26          }
    1.27      }