mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 11:35:56 +00:00
refact: active terminal on conn the same remote (#12392)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -177,6 +177,18 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
|||||||
tabController.clear();
|
tabController.clear();
|
||||||
} else if (call.method == kWindowActionRebuild) {
|
} else if (call.method == kWindowActionRebuild) {
|
||||||
reloadCurrentWindow();
|
reloadCurrentWindow();
|
||||||
|
} else if (call.method == kWindowEventActiveSession) {
|
||||||
|
if (tabController.state.value.tabs.isEmpty) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final currentTab = tabController.state.value.selectedTabInfo;
|
||||||
|
assert(call.arguments is String,
|
||||||
|
"Expected String arguments for kWindowEventActiveSession, got ${call.arguments.runtimeType}");
|
||||||
|
if (currentTab.key.startsWith(call.arguments)) {
|
||||||
|
windowOnTop(windowId());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Future.delayed(Duration.zero, () {
|
Future.delayed(Duration.zero, () {
|
||||||
|
|||||||
@@ -354,6 +354,16 @@ class RustDeskMultiWindowManager {
|
|||||||
bool? forceRelay,
|
bool? forceRelay,
|
||||||
String? connToken,
|
String? connToken,
|
||||||
}) async {
|
}) async {
|
||||||
|
// Iterate through terminal windows in reverse order to prioritize
|
||||||
|
// the most recently added or used windows, as they are more likely
|
||||||
|
// to have an active session.
|
||||||
|
for (final windowId in _terminalWindows.reversed) {
|
||||||
|
if (await DesktopMultiWindow.invokeMethod(
|
||||||
|
windowId, kWindowEventActiveSession, remoteId)) {
|
||||||
|
return MultiWindowCallResult(windowId, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Terminal windows should always create new windows, not reuse
|
// Terminal windows should always create new windows, not reuse
|
||||||
// This avoids the MissingPluginException when trying to invoke
|
// This avoids the MissingPluginException when trying to invoke
|
||||||
// new_terminal on an inactive window
|
// new_terminal on an inactive window
|
||||||
|
|||||||
Reference in New Issue
Block a user