ref: da5d7982c6e040a68f22ff5d36e775ca209385a3
parent: a392034fd6d0cc2df3baaf637da5668634d7d34a
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jul 13 13:31:30 EDT 2020
Improve SDL2 event handling accuracy Now the event loop doesn't run constantly when the window isn't focussed. This should match the original WinAPI code's behaviour.
--- a/src/Backends/Platform/SDL2.cpp
+++ b/src/Backends/Platform/SDL2.cpp
@@ -165,13 +165,14 @@
bool Backend_SystemTask(bool active)
{
- while (SDL_PollEvent(NULL))
- {
- SDL_Event event;
-
- if (!SDL_WaitEvent(&event))
+ if (!active)
+ if (!SDL_WaitEvent(NULL))
return false;
+ SDL_Event event;
+
+ while (SDL_PollEvent(&event))
+ {
switch (event.type)
{
case SDL_KEYUP: