From 64237d7f0183e65e05b97a94d792a0e8dedf8230 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 1 Apr 2015 14:45:09 -0400 Subject: [PATCH] Patched to compile on Android (I hope). --- src/core/android/SDL_android.c | 5 +++++ src/core/android/SDL_android.h | 1 + src/video/android/SDL_androidtouch.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index f7238a919eb0e..e7f90bacde1f8 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -1610,6 +1610,11 @@ const char * SDL_AndroidGetExternalStoragePath() return s_AndroidExternalFilesPath; } +jclass Android_JNI_GetActivityClass(void) +{ + return mActivityClass; +} + #endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index 051958a496d2c..d749bf1018907 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -78,6 +78,7 @@ int Android_JNI_GetTouchDeviceIds(int **ids); #include JNIEnv *Android_JNI_GetEnv(void); int Android_JNI_SetupThread(void); +jclass Android_JNI_GetActivityClass(void); /* Generic messages */ int Android_JNI_SendMessage(int command, int param); diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index 4a5612acdd155..3b406c96e5d16 100644 --- a/src/video/android/SDL_androidtouch.c +++ b/src/video/android/SDL_androidtouch.c @@ -56,9 +56,11 @@ static void SeparateEventsHintWatcher(void *userdata, const char *name, const char *oldValue, const char *newValue) { - separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0)); + jclass mActivityClass = Android_JNI_GetActivityClass(); JNIEnv *env = Android_JNI_GetEnv(); jfieldID fid = (*env)->GetStaticFieldID(env, mActivityClass, "mSeparateMouseAndTouch", "Z"); + + separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0)); (*env)->SetStaticBooleanField(env, mActivityClass, fid, separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE); }