Closed db47h closed 13 years ago
Thanks for the multitouch, I'm currently testing on my N1 and having some troubles (some up events are missed, so the button gray overlay stays on). Will update on my findings
I modified the code so that we keep track of the event's pointer id in the touches array (now int[] instead of boolean[]). When an UP event is received, instead of checking the event coordinates, I just look up the pointer in touches in order to find the key that originally triggered the DOWN event. As a side effect, you can now press a key and release somewhere else on the screen (really helps with fat fingers ;), the UP event for that key should not be lost (that's why I removed all the "UP rejected" stuff).
Works flawlessly on Nexus S and emulator (Gingerbread 2.3.3). I may have missed something though. May be in the way I store pointer ID + 1 in the array since the pointer IDs are zero based and I used zero as a "not pressed" value (could have missed a +/-1 somewhere).
Managed to reproduce:
Then 3 doesn't go up. It's possible that the ACTION_POINTER_UP event doesn't trigger after the primary pinter triggers ACTION_UP...
FWIW, it's working fine when I remove the first if block (the one with no pointerId gestion) and extend the second one with actionCode == MotionEvent.ACTION_DOWN || actionCode == MotionEvent.ACTION_UP || actionCode == MotionEvent.ACTION_POINTER_DOWN || actionCode == MotionEvent.ACTION_POINTER_UP
Well spotted, that was it.
When the primary "pointer" is released, the first secondary pointer gets promoted to primary, which then triggers ACTION_UP events instead of ACTION_POINTER_UP, but the actual pointer ID is kept. Neat.
Should be working now.