diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index cea5fb867..9f9cd8ad6 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -566,12 +566,13 @@ class _RemotePageState extends State with WidgetsBindingObserver { } return Container( color: MyTheme.canvasColor, - child: inputModel.isPhysicalMouse.value - ? getBodyForMobile() - : RawTouchGestureDetectorRegion( - child: getBodyForMobile(), - ffi: gFFI, - ), + child: withKeyHelpTools( + inputModel.isPhysicalMouse.value + ? getBodyForMobile() + : RawTouchGestureDetectorRegion( + child: getBodyForMobile(), + ffi: gFFI, + )), ); }), ), @@ -712,6 +713,27 @@ class _RemotePageState extends State with WidgetsBindingObserver { !gFFI.canvasModel.cursorEmbedded && !gFFI.inputModel.relativeMouseMode.value; + // The key bar sits above the canvas, outside its gesture region: a touch on the bar must not + // also reach the canvas recognizers, which would send it to the remote as a mouse event. + // The cursor and the touch-mode virtual mouse stay above the bar, as they were inside the canvas + // stack. The mouse-mode virtual mouse stays inside the region: see getBodyForMobile. + Widget withKeyHelpTools(Widget body) => Stack(children: [ + Positioned.fill(child: body), + Obx(() { + final chatKeyboardRequested = + gFFI.chatModel.softKeyboardRequested.value; + return KeyHelpTools( + keyboardIsVisible: keyboardVisibilityController.isVisible && + (_showEdit || chatKeyboardRequested), + showGestureHelp: _showGestureHelp); + }), + if (showCursorPaint) CursorPaint(widget.id), + if (gFFI.ffiModel.touchMode) + FloatingMouse( + ffi: gFFI, + ), + ]); + Widget getBodyForMobile() { return Container( color: MyTheme.canvasColor, @@ -723,14 +745,6 @@ class _RemotePageState extends State with WidgetsBindingObserver { right: 10, child: QualityMonitor(gFFI.qualityMonitorModel), ), - Obx(() { - final chatKeyboardRequested = - gFFI.chatModel.softKeyboardRequested.value; - return KeyHelpTools( - keyboardIsVisible: keyboardVisibilityController.isVisible && - (_showEdit || chatKeyboardRequested), - showGestureHelp: _showGestureHelp); - }), SizedBox( width: 0, height: 0, @@ -762,14 +776,9 @@ class _RemotePageState extends State with WidgetsBindingObserver { ).workaroundFreezeLinuxMint(), ), ]; - if (showCursorPaint) { - paints.add(CursorPaint(widget.id)); - } - if (gFFI.ffiModel.touchMode) { - paints.add(FloatingMouse( - ffi: gFFI, - )); - } else { + // Holding a virtual button while another finger drags needs both pointers in the canvas + // recognizers (isSpecialHoldDragActive), so these stay inside the gesture region. + if (!gFFI.ffiModel.touchMode) { paints.add(FloatingMouseWidgets( ffi: gFFI, ));