From 902f56c499c54c221f077ac8acc9140617513f7e Mon Sep 17 00:00:00 2001 From: dignow Date: Thu, 3 Aug 2023 18:03:56 +0800 Subject: [PATCH] refact, separate remote window, add offset Signed-off-by: dignow --- flutter/lib/common.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index a9117554d..7324a8c18 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1528,10 +1528,12 @@ Future restoreWindowPosition(WindowType type, return false; } + bool isRemotePeerPos = false; String? pos; if (type == WindowType.RemoteDesktop && windowId != null && peerId != null) { pos = await bind.sessionGetFlutterConfigByPeerId( id: peerId, k: kWindowPrefix); + isRemotePeerPos = pos != null; } pos ??= bind.getLocalFlutterConfig(k: kWindowPrefix + type.name); @@ -1540,6 +1542,14 @@ Future restoreWindowPosition(WindowType type, debugPrint("no window position saved, ignoring position restoration"); return false; } + if (type == WindowType.RemoteDesktop && !isRemotePeerPos && windowId != null) { + if (lpos.offsetWidth != null) { + lpos.offsetWidth = lpos.offsetWidth! + windowId * 20; + } + if (lpos.offsetHeight != null) { + lpos.offsetHeight = lpos.offsetHeight! + windowId * 20; + } + } switch (type) { case WindowType.Main: