An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
fix: mobile, cursor mode, don't reset canvas (#9843)
fufesoufaf97c770cc5
diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dartindex bdee525fd..a1be9c009 100644--- a/flutter/lib/mobile/pages/remote_page.dart+++ b/flutter/lib/mobile/pages/remote_page.dart@@ -542,7 +542,9 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {right: 10,child: QualityMonitor(gFFI.qualityMonitorModel),),- KeyHelpTools(requestShow: (keyboardIsVisible || _showGestureHelp)),+ KeyHelpTools(+ keyboardIsVisible: keyboardIsVisible,+ showGestureHelp: _showGestureHelp),SizedBox(width: 0,height: 0,@@ -771,10 +773,14 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {}class KeyHelpTools extends StatefulWidget {+ final bool keyboardIsVisible;+ final bool showGestureHelp;+/// need to show by external request, etc [keyboardIsVisible] or [changeTouchMode]- final bool requestShow;+ bool get requestShow => keyboardIsVisible || showGestureHelp;- KeyHelpTools({required this.requestShow});+ KeyHelpTools(+ {required this.keyboardIsVisible, required this.showGestureHelp});@overrideState<KeyHelpTools> createState() => _KeyHelpToolsState();@@ -819,7 +825,8 @@ class _KeyHelpToolsState extends State<KeyHelpTools> {final size = renderObject.size;Offset pos = renderObject.localToGlobal(Offset.zero);gFFI.cursorModel.keyHelpToolsVisibilityChanged(- Rect.fromLTWH(pos.dx, pos.dy, size.width, size.height));+ Rect.fromLTWH(pos.dx, pos.dy, size.width, size.height),+ widget.keyboardIsVisible);}}@@ -831,7 +838,8 @@ class _KeyHelpToolsState extends State<KeyHelpTools> {inputModel.command;if (!_pin && !hasModifierOn && !widget.requestShow) {- gFFI.cursorModel.keyHelpToolsVisibilityChanged(null);+ gFFI.cursorModel+ .keyHelpToolsVisibilityChanged(null, widget.keyboardIsVisible);return Offstage();}final size = MediaQuery.of(context).size;diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dartindex 616d80d11..2ddbcd22e 100644--- a/flutter/lib/models/model.dart+++ b/flutter/lib/models/model.dart@@ -1515,12 +1515,8 @@ class CanvasModel with ChangeNotifier {if (kIgnoreDpi && style == kRemoteViewStyleOriginal) {_scale = 1.0 / _devicePixelRatio;}- _x = (size.width - displayWidth * _scale) / 2;- _y = (size.height - displayHeight * _scale) / 2;+ _resetCanvasOffset(displayWidth, displayHeight);_imageOverflow.value = _x < 0 || y < 0;- if (isMobile && style == kRemoteViewStyleOriginal) {- _moveToCenterCursor();- }if (notify) {notifyListeners();}@@ -1530,6 +1526,14 @@ class CanvasModel with ChangeNotifier {tryUpdateScrollStyle(Duration.zero, style);}+ _resetCanvasOffset(int displayWidth, int displayHeight) {+ _x = (size.width - displayWidth * _scale) / 2;+ _y = (size.height - displayHeight * _scale) / 2;+ if (isMobile && _lastViewStyle.style == kRemoteViewStyleOriginal) {+ _moveToCenterCursor();+ }+ }+tryUpdateScrollStyle(Duration duration, String? style) async {if (_scrollStyle != ScrollStyle.scrollbar) return;style ??= await bind.sessionGetViewStyle(sessionId: sessionId);@@ -1640,8 +1644,7 @@ class CanvasModel with ChangeNotifier {if (isWebDesktop) {updateViewStyle();} else {- _x = (size.width - getDisplayWidth() * _scale) / 2;- _y = (size.height - getDisplayHeight() * _scale) / 2;+ _resetCanvasOffset(getDisplayWidth(), getDisplayHeight());}notifyListeners();}@@ -1677,10 +1680,7 @@ class CanvasModel with ChangeNotifier {if (kIgnoreDpi && _lastViewStyle.style == kRemoteViewStyleOriginal) {_scale = 1.0 / _devicePixelRatio;}- final displayWidth = getDisplayWidth();- final displayHeight = getDisplayHeight();- _x = (size.width - displayWidth * _scale) / 2;- _y = (size.height - displayHeight * _scale) / 2;+ _resetCanvasOffset(getDisplayWidth(), getDisplayHeight());bind.sessionSetViewStyle(sessionId: sessionId, value: _lastViewStyle.style);notifyListeners();}@@ -1937,9 +1937,10 @@ class CursorModel with ChangeNotifier {// `lastIsBlocked` is only used in common/widgets/remote_input.dart -> _RawTouchGestureDetectorRegionState -> onDoubleTap()// Because onDoubleTap() doesn't have the `event` parameter, we can't get the touch event's position.bool _lastIsBlocked = false;+ bool _lastKeyboardIsVisible = false;Rect? get keyHelpToolsRect => _keyHelpToolsRect;- keyHelpToolsVisibilityChanged(Rect? r) {+ keyHelpToolsVisibilityChanged(Rect? r, bool keyboardIsVisible) {_keyHelpToolsRect = r;if (r == null) {_lastIsBlocked = false;@@ -1949,11 +1950,10 @@ class CursorModel with ChangeNotifier {// `lastIsBlocked` will be set when the cursor is moving or touch somewhere else._lastIsBlocked = true;}- if (isMobile) {- if (r != null || _lastIsBlocked) {- parent.target?.canvasModel.mobileFocusCanvasCursor();- }+ if (isMobile && _lastKeyboardIsVisible != keyboardIsVisible) {+ parent.target?.canvasModel.mobileFocusCanvasCursor();}+ _lastKeyboardIsVisible = keyboardIsVisible;}get lastIsBlocked => _lastIsBlocked;