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)
|
bool Backend_SystemTask(bool active)
|
||||||
{
|
{
|
||||||
while (SDL_PollEvent(NULL))
|
if (!active)
|
||||||
{
|
if (!SDL_WaitEvent(NULL))
|
||||||
SDL_Event event;
|
|
||||||
|
|
||||||
if (!SDL_WaitEvent(&event))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
SDL_Event event;
|
||||||
|
|
||||||
|
while (SDL_PollEvent(&event))
|
||||||
|
{
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
|
|
Loading…
Add table
Reference in a new issue