From 2c50f82b5bc4c59c29170be5a0778947c3e0cbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 28 May 2024 19:06:00 +0200 Subject: [PATCH] SDL: Switch to SDL_WaitEventTimeout instead of SDL_PollEvent when possible. Fixes #19131 --- SDL/SDLMain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 985309aa0681..6e04018d468c 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -1420,10 +1420,12 @@ int main(int argc, char *argv[]) { bool waitOnExit = g_Config.iGPUBackend == (int)GPUBackend::OPENGL; if (!mainThreadIsRender) { - // We should only be a message pump + // Vulkan mode uses this. + // We should only be a message pump. This allows for lower latency + // input events, and so on. while (true) { SDL_Event event; - while (SDL_PollEvent(&event)) { + while (SDL_WaitEventTimeout(&event, 100)) { ProcessSDLEvent(window, event, &inputTracker); } if (g_QuitRequested || g_RestartRequested)