tmp commit
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
e4ac34da0d
commit
e12d0ef4aa
@ -45,10 +45,9 @@ class RustDeskMultiWindowManager {
|
||||
|
||||
separateWindows() async {
|
||||
for (final windowId in _remoteDesktopWindows) {
|
||||
final sessionIdList = await DesktopMultiWindow.invokeMethod(
|
||||
final String sessionIdList = await DesktopMultiWindow.invokeMethod(
|
||||
windowId, kWindowEventGetSessionIdList, null);
|
||||
if (sessionIdList != null) {
|
||||
final idList = sessionIdList.split(';') as List<String>;
|
||||
final idList = sessionIdList.split(';');
|
||||
if (idList.length <= 1) {
|
||||
continue;
|
||||
}
|
||||
@ -59,14 +58,19 @@ class RustDeskMultiWindowManager {
|
||||
'id': peerSession[0],
|
||||
'sessionId': peerSession[1],
|
||||
};
|
||||
await newSessionWindow(WindowType.RemoteDesktop, peerSession[0],
|
||||
jsonEncode(params), _remoteDesktopWindows);
|
||||
await _newSession(
|
||||
true,
|
||||
WindowType.RemoteDesktop,
|
||||
kWindowEventNewRemoteDesktop,
|
||||
peerSession[0],
|
||||
_remoteDesktopWindows,
|
||||
jsonEncode(params),
|
||||
);
|
||||
await DesktopMultiWindow.invokeMethod(
|
||||
windowId, kWindowEventCloseForSeparateWindow, peerSession[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newSessionWindow(
|
||||
WindowType type, String remoteId, String msg, List<int> windows) async {
|
||||
@ -87,6 +91,36 @@ class RustDeskMultiWindowManager {
|
||||
windows.add(windowController.windowId);
|
||||
}
|
||||
|
||||
_newSession(
|
||||
bool separateWindow,
|
||||
WindowType type,
|
||||
String methodName,
|
||||
String remoteId,
|
||||
List<int> windows,
|
||||
String msg,
|
||||
) async {
|
||||
if (separateWindow) {
|
||||
if (kCloseMultiWindowByHide && _inactiveWindows.isNotEmpty) {
|
||||
final windowId = _inactiveWindows.first;
|
||||
final invokeRes =
|
||||
await DesktopMultiWindow.invokeMethod(windowId, methodName, msg);
|
||||
final windowController = WindowController.fromWindowId(windowId);
|
||||
windowController.show();
|
||||
registerActiveWindow(windowController.windowId);
|
||||
windows.add(windowController.windowId);
|
||||
return invokeRes;
|
||||
} else {
|
||||
await newSessionWindow(type, remoteId, msg, windows);
|
||||
}
|
||||
} else {
|
||||
if (windows.isEmpty) {
|
||||
await newSessionWindow(type, remoteId, msg, windows);
|
||||
} else {
|
||||
return call(type, methodName, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> newSession(
|
||||
WindowType type,
|
||||
String methodName,
|
||||
@ -126,26 +160,7 @@ class RustDeskMultiWindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (separateWindow) {
|
||||
if (kCloseMultiWindowByHide && _inactiveWindows.isNotEmpty) {
|
||||
final windowId = _inactiveWindows.first;
|
||||
final invokeRes =
|
||||
await DesktopMultiWindow.invokeMethod(windowId, methodName, msg);
|
||||
final windowController = WindowController.fromWindowId(windowId);
|
||||
windowController.show();
|
||||
registerActiveWindow(windowController.windowId);
|
||||
windows.add(windowController.windowId);
|
||||
return invokeRes;
|
||||
} else {
|
||||
await newSessionWindow(type, remoteId, msg, windows);
|
||||
}
|
||||
} else {
|
||||
if (windows.isEmpty) {
|
||||
await newSessionWindow(type, remoteId, msg, windows);
|
||||
} else {
|
||||
return call(type, methodName, msg);
|
||||
}
|
||||
}
|
||||
await _newSession(separateWindow, type, methodName, remoteId, windows, msg);
|
||||
}
|
||||
|
||||
Future<dynamic> newRemoteDesktop(
|
||||
|
Loading…
x
Reference in New Issue
Block a user