diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 8a3ff92b0..b134e0e98 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -305,7 +305,11 @@ loop(void *arg) int i; SDL_bool showing_front = SDL_TRUE; - while (SDL_PollEvent(&event)) { + /* Update to get the current event state */ + SDL_PumpEvents(); + + /* Process all currently pending events */ + while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) { switch (event.type) { case SDL_CONTROLLERDEVICEADDED: SDL_Log("Game controller device %d added.\n", (int) SDL_JoystickGetDeviceInstanceID(event.cdevice.which)); diff --git a/test/testsensor.c b/test/testsensor.c index 48a2ef08f..508bd14f8 100644 --- a/test/testsensor.c +++ b/test/testsensor.c @@ -95,7 +95,11 @@ main(int argc, char **argv) SDL_CreateWindow("Sensor Test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP); while (!done) { - while (SDL_PollEvent(&event) > 0) { + /* Update to get the current event state */ + SDL_PumpEvents(); + + /* Process all currently pending events */ + while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) { switch (event.type) { case SDL_SENSORUPDATE: HandleSensorEvent(&event.sensor);