src/core/android/SDL_android.cpp
changeset 6330 0fa55ca2efdd
parent 6308 263e2c049c22
child 6335 fbb84f5b985f
     1.1 --- a/src/core/android/SDL_android.cpp	Tue Jun 19 12:29:53 2012 -0400
     1.2 +++ b/src/core/android/SDL_android.cpp	Tue Jun 19 13:57:42 2012 -0300
     1.3 @@ -176,6 +176,8 @@
     1.4                                      JNIEnv* env, jclass cls)
     1.5  {
     1.6      if (Android_Window) {
     1.7 +        /* Signal the pause semaphore so the event loop knows to pause and (optionally) block itself */
     1.8 +        if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem);
     1.9          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
    1.10          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
    1.11      }
    1.12 @@ -186,6 +188,11 @@
    1.13                                      JNIEnv* env, jclass cls)
    1.14  {
    1.15      if (Android_Window) {
    1.16 +        /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context
    1.17 +         * We can't restore the GL Context here because it needs to be done on the SDL main thread
    1.18 +         * and this function will be called from the Java thread instead.
    1.19 +         */
    1.20 +        if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
    1.21          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
    1.22          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.23      }