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.
This commit is contained in:
Clownacy 2020-07-13 17:31:30 +01:00
parent a392034fd6
commit da5d7982c6

View file

@ -165,13 +165,14 @@ void PlaybackBackend_EnableDragAndDrop(void)
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: