mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-25 19:08:47 +02:00
Android: more separate-mouse-and-touch work.
This avoids a hint lookup for each mouse event we get by setting a static Java variable from native code during our hint watcher callback. Also attempts to do the right thing with mouse buttons if you happen to be on an API14 (Ice Cream Sandwich, Android 4.0) or later device. We still target API12 (Honeycomb MR1, Android 3.1) for SDL 2.0.4 though. This isn't tested, so I'm pushing to see what the Android buildbot says. Stand back, I'm a professional!
This commit is contained in:
@@ -57,6 +57,9 @@ SeparateEventsHintWatcher(void *userdata, const char *name,
|
||||
const char *oldValue, const char *newValue)
|
||||
{
|
||||
separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0));
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
jfieldID fid = (*env)->GetStaticFieldID(env, mActivityClass, "mSeparateMouseAndTouch", "Z");
|
||||
(*env)->SetStaticBooleanField(env, mActivityClass, fid, separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE);
|
||||
}
|
||||
|
||||
void Android_InitTouch(void)
|
||||
|
||||
Reference in New Issue
Block a user