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

@@ -166,6 +166,7 @@ class RustDeskMultiWindowManager {
// no such window already
return;
}
await WindowController.fromWindowId(wId).setPreventClose(false);
await WindowController.fromWindowId(wId).close();
} on Error {
return;
@@ -206,6 +207,12 @@ class RustDeskMultiWindowManager {
}
/// Remove active window which has [`windowId`]
///
/// [Avaliability]
/// This function should only be called from main window.
/// For other windows, please post a unregister(hide) event to main window handler:
/// `rustDeskWinManager.call(WindowType.Main, kWindowEventHide, {"id": windowId!});`
void unregisterActiveWindow(int windowId) {
if (!_activeWindows.contains(windowId)) {
// ignore