Fixed bug 3128 - Removing all the static variables from android SDLActivity and accompanying JNI calls.
owen I removed all the static variables from SDLActivity.java Updated all the SDL_android.c jni calls as well I added a new function to SDL_android.c/ h void Android_JNI_SeparateEventsHint(const char* c); This is called by SDL_androidtouch.c so that this TU doesn't need to call any JNI functions.
This commit is contained in:
parent
0a52db54bd
commit
c086251266
3 changed files with 20 additions and 11 deletions
|
@ -181,6 +181,9 @@ static jmethodID midPollInputDevices;
|
|||
static jmethodID midPollHapticDevices;
|
||||
static jmethodID midHapticRun;
|
||||
|
||||
/* static fields */
|
||||
static jfieldID fidSeparateMouseAndTouch;
|
||||
|
||||
/* Accelerometer data storage */
|
||||
static float fLastAccelerometer[3];
|
||||
static SDL_bool bHasNewData;
|
||||
|
@ -253,6 +256,13 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls)
|
|||
!midPollInputDevices || !midPollHapticDevices || !midHapticRun) {
|
||||
__android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly");
|
||||
}
|
||||
|
||||
fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z");
|
||||
|
||||
if (!fidSeparateMouseAndTouch) {
|
||||
__android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java static fields, check that they're named and typed correctly");
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!");
|
||||
}
|
||||
|
||||
|
@ -693,11 +703,6 @@ int Android_JNI_SetupThread(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
jclass Android_JNI_GetActivityClass(void)
|
||||
{
|
||||
return mActivityClass;
|
||||
}
|
||||
|
||||
/*
|
||||
* Audio support
|
||||
*/
|
||||
|
@ -1590,6 +1595,13 @@ int Android_JNI_GetTouchDeviceIds(int **ids) {
|
|||
return number;
|
||||
}
|
||||
|
||||
/* sets the mSeparateMouseAndTouch field */
|
||||
void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
(*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE);
|
||||
}
|
||||
|
||||
void Android_JNI_PollInputDevices(void)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue