mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Merge pull request #5295 from dignow/fix/separate_window_pos
Fix/separate windows pos
This commit is contained in:
@@ -1424,17 +1424,18 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
|
||||
k: kWindowPrefix + type.name, v: pos.toString());
|
||||
|
||||
if (type == WindowType.RemoteDesktop && windowId != null) {
|
||||
await _saveSessionWindowPosition(windowId, pos);
|
||||
await _saveSessionWindowPosition(type, windowId, pos);
|
||||
}
|
||||
}
|
||||
|
||||
Future _saveSessionWindowPosition(int windowId, LastWindowPosition pos) async {
|
||||
Future _saveSessionWindowPosition(
|
||||
WindowType windowType, int windowId, LastWindowPosition pos) async {
|
||||
final remoteList = await DesktopMultiWindow.invokeMethod(
|
||||
windowId, kWindowEventGetRemoteList, null);
|
||||
if (remoteList != null) {
|
||||
for (final peerId in remoteList.split(',')) {
|
||||
bind.sessionSetFlutterConfigByPeerId(
|
||||
id: peerId, k: kWindowPrefix, v: pos.toString());
|
||||
id: peerId, k: kWindowPrefix + windowType.name, v: pos.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1542,8 +1543,13 @@ Future<bool> restoreWindowPosition(WindowType type,
|
||||
bool isRemotePeerPos = false;
|
||||
String? pos;
|
||||
if (type == WindowType.RemoteDesktop && windowId != null && peerId != null) {
|
||||
pos = await bind.sessionGetFlutterConfigByPeerId(
|
||||
id: peerId, k: kWindowPrefix);
|
||||
if (desktopType == DesktopType.main) {
|
||||
pos = bind.mainGetPeerFlutterConfigSync(
|
||||
id: peerId, k: kWindowPrefix + type.name);
|
||||
} else {
|
||||
pos = await bind.sessionGetFlutterConfigByPeerId(
|
||||
id: peerId, k: kWindowPrefix + type.name);
|
||||
}
|
||||
isRemotePeerPos = pos != null;
|
||||
}
|
||||
pos ??= bind.getLocalFlutterConfig(k: kWindowPrefix + type.name);
|
||||
|
||||
@@ -99,6 +99,8 @@ class RustDeskMultiWindowManager {
|
||||
for (final windowId in windows) {
|
||||
if (_inactiveWindows.contains(windowId)) {
|
||||
await DesktopMultiWindow.invokeMethod(windowId, methodName, msg);
|
||||
await restoreWindowPosition(type,
|
||||
windowId: windowId, peerId: remoteId);
|
||||
WindowController.fromWindowId(windowId).show();
|
||||
registerActiveWindow(windowId);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user