Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix bug 5303 - Touch/Mouse events simulation doesn't work on Android 11
  • Loading branch information
1bsyl committed Oct 5, 2020
1 parent cd6670b commit 2e38c94
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -1923,14 +1923,24 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
@Override
public boolean onTouch(View v, MotionEvent event) {
/* Ref: http://developer.android.com/training/gestures/multi.html */
final int touchDevId = event.getDeviceId();
int touchDevId = event.getDeviceId();
final int pointerCount = event.getPointerCount();
int action = event.getActionMasked();
int pointerFingerId;
int mouseButton;
int i = -1;
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 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN
// 0x2 = SOURCE_CLASS_POINTER
Expand Down

0 comments on commit 2e38c94

Please sign in to comment.