refact, separate remote window, add offset

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-08-03 18:03:56 +08:00
parent 1a8463015f
commit 902f56c499

View File

@ -1528,10 +1528,12 @@ Future<bool> 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<bool> 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: