From 18d30fb441ca16c75a1cf15b63e18e436e94eb21 Mon Sep 17 00:00:00 2001 From: ToadKing Date: Sun, 10 Feb 2013 18:52:37 -0500 Subject: [PATCH] (Android) fix up motion events incorrectly removing every active motion event --- android/native/jni/input_android.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index 7ce5a667ea..7775c660a5 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -172,10 +172,16 @@ static void android_input_poll(void *data) action == AMOTION_EVENT_ACTION_CANCEL || action == AMOTION_EVENT_ACTION_POINTER_UP) || (source == AINPUT_SOURCE_MOUSE && action != AMOTION_EVENT_ACTION_DOWN); - int max = min(AMotionEvent_getPointerCount(event), MAX_TOUCH); - for (motion_pointer = 0; motion_pointer < max; motion_pointer++) + if (keyup) { - if (!keyup) + memmove(pointer + motion_pointer, pointer + motion_pointer + 1, (MAX_TOUCH - motion_pointer - 1) * sizeof(struct input_pointer)); + if (pointer_count > 0) + pointer_count--; + } + else + { + int pointer_max = min(AMotionEvent_getPointerCount(event), MAX_TOUCH); + for (motion_pointer = 0; motion_pointer < pointer_max; motion_pointer++) { x = AMotionEvent_getX(event, motion_pointer); y = AMotionEvent_getY(event, motion_pointer); @@ -186,12 +192,6 @@ static void android_input_poll(void *data) pointer_count = max(pointer_count, motion_pointer + 1); } - else - { - memmove(pointer + motion_pointer, pointer + motion_pointer + 1, (MAX_TOUCH - motion_pointer - 1) * sizeof(struct input_pointer)); - if (pointer_count > 0) - pointer_count--; - } } }