From 9bca5ac000b696a7802f7f61af2ebc368fff5523 Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Tue, 22 Jul 2025 15:16:13 +0800 Subject: [PATCH] refact: terminal, save window pos on close (#12370) Signed-off-by: fufesou --- flutter/lib/utils/multi_window_manager.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flutter/lib/utils/multi_window_manager.dart b/flutter/lib/utils/multi_window_manager.dart index a7b06b5c7..95044eb74 100644 --- a/flutter/lib/utils/multi_window_manager.dart +++ b/flutter/lib/utils/multi_window_manager.dart @@ -460,9 +460,13 @@ class RustDeskMultiWindowManager { if (windows.isEmpty) { return; } - for (final wId in windows) { - debugPrint("closing multi window, type: ${type.toString()} id: $wId"); - await saveWindowPosition(type, windowId: wId); + for (int i = 0; i < windows.length; i++) { + final wId = windows[i]; + final shouldSavePos = type != WindowType.Terminal || i == windows.length - 1; + if (shouldSavePos) { + debugPrint("closing multi window, type: ${type.toString()} id: $wId"); + await saveWindowPosition(type, windowId: wId); + } try { await WindowController.fromWindowId(wId).setPreventClose(false); await WindowController.fromWindowId(wId).close();