src/core/android/SDL_android.c
changeset 12059 320b43d5e5a7
parent 12024 3688283680b1
child 12127 f92fd2c57780
     1.1 --- a/src/core/android/SDL_android.c	Thu Jul 05 23:01:10 2018 +0300
     1.2 +++ b/src/core/android/SDL_android.c	Thu Jul 12 13:28:13 2018 -0700
     1.3 @@ -216,6 +216,7 @@
     1.4  static jmethodID midIsAndroidTV;
     1.5  static jmethodID midIsChromebook;
     1.6  static jmethodID midIsDeXMode;
     1.7 +static jmethodID midManualBackButton;
     1.8  static jmethodID midInputGetInputDeviceIds;
     1.9  static jmethodID midSendMessage;
    1.10  static jmethodID midShowTextInput;
    1.11 @@ -323,6 +324,8 @@
    1.12                                  "isChromebook", "()Z");
    1.13      midIsDeXMode = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.14                                  "isDeXMode", "()Z");
    1.15 +    midManualBackButton = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.16 +                                "manualBackButton", "()V");
    1.17      midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.18                                  "inputGetInputDeviceIds", "(I)[I");
    1.19      midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.20 @@ -357,7 +360,7 @@
    1.21         !midClipboardSetText || !midClipboardGetText || !midClipboardHasText ||
    1.22         !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables || !midGetDisplayDPI ||
    1.23         !midCreateCustomCursor || !midSetCustomCursor || !midSetSystemCursor || !midSupportsRelativeMouse || !midSetRelativeMouseEnabled ||
    1.24 -       !midIsChromebook || !midIsDeXMode) {
    1.25 +       !midIsChromebook || !midIsDeXMode || !midManualBackButton) {
    1.26          __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?");
    1.27      }
    1.28  
    1.29 @@ -2045,6 +2048,12 @@
    1.30      return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsDeXMode);
    1.31  }
    1.32  
    1.33 +void SDL_AndroidBackButton(void)
    1.34 +{
    1.35 +    JNIEnv *env = Android_JNI_GetEnv();
    1.36 +    return (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton);
    1.37 +}
    1.38 +
    1.39  const char * SDL_AndroidGetInternalStoragePath(void)
    1.40  {
    1.41      static char *s_AndroidInternalFilesPath = NULL;