Fix mouse pointer state update
If the pointer is a mouse, the pointer is UP only when no buttons are pressed (not when a button is released, because there might be other buttons still pressed). Refs #3635 <https://github.com/Genymobile/scrcpy/issues/3635> Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
parent
0afef0c634
commit
8c5c55f9e1
1 changed files with 3 additions and 2 deletions
|
@ -196,22 +196,23 @@ public class Controller {
|
||||||
Pointer pointer = pointersState.get(pointerIndex);
|
Pointer pointer = pointersState.get(pointerIndex);
|
||||||
pointer.setPoint(point);
|
pointer.setPoint(point);
|
||||||
pointer.setPressure(pressure);
|
pointer.setPressure(pressure);
|
||||||
pointer.setUp(action == MotionEvent.ACTION_UP);
|
|
||||||
|
|
||||||
int source;
|
int source;
|
||||||
int pointerCount = pointersState.update(pointerProperties, pointerCoords);
|
|
||||||
if (pointerId == POINTER_ID_MOUSE || pointerId == POINTER_ID_VIRTUAL_MOUSE) {
|
if (pointerId == POINTER_ID_MOUSE || pointerId == POINTER_ID_VIRTUAL_MOUSE) {
|
||||||
// real mouse event (forced by the client when --forward-on-click)
|
// real mouse event (forced by the client when --forward-on-click)
|
||||||
pointerProperties[pointerIndex].toolType = MotionEvent.TOOL_TYPE_MOUSE;
|
pointerProperties[pointerIndex].toolType = MotionEvent.TOOL_TYPE_MOUSE;
|
||||||
source = InputDevice.SOURCE_MOUSE;
|
source = InputDevice.SOURCE_MOUSE;
|
||||||
|
pointer.setUp(buttons == 0);
|
||||||
} else {
|
} else {
|
||||||
// POINTER_ID_GENERIC_FINGER, POINTER_ID_VIRTUAL_FINGER or real touch from device
|
// POINTER_ID_GENERIC_FINGER, POINTER_ID_VIRTUAL_FINGER or real touch from device
|
||||||
pointerProperties[pointerIndex].toolType = MotionEvent.TOOL_TYPE_FINGER;
|
pointerProperties[pointerIndex].toolType = MotionEvent.TOOL_TYPE_FINGER;
|
||||||
source = InputDevice.SOURCE_TOUCHSCREEN;
|
source = InputDevice.SOURCE_TOUCHSCREEN;
|
||||||
// Buttons must not be set for touch events
|
// Buttons must not be set for touch events
|
||||||
buttons = 0;
|
buttons = 0;
|
||||||
|
pointer.setUp(action == MotionEvent.ACTION_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pointerCount = pointersState.update(pointerProperties, pointerCoords);
|
||||||
if (pointerCount == 1) {
|
if (pointerCount == 1) {
|
||||||
if (action == MotionEvent.ACTION_DOWN) {
|
if (action == MotionEvent.ACTION_DOWN) {
|
||||||
lastTouchDown = now;
|
lastTouchDown = now;
|
||||||
|
|
Loading…
Reference in a new issue