Skip to content

Commit

Permalink
Android: fixed immediate transition to pause and resume.
Browse files Browse the repository at this point in the history
"Pause" transition will add events:
 SDL_WINDOWEVENT_ENTER
 SDL_WINDOWEVENT_FOCUS_LOST
 SDL_WINDOWEVENT_MINIMIZED
 SDL_APP_WILL ENTER BACKGROUND
 SDL_APP_DID ENTER BACKGROUND

"Resume" transition will add events:
 SDL_APP_WILL ENTER FOREGROUND
 SDL_APP_DID ENTER FOREGROUND
 SDL_WINDOWEVENT_FOCUS_GAINED
 SDL_WINDOWEVENT_RESTORED

If Android application doesn't empty the event loop in between, it enters in
"paused" state when SDL_WINDOWEVENT_RESTORED is fetched.

See bug 3250 for pratical case.
  • Loading branch information
1bsyl committed Jan 4, 2019
1 parent cf12234 commit 2a885eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/android/SDL_androidevents.c
Expand Up @@ -104,8 +104,8 @@ 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 certain key events have reached the app */
if (SDL_HasEvent(SDL_WINDOWEVENT) || SDL_HasEvent(SDL_APP_WILLENTERBACKGROUND) || SDL_HasEvent(SDL_APP_DIDENTERBACKGROUND) ) {
we need to make sure that the very last event have reached the app */
if (SDL_HasEvent(SDL_APP_DIDENTERBACKGROUND)) {
isPausing = 1;
}
else {
Expand Down

0 comments on commit 2a885eb

Please sign in to comment.