From ff0d9665e5753f24956273483a52c00ac91ed5f2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 30 Jan 2016 20:36:42 +0200 Subject: [PATCH] Check for event type and source in Android touchscreen driver --- source/input/android/touchscreen.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/input/android/touchscreen.cpp b/source/input/android/touchscreen.cpp index 6472f44..4e443b5 100644 --- a/source/input/android/touchscreen.cpp +++ b/source/input/android/touchscreen.cpp @@ -11,6 +11,14 @@ bool Touchscreen::is_available() void Touchscreen::input_event(const Graphics::Window::Event &event) { + int type = AInputEvent_getType(event.aevent); + if(type!=AINPUT_EVENT_TYPE_MOTION) + return; + + int source = AInputEvent_getSource(event.aevent); + if(source!=AINPUT_SOURCE_TOUCHSCREEN && source!=AINPUT_SOURCE_STYLUS) + return; + int action = AMotionEvent_getAction(event.aevent); int action_pointer = (action&AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)>>AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; action &= AMOTION_EVENT_ACTION_MASK; -- 2.45.2