Permalink
Browse files

FIX: [droid] fix multitouch

  • Loading branch information...
1 parent c4d4916 commit cdc12a59a790a959acc3a9ab2328cc4e95b4a582 @koying committed with Mar 22, 2013
Showing with 6 additions and 5 deletions.
  1. +6 −5 xbmc/android/activity/AndroidTouch.cpp
View
11 xbmc/android/activity/AndroidTouch.cpp
@@ -50,7 +50,8 @@ bool CAndroidTouch::onTouchEvent(AInputEvent* event)
int32_t eventAction = AMotionEvent_getAction(event);
int8_t touchAction = eventAction & AMOTION_EVENT_ACTION_MASK;
- size_t touchPointer = eventAction >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+ size_t touchPointerIdx = eventAction >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+ int32_t touchPointerID = AMotionEvent_getPointerId(event, touchPointerIdx);
TouchInput touchEvent = TouchInputAbort;
switch (touchAction)
@@ -75,18 +76,18 @@ bool CAndroidTouch::onTouchEvent(AInputEvent* event)
break;
}
- float x = AMotionEvent_getX(event, touchPointer);
- float y = AMotionEvent_getY(event, touchPointer);
+ float x = AMotionEvent_getX(event, touchPointerIdx);
+ float y = AMotionEvent_getY(event, touchPointerIdx);
float size = m_dpi / 16.0f;
int64_t time = AMotionEvent_getEventTime(event);
// first update all touch pointers
for (unsigned int pointer = 0; pointer < numPointers; pointer++)
- CGenericTouchInputHandler::Get().UpdateTouchPointer(pointer, AMotionEvent_getX(event, pointer), AMotionEvent_getY(event, pointer),
+ CGenericTouchInputHandler::Get().UpdateTouchPointer(AMotionEvent_getPointerId(event, pointer), AMotionEvent_getX(event, pointer), AMotionEvent_getY(event, pointer),
AMotionEvent_getEventTime(event), m_dpi / 16.0f);
// now send the event
- return CGenericTouchInputHandler::Get().HandleTouchInput(touchEvent, x, y, time, touchPointer, size);
+ return CGenericTouchInputHandler::Get().HandleTouchInput(touchEvent, x, y, time, touchPointerID, size);
}
void CAndroidTouch::setDPI(uint32_t dpi)

0 comments on commit cdc12a5

Please sign in to comment.