fix: orderout not working when fullscreen on macos

This commit is contained in:
Kingtous 2023-02-21 21:39:32 +08:00
parent 086f1a134b
commit f03c265f9c
2 changed files with 12 additions and 5 deletions

View File

@ -548,13 +548,20 @@ class WindowActionPanelState extends State<WindowActionPanel>
if (rustDeskWinManager.getActiveWindows().contains(kMainWindowId)) {
await rustDeskWinManager.unregisterActiveWindow(kMainWindowId);
}
// `hide` must be placed after unregisterActiveWindow, because once all windows are hidden,
// flutter closes the application on macOS. We should ensure the post-run logic has ran successfully.
// e.g.: saving window position.
// macOS specific workaround, the windows is not hiding when in fullscreen.
if (Platform.isMacOS && await windowManager.isFullScreen()) {
await windowManager.setFullScreen(false);
await Future.delayed(Duration(seconds: 1));
}
await windowManager.hide();
} else {
// it's safe to hide the subwindow
await WindowController.fromWindowId(kWindowId!).hide();
final controller = WindowController.fromWindowId(kWindowId!);
if (Platform.isMacOS && await controller.isFullScreen()) {
await controller.setFullscreen(false);
await Future.delayed(Duration(seconds: 1));
}
await controller.hide();
await Future.wait([
rustDeskWinManager
.call(WindowType.Main, kWindowEventHide, {"id": kWindowId!}),

View File

@ -59,7 +59,7 @@ dependencies:
desktop_multi_window:
git:
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
ref: bc8604a88e52b2b6e64d2661ae49a71450a47af8
ref: 84a027ac2eed31e1b7c0ad11de47ed846501824e
freezed_annotation: ^2.0.3
flutter_custom_cursor: ^0.0.4
window_size: