Android: better fix for bug 3186. Run those commands from SDL thread.
authorSylvain Becker <sylvain.becker@gmail.com>
Sun, 06 Jan 2019 20:25:54 +0100
changeset 125098faf3241a2b7
parent 12508 662cdc7f1dea
child 12510 6fb31043d8a8
Android: better fix for bug 3186. Run those commands from SDL thread.
src/core/android/SDL_android.c
src/video/android/SDL_androidevents.c
     1.1 --- a/src/core/android/SDL_android.c	Sun Jan 06 17:35:42 2019 +0100
     1.2 +++ b/src/core/android/SDL_android.c	Sun Jan 06 20:25:54 2019 +0100
     1.3 @@ -838,13 +838,6 @@
     1.4      __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()");
     1.5  
     1.6      if (Android_Window) {
     1.7 -
     1.8 -        /* Make sure SW Keyboard is restored when an app becomes foreground */
     1.9 -        if (SDL_IsTextInputActive()) {
    1.10 -            SDL_VideoDevice *_this = SDL_GetVideoDevice();
    1.11 -            Android_StartTextInput(_this); /* Only showTextInput */
    1.12 -        }
    1.13 -
    1.14          SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
    1.15          SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
    1.16          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
     2.1 --- a/src/video/android/SDL_androidevents.c	Sun Jan 06 17:35:42 2019 +0100
     2.2 +++ b/src/video/android/SDL_androidevents.c	Sun Jan 06 20:25:54 2019 +0100
     2.3 @@ -107,6 +107,12 @@
     2.4                  android_egl_context_restore(Android_Window);
     2.5                  SDL_UnlockMutex(Android_ActivityMutex);
     2.6              }
     2.7 +
     2.8 +            /* Make sure SW Keyboard is restored when an app becomes foreground */
     2.9 +            if (SDL_IsTextInputActive()) {
    2.10 +                SDL_VideoDevice *_this = SDL_GetVideoDevice();
    2.11 +                Android_StartTextInput(_this); /* Only showTextInput */
    2.12 +            }
    2.13          }
    2.14      } else {
    2.15          if (isPausing || SDL_SemTryWait(Android_PauseSem) == 0) {
    2.16 @@ -144,6 +150,12 @@
    2.17                  android_egl_context_restore(Android_Window);
    2.18                  SDL_UnlockMutex(Android_ActivityMutex);
    2.19              }
    2.20 +
    2.21 +            /* Make sure SW Keyboard is restored when an app becomes foreground */
    2.22 +            if (SDL_IsTextInputActive()) {
    2.23 +                SDL_VideoDevice *_this = SDL_GetVideoDevice();
    2.24 +                Android_StartTextInput(_this); /* Only showTextInput */
    2.25 +            }
    2.26          }
    2.27      } else {
    2.28          if (SDL_SemTryWait(Android_PauseSem) == 0) {