mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app: don't discard android touch events of unknown tool type
This is the kind of event one gets when using 'adb shell input tap x y', which I am trying to use for the end-to-end tests. Right now, we only have two pointer source types: mouse and touch. On Android, emulated touch events tend to simulate the touchscreen, not a mouse, so let's go with that as a fallback. Perhaps in the future we will have another special pointer source for this kind of event, such as "unknown" or "virtual". Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
@@ -419,6 +419,10 @@ func onTouchEvent(env *C.JNIEnv, class C.jclass, handle C.jlong, action, pointer
|
|||||||
src = pointer.Touch
|
src = pointer.Touch
|
||||||
case C.AMOTION_EVENT_TOOL_TYPE_MOUSE:
|
case C.AMOTION_EVENT_TOOL_TYPE_MOUSE:
|
||||||
src = pointer.Mouse
|
src = pointer.Mouse
|
||||||
|
case C.AMOTION_EVENT_TOOL_TYPE_UNKNOWN:
|
||||||
|
// For example, triggered via 'adb shell input tap'.
|
||||||
|
// Instead of discarding it, treat it as a touch event.
|
||||||
|
src = pointer.Touch
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user