Refactor, optional parameter 'updateCursorPos'

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-12-02 22:01:05 +08:00
parent 3958090e0f
commit 570ce7d28d
4 changed files with 7 additions and 12 deletions

View File

@ -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.

View File

@ -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);
}
}
}

View File

@ -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(

View File

@ -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