Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Refactor, optional parameter 'updateCursorPos'

fufesou570ce7d28deb
diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart
index 4e6373434..3670bbd00 100644
--- a/flutter/lib/common.dart
+++ b/flutter/lib/common.dart
@@ -2698,7 +2698,7 @@ Future<List<Rect>> getScreenRectList() async {
: await getScreenListNotWayland();
}
-openMonitorInTheSameTab(int i, FFI ffi, PeerInfo pi, bool updateCursorPos) {
+openMonitorInTheSameTab(int i, FFI ffi, PeerInfo pi, {bool updateCursorPos = true}) {
final displays = i == kAllDisplayValue
? List.generate(pi.displays.length, (index) => index)
: [i];
@@ -2707,7 +2707,7 @@ openMonitorInTheSameTab(int i, FFI ffi, PeerInfo pi, bool updateCursorPos) {
sessionId: ffi.sessionId,
value: Int32List.fromList(displays),
);
- ffi.ffiModel.switchToNewDisplay(i, ffi.sessionId, ffi.id, updateCursorPos);
+ ffi.ffiModel.switchToNewDisplay(i, ffi.sessionId, ffi.id, updateCursorPos: updateCursorPos);
}
// Open new tab or window to show this monitor.
diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart
index 5017f72b0..08d89f51a 100644
--- a/flutter/lib/desktop/widgets/remote_toolbar.dart
+++ b/flutter/lib/desktop/widgets/remote_toolbar.dart
@@ -820,8 +820,7 @@ class _MonitorMenu extends StatelessWidget {
if (isChooseDisplayToOpenInNewWindow(pi, ffi.sessionId)) {
openMonitorInNewTabOrWindow(i, ffi.id, pi);
} else {
- final updateCursorPos = !isMulti;
- openMonitorInTheSameTab(i, ffi, pi, updateCursorPos);
+ openMonitorInTheSameTab(i, ffi, pi, updateCursorPos: !isMulti);
}
}
}
diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart
index 459d66feb..1e36e49b2 100644
--- a/flutter/lib/mobile/pages/remote_page.dart
+++ b/flutter/lib/mobile/pages/remote_page.dart
@@ -787,7 +787,7 @@ void showOptions(
children.add(InkWell(
onTap: () {
if (i == cur) return;
- openMonitorInTheSameTab(i, gFFI, pi, true);
+ openMonitorInTheSameTab(i, gFFI, pi);
gFFI.dialogManager.dismissAll();
},
child: Ink(
diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart
index 6cb553cda..d7e6265fa 100644
--- a/flutter/lib/models/model.dart
+++ b/flutter/lib/models/model.dart
@@ -915,7 +915,7 @@ class FfiModel with ChangeNotifier {
if (_pi.isSupportMultiUiSession) {
// If the peer supports multi-ui-session, no switch display message will be send back.
// We need to update the display manually.
- switchToNewDisplay(newDisplay, sessionId, peerId, true);
+ switchToNewDisplay(newDisplay, sessionId, peerId);
}
} else {
msgBox(sessionId, 'nocancel-error', 'Prompt', 'No Displays', '',
@@ -955,12 +955,8 @@ class FfiModel with ChangeNotifier {
}
// Directly switch to the new display without waiting for the response.
- switchToNewDisplay(
- int display,
- SessionID sessionId,
- String peerId,
- bool updateCursorPos,
- ) {
+ switchToNewDisplay(int display, SessionID sessionId, String peerId,
+ {bool updateCursorPos = true}) {
// VideoHandler creation is upon when video frames are received, so either caching commands(don't know next width/height) or stopping recording when switching displays.
parent.target?.recordingModel.onClose();
// no need to wait for the response