Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Android: better fix for bug 3186. Run those commands from SDL thread.
  • Loading branch information
1bsyl committed Jan 6, 2019
1 parent 9f23d18 commit 462e62e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/core/android/SDL_android.c
Expand Up @@ -838,13 +838,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)(
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()");

if (Android_Window) {

/* Make sure SW Keyboard is restored when an app becomes foreground */
if (SDL_IsTextInputActive()) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
Android_StartTextInput(_this); /* Only showTextInput */
}

SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
Expand Down
12 changes: 12 additions & 0 deletions src/video/android/SDL_androidevents.c
Expand Up @@ -107,6 +107,12 @@ Android_PumpEvents(_THIS)
android_egl_context_restore(Android_Window);
SDL_UnlockMutex(Android_ActivityMutex);
}

/* Make sure SW Keyboard is restored when an app becomes foreground */
if (SDL_IsTextInputActive()) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
Android_StartTextInput(_this); /* Only showTextInput */
}
}
} else {
if (isPausing || SDL_SemTryWait(Android_PauseSem) == 0) {
Expand Down Expand Up @@ -144,6 +150,12 @@ Android_PumpEvents(_THIS)
android_egl_context_restore(Android_Window);
SDL_UnlockMutex(Android_ActivityMutex);
}

/* Make sure SW Keyboard is restored when an app becomes foreground */
if (SDL_IsTextInputActive()) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
Android_StartTextInput(_this); /* Only showTextInput */
}
}
} else {
if (SDL_SemTryWait(Android_PauseSem) == 0) {
Expand Down

0 comments on commit 462e62e

Please sign in to comment.