|
@@ -39,6 +39,13 @@ static void ANDROIDAUDIO_ResumeDevices(void) {}
|
|
|
static void ANDROIDAUDIO_PauseDevices(void) {}
|
|
|
#endif
|
|
|
|
|
|
+/* Number of event types in the event queue */
|
|
|
+static int
|
|
|
+SDL_NumberOfEvent(Uint32 type)
|
|
|
+{
|
|
|
+ return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type);
|
|
|
+}
|
|
|
+
|
|
|
static void
|
|
|
android_egl_context_restore(SDL_Window *window)
|
|
|
{
|
|
@@ -103,9 +110,10 @@ Android_PumpEvents(_THIS)
|
|
|
}
|
|
|
} else {
|
|
|
if (isPausing || SDL_SemTryWait(Android_PauseSem) == 0) {
|
|
|
- /* We've been signaled to pause, but before we block ourselves,
|
|
|
- we need to make sure that the very last event have reached the app */
|
|
|
- if (SDL_HasEvent(SDL_APP_DIDENTERBACKGROUND)) {
|
|
|
+ /* We've been signaled to pause (potentially several times), but before we block ourselves,
|
|
|
+ * we need to make sure that the very last event (of the first pause sequence, if several)
|
|
|
+ * has reached the app */
|
|
|
+ if (SDL_NumberOfEvent(SDL_APP_DIDENTERBACKGROUND) > SDL_SemValue(Android_PauseSem)) {
|
|
|
isPausing = 1;
|
|
|
}
|
|
|
else {
|