From 28cbe0f4641e53789ad8ef4935ddea0c3285c147 Mon Sep 17 00:00:00 2001 From: dignow Date: Wed, 9 Aug 2023 18:37:09 +0800 Subject: [PATCH] fix, set window position before show when reusing window Signed-off-by: dignow --- flutter/lib/common.dart | 2 ++ flutter/lib/utils/multi_window_manager.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 570b134c5..e518a56e0 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1543,6 +1543,8 @@ Future restoreWindowPosition(WindowType type, bool isRemotePeerPos = false; String? pos; + // No need to check mainGetLocalBoolOptionSync(kOptionOpenNewConnInTabs) + // Though "open in tabs" is true and the new window restore peer position, it's ok. if (type == WindowType.RemoteDesktop && windowId != null && peerId != null) { // If the restore position is called by main window, and the peer id is not null // then we may need to get the position by reading the peer config. diff --git a/flutter/lib/utils/multi_window_manager.dart b/flutter/lib/utils/multi_window_manager.dart index 4bd8a46e9..3f7d995b7 100644 --- a/flutter/lib/utils/multi_window_manager.dart +++ b/flutter/lib/utils/multi_window_manager.dart @@ -98,9 +98,9 @@ class RustDeskMultiWindowManager { if (_inactiveWindows.isNotEmpty) { for (final windowId in windows) { if (_inactiveWindows.contains(windowId)) { - await DesktopMultiWindow.invokeMethod(windowId, methodName, msg); await restoreWindowPosition(type, windowId: windowId, peerId: remoteId); + await DesktopMultiWindow.invokeMethod(windowId, methodName, msg); WindowController.fromWindowId(windowId).show(); registerActiveWindow(windowId); return;