fix: --connect command on macOS & window closing issues

This commit is contained in:
Kingtous
2023-02-03 17:08:40 +08:00
parent 1ad55d9914
commit 66851efaa3
9 changed files with 68 additions and 28 deletions

View File

@@ -160,6 +160,24 @@ class RustDeskMultiWindowManager {
return null;
}
void clearWindowType(WindowType type) {
switch (type) {
case WindowType.Main:
return;
case WindowType.RemoteDesktop:
_remoteDesktopWindowId = null;
break;
case WindowType.FileTransfer:
_fileTransferWindowId = null;
break;
case WindowType.PortForward:
_portForwardWindowId = null;
break;
case WindowType.Unknown:
break;
}
}
void setMethodHandler(
Future<dynamic> Function(MethodCall call, int fromWindowId)? handler) {
DesktopMultiWindow.setMethodHandler(handler);
@@ -186,8 +204,11 @@ class RustDeskMultiWindowManager {
}
await WindowController.fromWindowId(wId).setPreventClose(false);
await WindowController.fromWindowId(wId).close();
} on Error {
} catch (e) {
debugPrint("$e");
return;
} finally {
clearWindowType(type);
}
}
}