Skip to content

Commit

Permalink
SDL: Switch to SDL_WaitEventTimeout instead of SDL_PollEvent when pos…
Browse files Browse the repository at this point in the history
…sible.

Fixes #19131
  • Loading branch information
hrydgard committed May 28, 2024
1 parent 7d80f83 commit 2c50f82
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SDL/SDLMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2c50f82

Please sign in to comment.