Fix Touch not working on some Google Pixel phones
This commit is contained in:
committed by
Joshua Granick
parent
ccd9dca6e1
commit
a7451bb9a4
@@ -1933,13 +1933,23 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
/* Ref: http://developer.android.com/training/gestures/multi.html */
|
/* Ref: http://developer.android.com/training/gestures/multi.html */
|
||||||
final int touchDevId = event.getDeviceId();
|
int touchDevId = event.getDeviceId();
|
||||||
final int pointerCount = event.getPointerCount();
|
final int pointerCount = event.getPointerCount();
|
||||||
int action = event.getActionMasked();
|
int action = event.getActionMasked();
|
||||||
int pointerFingerId;
|
int pointerFingerId;
|
||||||
int mouseButton;
|
int mouseButton;
|
||||||
int i = -1;
|
int i = -1;
|
||||||
float x,y,p;
|
float x,y,p;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent id to be -1, since it's used in SDL internal for synthetic events
|
||||||
|
* Appears when using Android emulator, eg:
|
||||||
|
* adb shell input mouse tap 100 100
|
||||||
|
* adb shell input touchscreen tap 100 100
|
||||||
|
*/
|
||||||
|
if (touchDevId < 0) {
|
||||||
|
touchDevId -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
// 12290 = Samsung DeX mode desktop mouse
|
// 12290 = Samsung DeX mode desktop mouse
|
||||||
// 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN
|
// 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN
|
||||||
|
|||||||
Reference in New Issue
Block a user