src/core/android/SDL_android.c
changeset 11239 856e5e3c1e86
parent 11238 c728c661cec7
child 11270 31ce9a8ce2bd
     1.1 --- a/src/core/android/SDL_android.c	Sat Aug 12 08:15:09 2017 -0700
     1.2 +++ b/src/core/android/SDL_android.c	Sat Aug 12 12:24:59 2017 -0700
     1.3 @@ -181,6 +181,9 @@
     1.4  static jmethodID midPollHapticDevices;
     1.5  static jmethodID midHapticRun;
     1.6  
     1.7 +/* static fields */
     1.8 +static jfieldID fidSeparateMouseAndTouch;
     1.9 +
    1.10  /* Accelerometer data storage */
    1.11  static float fLastAccelerometer[3];
    1.12  static SDL_bool bHasNewData;
    1.13 @@ -253,6 +256,13 @@
    1.14         !midPollInputDevices || !midPollHapticDevices || !midHapticRun) {
    1.15          __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly");
    1.16      }
    1.17 +
    1.18 +    fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z");
    1.19 +    
    1.20 +    if (!fidSeparateMouseAndTouch) {
    1.21 +        __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java static fields, check that they're named and typed correctly");
    1.22 +    }
    1.23 +
    1.24      __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!");
    1.25  }
    1.26  
    1.27 @@ -693,11 +703,6 @@
    1.28      return 1;
    1.29  }
    1.30  
    1.31 -jclass Android_JNI_GetActivityClass(void)
    1.32 -{
    1.33 -    return mActivityClass;
    1.34 -}
    1.35 -
    1.36  /*
    1.37   * Audio support
    1.38   */
    1.39 @@ -1590,6 +1595,13 @@
    1.40      return number;
    1.41  }
    1.42  
    1.43 +/* sets the mSeparateMouseAndTouch field */
    1.44 +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value)
    1.45 +{
    1.46 +    JNIEnv *env = Android_JNI_GetEnv();
    1.47 +    (*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE);
    1.48 +}
    1.49 +
    1.50  void Android_JNI_PollInputDevices(void)
    1.51  {
    1.52      JNIEnv *env = Android_JNI_GetEnv();