From 9f80f36c1653a8aa08e178130f05df701998a5b6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Dec 2012 21:10:18 +0100 Subject: [PATCH] (Android) Small refinement to input --- android/native/jni/input_android.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index ded1d24b22..a563c94fe4 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -361,17 +361,22 @@ static void android_input_poll(void *data) } else { - bool mouse_is_not_dirty = (source == AINPUT_SOURCE_MOUSE && action != AMOTION_EVENT_ACTION_DOWN); - bool pointer_is_not_dirty = (action == AMOTION_EVENT_ACTION_UP || - action == AMOTION_EVENT_ACTION_CANCEL || action == AMOTION_EVENT_ACTION_POINTER_UP); + bool keyup = (action == AMOTION_EVENT_ACTION_UP || + action == AMOTION_EVENT_ACTION_CANCEL || action == AMOTION_EVENT_ACTION_POINTER_UP) || + (source == AINPUT_SOURCE_MOUSE && action != AMOTION_EVENT_ACTION_DOWN); - float x = AMotionEvent_getX(event, motionevent_count); - float y = AMotionEvent_getY(event, motionevent_count); + pointer_dirty[motionevent_count] = false; - pointer_dirty[motionevent_count] = !(mouse_is_not_dirty || pointer_is_not_dirty); + if (!keyup) + { + pointer_dirty[motionevent_count] = true; + float x = AMotionEvent_getX(event, motionevent_count); + float y = AMotionEvent_getY(event, motionevent_count); + + if (pointer_dirty[motionevent_count]) + input_translate_coord_viewport(x, y, &pointer_x[motionevent_count], &pointer_y[motionevent_count]); + } - if (pointer_dirty[motionevent_count]) - input_translate_coord_viewport(x, y, &pointer_x[motionevent_count], &pointer_y[motionevent_count]); motionevent_count++; } #ifdef RARCH_INPUT_DEBUG