]> git.tdb.fi Git - libs/gui.git/commitdiff
Check for event type and source in Android touchscreen driver
authorMikko Rasa <tdb@tdb.fi>
Sat, 30 Jan 2016 18:36:42 +0000 (20:36 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 30 Jan 2016 18:36:42 +0000 (20:36 +0200)
source/input/android/touchscreen.cpp

index 6472f4476b973d2b813f6404af8e787f3d7e14e1..4e443b5e0529eda29fd4a7064cbf8456b245100b 100644 (file)
@@ -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;