SDL/Android handling of ACTION_CANCEL event


I think I found a bug in the SDL/Android port.
The onTouch() method is not handling the MotionEvent.ACTION_CANCEL case. :
“A pointer id remains valid until the pointer eventually goes up
(indicated by ACTION_UP or ACTION_POINTER_UP) or when the gesture is
canceled (indicated by ACTION_CANCEL).”

When the Java side receives ACTION_CANCEL, it should (at least)
interpret it as SDL FINGER_UP events.

Otherwise :

  • Missing events FINGER_UP
  • very small memory leak, because some SDL_AddFinger() are never
    released with a SDL_DelFinger()
  • SDL_GetNumTouchFingers() reports a wrong count

It’s not obvious to trigger the ACTION_CANCEL (needs to tap with 3+
finger on the tablet).
I can’t reproduced it with Nexus7 but it happens with HTC ONE.

reported + some patch here: