X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fandroid%2Ftouchscreen.cpp;h=4e443b5e0529eda29fd4a7064cbf8456b245100b;hb=ce170ea187abe2b8017cde611d0e2e86a523ee79;hp=f4703c340b8d5cca4fc9164a16a57d0474b01726;hpb=74dbff4e7e7cd427ac50820cc6366ea421d4d049;p=libs%2Fgui.git diff --git a/source/input/android/touchscreen.cpp b/source/input/android/touchscreen.cpp index f4703c3..4e443b5 100644 --- a/source/input/android/touchscreen.cpp +++ b/source/input/android/touchscreen.cpp @@ -4,8 +4,21 @@ 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;