mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-19 00:13:01 +08:00
Merge pull request #5121 from dignow/fix/android_mouse_mode
Fix/android mouse mode
This commit is contained in:
commit
71ffa21db0
@ -1350,7 +1350,7 @@ class LastWindowPosition {
|
||||
return LastWindowPosition(m["width"], m["height"], m["offsetWidth"],
|
||||
m["offsetHeight"], m["isMaximized"]);
|
||||
} catch (e) {
|
||||
debugPrintStack(label: e.toString());
|
||||
debugPrintStack(label: 'Failed to load LastWindowPosition "$content" ${e.toString()}');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -184,6 +184,8 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
_TapTracker? _firstTap;
|
||||
_TapTracker? _secondTap;
|
||||
|
||||
PointerDownEvent? _lastPointerDownEvent;
|
||||
|
||||
final Map<int, _TapTracker> _trackers = <int, _TapTracker>{};
|
||||
|
||||
@override
|
||||
@ -238,6 +240,7 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
gestureSettings: gestureSettings,
|
||||
);
|
||||
_trackers[event.pointer] = tracker;
|
||||
_lastPointerDownEvent = event;
|
||||
tracker.startTrackingPointer(_handleEvent, event.transform);
|
||||
}
|
||||
|
||||
@ -248,7 +251,11 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
_registerFirstTap(tracker);
|
||||
} else if (_secondTap != null) {
|
||||
if (event.pointer == _secondTap!.pointer) {
|
||||
if (onHoldDragEnd != null) onHoldDragEnd!(DragEndDetails());
|
||||
if (onHoldDragEnd != null) {
|
||||
onHoldDragEnd!(DragEndDetails());
|
||||
_secondTap = null;
|
||||
_isStart = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_reject(tracker);
|
||||
@ -303,7 +310,11 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
_secondTap?.entry.resolve(GestureDisposition.accepted);
|
||||
_isStart = true;
|
||||
// TODO start details
|
||||
if (onHoldDragStart != null) onHoldDragStart!(DragStartDetails());
|
||||
if (onHoldDragStart != null) {
|
||||
onHoldDragStart!(DragStartDetails(
|
||||
kind: _lastPointerDownEvent?.kind,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
void _reject(_TapTracker tracker) {
|
||||
@ -435,6 +446,8 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
||||
Timer? _firstTapTimer;
|
||||
_TapTracker? _firstTap;
|
||||
|
||||
PointerDownEvent? _lastPointerDownEvent;
|
||||
|
||||
var _isStart = false;
|
||||
|
||||
final Set<int> _upTap = {};
|
||||
@ -476,6 +489,7 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
||||
} else {
|
||||
// first tap
|
||||
_isStart = true;
|
||||
_lastPointerDownEvent = event;
|
||||
_startFirstTapDownTimer();
|
||||
}
|
||||
_trackTap(event);
|
||||
@ -591,7 +605,11 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
||||
|
||||
void _resolve() {
|
||||
// TODO tap down details
|
||||
if (onDoubleFinerTap != null) onDoubleFinerTap!(TapDownDetails());
|
||||
if (onDoubleFinerTap != null) {
|
||||
onDoubleFinerTap!(TapDownDetails(
|
||||
kind: _lastPointerDownEvent?.kind,
|
||||
));
|
||||
}
|
||||
_trackers.forEach((key, value) {
|
||||
value.entry.resolve(GestureDisposition.accepted);
|
||||
});
|
||||
|
@ -93,8 +93,8 @@ class _RawTouchGestureDetectorRegionState
|
||||
}
|
||||
if (handleTouch) {
|
||||
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
|
||||
inputModel.tapDown(MouseButtons.left);
|
||||
}
|
||||
inputModel.tapDown(MouseButtons.left);
|
||||
}
|
||||
|
||||
onTapUp(TapUpDetails d) {
|
||||
@ -103,8 +103,15 @@ class _RawTouchGestureDetectorRegionState
|
||||
}
|
||||
if (handleTouch) {
|
||||
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
|
||||
inputModel.tapUp(MouseButtons.left);
|
||||
}
|
||||
inputModel.tapUp(MouseButtons.left);
|
||||
}
|
||||
|
||||
onTap() {
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
}
|
||||
inputModel.tap(MouseButtons.left);
|
||||
}
|
||||
|
||||
onDoubleTapDown(TapDownDetails d) {
|
||||
@ -136,6 +143,15 @@ class _RawTouchGestureDetectorRegionState
|
||||
}
|
||||
}
|
||||
|
||||
onLongPressUp() {
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
}
|
||||
if (handleTouch) {
|
||||
inputModel.tapUp(MouseButtons.left);
|
||||
}
|
||||
}
|
||||
|
||||
// for mobiles
|
||||
onLongPress() {
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
@ -151,12 +167,20 @@ class _RawTouchGestureDetectorRegionState
|
||||
inputModel.tap(MouseButtons.right);
|
||||
}
|
||||
|
||||
onDoubleFinerTapDown(TapDownDetails d) {
|
||||
lastDeviceKind = d.kind;
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
}
|
||||
// ignore for desktop and mobile
|
||||
}
|
||||
|
||||
onDoubleFinerTap(TapDownDetails d) {
|
||||
lastDeviceKind = d.kind;
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
}
|
||||
if (isDesktop || !handleTouch) {
|
||||
if (isDesktop || !ffiModel.touchMode) {
|
||||
inputModel.tap(MouseButtons.right);
|
||||
}
|
||||
}
|
||||
@ -221,12 +245,16 @@ class _RawTouchGestureDetectorRegionState
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
}
|
||||
if (handleTouch) {
|
||||
inputModel.sendMouse('up', MouseButtons.left);
|
||||
}
|
||||
inputModel.sendMouse('up', MouseButtons.left);
|
||||
}
|
||||
|
||||
// scale + pan event
|
||||
onTwoFingerScaleStart(ScaleStartDetails d) {
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
onTwoFingerScaleUpdate(ScaleUpdateDetails d) {
|
||||
if (lastDeviceKind != PointerDeviceKind.touch) {
|
||||
return;
|
||||
@ -291,7 +319,8 @@ class _RawTouchGestureDetectorRegionState
|
||||
() => TapGestureRecognizer(), (instance) {
|
||||
instance
|
||||
..onTapDown = onTapDown
|
||||
..onTapUp = onTapUp;
|
||||
..onTapUp = onTapUp
|
||||
..onTap = onTap;
|
||||
}),
|
||||
DoubleTapGestureRecognizer:
|
||||
GestureRecognizerFactoryWithHandlers<DoubleTapGestureRecognizer>(
|
||||
@ -305,6 +334,7 @@ class _RawTouchGestureDetectorRegionState
|
||||
() => LongPressGestureRecognizer(), (instance) {
|
||||
instance
|
||||
..onLongPressDown = onLongPressDown
|
||||
..onLongPressUp = onLongPressUp
|
||||
..onLongPress = onLongPress;
|
||||
}),
|
||||
// Customized
|
||||
@ -319,7 +349,9 @@ class _RawTouchGestureDetectorRegionState
|
||||
DoubleFinerTapGestureRecognizer:
|
||||
GestureRecognizerFactoryWithHandlers<DoubleFinerTapGestureRecognizer>(
|
||||
() => DoubleFinerTapGestureRecognizer(), (instance) {
|
||||
instance.onDoubleFinerTap = onDoubleFinerTap;
|
||||
instance
|
||||
..onDoubleFinerTap = onDoubleFinerTap
|
||||
..onDoubleFinerTapDown = onDoubleFinerTapDown;
|
||||
}),
|
||||
CustomTouchGestureRecognizer:
|
||||
GestureRecognizerFactoryWithHandlers<CustomTouchGestureRecognizer>(
|
||||
@ -329,6 +361,7 @@ class _RawTouchGestureDetectorRegionState
|
||||
instance
|
||||
..onOneFingerPanUpdate = onOneFingerPanUpdate
|
||||
..onOneFingerPanEnd = onOneFingerPanEnd
|
||||
..onTwoFingerScaleStart = onTwoFingerScaleStart
|
||||
..onTwoFingerScaleUpdate = onTwoFingerScaleUpdate
|
||||
..onTwoFingerScaleEnd = onTwoFingerScaleEnd
|
||||
..onThreeFingerVerticalDragUpdate = onThreeFingerVerticalDragUpdate;
|
||||
|
Loading…
Reference in New Issue
Block a user