From 19945df0b3da4b8ac3cc7565239c1a40820979cf Mon Sep 17 00:00:00 2001 From: dignow Date: Tue, 17 Oct 2023 07:43:12 +0800 Subject: [PATCH] open_multi_windows, check before move and set fullscreen Signed-off-by: dignow --- flutter/lib/common.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index a67aa27fe..c7c11da96 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1675,7 +1675,6 @@ Future _adjustRestoreMainWindowOffset( /// Note that windowId must be provided if it's subwindow Future restoreWindowPosition(WindowType type, {int? windowId, String? peerId}) async { - debugPrintStack(label: "restoreWindowPosition"); if (bind .mainGetEnv(key: "DISABLE_RUSTDESK_RESTORE_WINDOW_POSITION") .isNotEmpty) { @@ -2707,9 +2706,18 @@ tryMoveToScreenAndSetFullscreen(Rect? screenRect) async { if (screenRect == null) { return; } + final wc = WindowController.fromWindowId(stateGlobal.windowId); + final curFrame = await wc.getFrame(); final frame = Rect.fromLTWH(screenRect.left + 30, screenRect.top + 30, 600, 400); - await WindowController.fromWindowId(stateGlobal.windowId).setFrame(frame); + if (stateGlobal.fullscreen && + curFrame.left <= frame.left && + curFrame.top <= frame.top && + curFrame.width >= frame.width && + curFrame.height >= frame.height) { + return; + } + await wc.setFrame(frame); // An duration is needed to avoid the window being restored after fullscreen. Future.delayed(Duration(milliseconds: 300), () async { stateGlobal.setFullscreen(true);