refact: terminal, save window pos on close (#12370)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2025-07-22 15:16:13 +08:00 committed by GitHub
commit 9bca5ac000
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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