Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
This commit is contained in:
parent
dd7da60a4f
commit
a3982939c5
2 changed files with 3 additions and 8 deletions
|
@ -64,9 +64,9 @@ Android_PumpEvents(_THIS)
|
|||
else {
|
||||
#if SDL_ANDROID_BLOCK_ON_PAUSE
|
||||
if( isPausing || SDL_SemTryWait(Android_PauseSem) == 0 ) {
|
||||
/* We've been signaled to pause, but before we block ourselves, we need to make sure that
|
||||
SDL_WINDOWEVENT_FOCUS_LOST and SDL_WINDOWEVENT_MINIMIZED have reached the app */
|
||||
if (SDL_HasEvent(SDL_WINDOWEVENT)) {
|
||||
/* 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) ) {
|
||||
isPausing = 1;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue