An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
feat: stylus support (#12196)
fufesouf26d2a7b84a4
diff --git a/flutter/lib/common/widgets/remote_input.dart b/flutter/lib/common/widgets/remote_input.dartindex 36fb45339..8eb0ecbc3 100644--- a/flutter/lib/common/widgets/remote_input.dart+++ b/flutter/lib/common/widgets/remote_input.dart@@ -111,9 +111,13 @@ class _RawTouchGestureDetectorRegionState);}+ bool isNotTouchBasedDevice() {+ return !kTouchBasedDeviceKinds.contains(lastDeviceKind);+ }+onTapDown(TapDownDetails d) async {lastDeviceKind = d.kind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -126,7 +130,7 @@ class _RawTouchGestureDetectorRegionStateonTapUp(TapUpDetails d) async {final TapDownDetails? lastTapDownDetails = _lastTapDownDetails;_lastTapDownDetails = null;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -142,7 +146,7 @@ class _RawTouchGestureDetectorRegionState}onTap() async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (!handleTouch) {@@ -153,7 +157,7 @@ class _RawTouchGestureDetectorRegionStateonDoubleTapDown(TapDownDetails d) async {lastDeviceKind = d.kind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -163,7 +167,7 @@ class _RawTouchGestureDetectorRegionState}onDoubleTap() async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (ffiModel.touchMode && ffi.cursorModel.lastIsBlocked) {@@ -179,7 +183,7 @@ class _RawTouchGestureDetectorRegionStateonLongPressDown(LongPressDownDetails d) async {lastDeviceKind = d.kind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -198,7 +202,7 @@ class _RawTouchGestureDetectorRegionState}onLongPressUp() async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -208,7 +212,7 @@ class _RawTouchGestureDetectorRegionState// for mobilesonLongPress() async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (!ffi.ffiModel.isPeerMobile) {@@ -228,7 +232,7 @@ class _RawTouchGestureDetectorRegionState}onLongPressMoveUpdate(LongPressMoveUpdateDetails d) async {- if (!ffiModel.isPeerMobile || lastDeviceKind != PointerDeviceKind.touch) {+ if (!ffiModel.isPeerMobile || isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -241,7 +245,7 @@ class _RawTouchGestureDetectorRegionStateonDoubleFinerTapDown(TapDownDetails d) async {lastDeviceKind = d.kind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}_doubleFinerTapPosition = d.localPosition;@@ -250,7 +254,7 @@ class _RawTouchGestureDetectorRegionStateonDoubleFinerTap(TapDownDetails d) async {lastDeviceKind = d.kind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}@@ -266,7 +270,7 @@ class _RawTouchGestureDetectorRegionStateonHoldDragStart(DragStartDetails d) async {lastDeviceKind = d.kind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (!handleTouch) {@@ -275,7 +279,7 @@ class _RawTouchGestureDetectorRegionState}onHoldDragUpdate(DragUpdateDetails d) async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (!handleTouch) {@@ -284,7 +288,7 @@ class _RawTouchGestureDetectorRegionState}onHoldDragEnd(DragEndDetails d) async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (!handleTouch) {@@ -296,7 +300,7 @@ class _RawTouchGestureDetectorRegionStatefinal TapDownDetails? lastTapDownDetails = _lastTapDownDetails;_lastTapDownDetails = null;lastDeviceKind = d.kind ?? lastDeviceKind;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (handleTouch) {@@ -342,7 +346,7 @@ class _RawTouchGestureDetectorRegionState}onOneFingerPanUpdate(DragUpdateDetails d) async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (ffi.cursorModel.shouldBlock(d.localPosition.dx, d.localPosition.dy)) {@@ -356,7 +360,7 @@ class _RawTouchGestureDetectorRegionStateonOneFingerPanEnd(DragEndDetails d) async {_touchModePanStarted = false;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if (isDesktop || isWebDesktop) {@@ -370,13 +374,13 @@ class _RawTouchGestureDetectorRegionState// scale + pan eventonTwoFingerScaleStart(ScaleStartDetails d) {_lastTapDownDetails = null;- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}}onTwoFingerScaleUpdate(ScaleUpdateDetails d) async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if ((isDesktop || isWebDesktop)) {@@ -401,7 +405,7 @@ class _RawTouchGestureDetectorRegionState}onTwoFingerScaleEnd(ScaleEndDetails d) async {- if (lastDeviceKind != PointerDeviceKind.touch) {+ if (isNotTouchBasedDevice()) {return;}if ((isDesktop || isWebDesktop)) {diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dartindex d608df83a..ef42318f0 100644--- a/flutter/lib/consts.dart+++ b/flutter/lib/consts.dart@@ -1,3 +1,4 @@+import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';import 'package:flutter_hbb/common.dart';import 'package:flutter_hbb/models/state_model.dart';@@ -336,6 +337,12 @@ const kRemoteImageQualityCustom = 'custom';const kIgnoreDpi = true;+const Set<PointerDeviceKind> kTouchBasedDeviceKinds = {+ PointerDeviceKind.touch,+ PointerDeviceKind.stylus,+ PointerDeviceKind.invertedStylus,+};+// ================================ mobile ================================// Magic numbers, maybe need to avoid it or use a better way to get them.