Skip to content

Commit

Permalink
Android: when an EventFilter is binded to SDL_EVENT_DID_ENTER_FOREGRO…
Browse files Browse the repository at this point in the history
…UND event and triggered, GL context is expected to be already restored.
  • Loading branch information
1bsyl committed Jun 9, 2023
1 parent 4c0758a commit ae9d8ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/video/android/SDL_androidevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)

/* Android_ResumeSem was signaled */
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);

ANDROIDAUDIO_ResumeDevices();
openslES_ResumeDevices();
Expand All @@ -136,6 +134,9 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
if (SDL_TextInputActive()) {
Android_StartTextInput(_this); /* Only showTextInput */
}

SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
} else {
if (videodata->isPausing || SDL_TryWaitSemaphore(Android_PauseSem) == 0) {
Expand Down Expand Up @@ -198,8 +199,6 @@ void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)

/* Android_ResumeSem was signaled */
SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND);
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);

if (videodata->pauseAudio) {
ANDROIDAUDIO_ResumeDevices();
Expand All @@ -220,6 +219,9 @@ void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
if (SDL_TextInputActive()) {
Android_StartTextInput(_this); /* Only showTextInput */
}

SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
} else {
if (videodata->isPausing || SDL_TryWaitSemaphore(Android_PauseSem) == 0) {
Expand Down

0 comments on commit ae9d8ac

Please sign in to comment.