[Android] Signal the resume semaphore after pushing the relevant events
authorGabriel Jacobo <gabomdq@gmail.com>
Tue, 03 Dec 2013 12:09:58 -0300
changeset 8047a5270cef21a7
parent 8046 e7c89b29932a
child 8048 a9c5ddad50b0
[Android] Signal the resume semaphore after pushing the relevant events

Ref: Request in #2242
src/core/android/SDL_android.c
     1.1 --- a/src/core/android/SDL_android.c	Tue Dec 03 12:01:28 2013 -0300
     1.2 +++ b/src/core/android/SDL_android.c	Tue Dec 03 12:09:58 2013 -0300
     1.3 @@ -320,16 +320,15 @@
     1.4      __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()");
     1.5  
     1.6      if (Android_Window) {
     1.7 +        SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
     1.8 +        SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
     1.9 +        SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
    1.10 +        SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.11          /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context
    1.12           * We can't restore the GL Context here because it needs to be done on the SDL main thread
    1.13           * and this function will be called from the Java thread instead.
    1.14           */
    1.15          if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
    1.16 -        
    1.17 -        SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
    1.18 -        SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
    1.19 -        SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
    1.20 -        SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.21      }
    1.22  }
    1.23