Skip to content

Commit

Permalink
Patched to compile on Android (I hope).
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Apr 1, 2015
1 parent f904177 commit 64237d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/core/android/SDL_android.c
Expand Up @@ -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: */
Expand Down
1 change: 1 addition & 0 deletions src/core/android/SDL_android.h
Expand Up @@ -78,6 +78,7 @@ int Android_JNI_GetTouchDeviceIds(int **ids);
#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);
Expand Down
4 changes: 3 additions & 1 deletion src/video/android/SDL_androidtouch.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 64237d7

Please sign in to comment.