Merge pull request #2200 from Kingtous/master

fix: window overflow after restore from fullscreen
This commit is contained in:
RustDesk 2022-11-18 11:30:09 +08:00 committed by GitHub
commit 404645a747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,7 @@
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../consts.dart';
@ -26,7 +29,20 @@ class StateGlobal {
_resizeEdgeSize.value =
fullscreen ? kFullScreenEdgeSize : kWindowEdgeSize;
_windowBorderWidth.value = fullscreen ? 0 : kWindowBorderWidth;
WindowController.fromWindowId(windowId).setFullscreen(_fullscreen);
WindowController.fromWindowId(windowId)
.setFullscreen(_fullscreen)
.then((_) {
// https://github.com/leanflutter/window_manager/issues/131#issuecomment-1111587982
if (Platform.isWindows && !v) {
Future.delayed(Duration.zero, () async {
final frame =
await WindowController.fromWindowId(windowId).getFrame();
final newRect = Rect.fromLTWH(
frame.left, frame.top, frame.width + 1, frame.height + 1);
await WindowController.fromWindowId(windowId).setFrame(newRect);
});
}
});
}
}