opt: add preventClose to handle close event manually

This commit is contained in:
Kingtous
2022-11-06 17:39:19 +08:00
parent ddeaf7fb92
commit 0b167493cc
5 changed files with 28 additions and 13 deletions

View File

@@ -498,6 +498,21 @@ class WindowActionPanelState extends State<WindowActionPanel>
super.onWindowUnmaximize();
}
@override
void onWindowClose() async {
// hide window on close
if (widget.isMainWindow) {
await windowManager.hide();
rustDeskWinManager.unregisterActiveWindow(0);
} else {
widget.onClose?.call();
WindowController.fromWindowId(windowId!).hide();
rustDeskWinManager
.call(WindowType.Main, kWindowEventHide, {"id": windowId!});
}
super.onWindowClose();
}
@override
Widget build(BuildContext context) {
return Row(