File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
ion/src/simulator/android/src/java/org/libsdl/app Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1866,14 +1866,24 @@ else if (event.getAction() == KeyEvent.ACTION_UP) {
18661866 @ Override
18671867 public boolean onTouch (View v , MotionEvent event ) {
18681868 /* Ref: http://developer.android.com/training/gestures/multi.html */
1869- final int touchDevId = event .getDeviceId ();
1869+ int touchDevId = event .getDeviceId ();
18701870 final int pointerCount = event .getPointerCount ();
18711871 int action = event .getActionMasked ();
18721872 int pointerFingerId ;
18731873 int mouseButton ;
18741874 int i = -1 ;
18751875 float x ,y ,p ;
18761876
1877+ /**
1878+ * Prevent id to be -1, since it's used in SDL internal for synthetic events
1879+ * Appears when using Android emulator, eg:
1880+ * adb shell input mouse tap 100 100
1881+ * adb shell input touchscreen tap 100 100
1882+ */
1883+ if (touchDevId < 0 ) {
1884+ touchDevId -= 1 ;
1885+ }
1886+
18771887 // 12290 = Samsung DeX mode desktop mouse
18781888 // 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN
18791889 // 0x2 = SOURCE_CLASS_POINTER
You can’t perform that action at this time.
0 commit comments