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:
parent
a392034fd6
commit
da5d7982c6
1 changed files with 6 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue