]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/android/touchscreen.cpp
Include the matching header first in .cpp files
[libs/gui.git] / source / input / android / touchscreen.cpp
index f4703c340b8d5cca4fc9164a16a57d0474b01726..ac205386ee0781f952ec40d5d68d57a95d07829e 100644 (file)
@@ -1,11 +1,24 @@
-#include <msp/graphics/window_private.h>
 #include "touchscreen.h"
+#include <msp/graphics/window_private.h>
 
 namespace Msp {
 namespace Input {
 
+bool Touchscreen::is_available()
+{
+       return true;
+}
+
 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;