mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-24 20:05:28 +00:00
Fixed bug 2558 - Missing FINGERUP in Android
Sylvain If you play with the TouchScreen with +3 fingers randomly / pressing simultaneously all fingers. You triggers FINGER DOWN events, but not always all the associated FINGER UP events. So, after a while SDL_GetNumFingers() can report a wrong number of fingers pressed ! The explanation is hidden there : http://developer.android.com/reference/android/view/MotionEvent.html Each pointer has a unique id that is assigned when it first goes down (indicated by ACTION_DOWN or ACTION_POINTER_DOWN). 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). in ACTION_CANCEL : The current gesture has been aborted. You will not receive any more points in it. You should treat this as an up event, but not perform any action that you normally would. Constant Value: 3 (0x00000003)
This commit is contained in:
parent
260549d1ca
commit
047c19ce76
|
@ -786,6 +786,16 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||||
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
|
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
for (i = 0; i < pointerCount; i++) {
|
||||||
|
pointerFingerId = event.getPointerId(i);
|
||||||
|
x = event.getX(i) / mWidth;
|
||||||
|
y = event.getY(i) / mHeight;
|
||||||
|
p = event.getPressure(i);
|
||||||
|
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, MotionEvent.ACTION_UP, x, y, p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue