From 6c495a806a3c78e9f2374b8bbb8306ff11da4014 Mon Sep 17 00:00:00 2001 From: Gabriel Jacobo Date: Tue, 3 Dec 2013 12:09:58 -0300 Subject: [PATCH] [Android] Signal the resume semaphore after pushing the relevant events Ref: Request in #2242 --- src/core/android/SDL_android.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 4dc78bbf5914c..0bc9ad01e1656 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -320,16 +320,15 @@ void Java_org_libsdl_app_SDLActivity_nativeResume( __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); if (Android_Window) { + SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); + SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); + SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); + SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0); /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context * We can't restore the GL Context here because it needs to be done on the SDL main thread * and this function will be called from the Java thread instead. */ if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem); - - SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); - SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0); } }