open_multi_windows, check before move and set fullscreen

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-10-17 07:43:12 +08:00
parent bf83d552f8
commit 19945df0b3

View File

@ -1675,7 +1675,6 @@ Future<Offset?> _adjustRestoreMainWindowOffset(
/// Note that windowId must be provided if it's subwindow
Future<bool> 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);