Patched to compile on Android (I hope).
authorRyan C. Gordon <icculus@icculus.org>
Wed, 01 Apr 2015 14:45:09 -0400
changeset 9450 bcb16ffce95b
parent 9449 a65088766e35
child 9451 28c55cb65416
Patched to compile on Android (I hope).
src/core/android/SDL_android.c
src/core/android/SDL_android.h
src/video/android/SDL_androidtouch.c
--- a/src/core/android/SDL_android.c	Wed Apr 01 12:14:56 2015 -0400
+++ b/src/core/android/SDL_android.c	Wed Apr 01 14:45:09 2015 -0400
@@ -1610,6 +1610,11 @@
     return s_AndroidExternalFilesPath;
 }
 
+jclass Android_JNI_GetActivityClass(void)
+{
+    return mActivityClass;
+}
+
 #endif /* __ANDROID__ */
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/core/android/SDL_android.h	Wed Apr 01 12:14:56 2015 -0400
+++ b/src/core/android/SDL_android.h	Wed Apr 01 14:45:09 2015 -0400
@@ -78,6 +78,7 @@
 #include <jni.h>
 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);
--- a/src/video/android/SDL_androidtouch.c	Wed Apr 01 12:14:56 2015 -0400
+++ b/src/video/android/SDL_androidtouch.c	Wed Apr 01 14:45:09 2015 -0400
@@ -56,9 +56,11 @@
 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);
 }