Browse Source

Fixed bug #14233 - Android fix Android_WaitActiveAndLockActivity() to make sure Android_Paused state is refreshed

(cherry picked from commit e4c60c05bf9bc6a828bccdf575d0777ada5b80ab)
Sylvain 5 months ago
parent
commit
92570af7d3
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/video/android/SDL_androidevents.c

+ 6 - 0
src/video/android/SDL_androidevents.c

@@ -248,6 +248,12 @@ void Android_PumpEvents(Sint64 timeoutNS)
 
 
 bool Android_WaitActiveAndLockActivity(void)
 bool Android_WaitActiveAndLockActivity(void)
 {
 {
+    /* Make sure we have pumped all events so that Android_Paused state is correct */
+    SDL_AndroidLifecycleEvent event;
+    while (!Android_Destroyed && Android_WaitLifecycleEvent(&event, 0)) {
+        Android_HandleLifecycleEvent(event);
+    }
+
     while (Android_Paused && !Android_Destroyed) {
     while (Android_Paused && !Android_Destroyed) {
         Android_PumpEvents(-1);
         Android_PumpEvents(-1);
     }
     }