opt close on taskbar, not call onWindowClose multi times
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
017c73132c
commit
0d01aa4eea
@ -583,32 +583,19 @@ class WindowActionPanelState extends State<WindowActionPanel>
|
|||||||
void onWindowClose() async {
|
void onWindowClose() async {
|
||||||
mainWindowClose() async => await windowManager.hide();
|
mainWindowClose() async => await windowManager.hide();
|
||||||
notMainWindowClose(WindowController controller) async {
|
notMainWindowClose(WindowController controller) async {
|
||||||
if (widget.tabController.length == 0) {
|
if (widget.tabController.length != 0) {
|
||||||
debugPrint("close emtpy multiwindow, hide");
|
|
||||||
await controller.hide();
|
|
||||||
await rustDeskWinManager
|
|
||||||
.call(WindowType.Main, kWindowEventHide, {"id": kWindowId!});
|
|
||||||
} else {
|
|
||||||
debugPrint("close not emtpy multiwindow from taskbar");
|
debugPrint("close not emtpy multiwindow from taskbar");
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
await controller.show();
|
await controller.show();
|
||||||
await controller.focus();
|
await controller.focus();
|
||||||
final res = await widget.onClose?.call() ?? true;
|
final res = await widget.onClose?.call() ?? true;
|
||||||
if (res) {
|
if (!res) return;
|
||||||
Future.delayed(Duration.zero, () async {
|
|
||||||
// onWindowClose will be called again to hide
|
|
||||||
await WindowController.fromWindowId(kWindowId!).close();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// ubuntu22.04 windowOnTop not work from taskbar
|
|
||||||
widget.tabController.clear();
|
widget.tabController.clear();
|
||||||
Future.delayed(Duration.zero, () async {
|
|
||||||
// onWindowClose will be called again to hide
|
|
||||||
await WindowController.fromWindowId(kWindowId!).close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
await controller.hide();
|
||||||
|
await rustDeskWinManager
|
||||||
|
.call(WindowType.Main, kWindowEventHide, {"id": kWindowId!});
|
||||||
}
|
}
|
||||||
|
|
||||||
macOSWindowClose(
|
macOSWindowClose(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user