mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-06 19:41:28 +03:00
fix: last window location calculation
This commit is contained in:
@@ -96,8 +96,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
|
||||
void onRemoveId(String id) {
|
||||
if (tabController.state.value.tabs.isEmpty) {
|
||||
WindowController.fromWindowId(windowId()).hide();
|
||||
rustDeskWinManager.call(WindowType.Main, kWindowEventHide, {"id": windowId()});
|
||||
WindowController.fromWindowId(windowId()).close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +107,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
||||
|
||||
void onRemoveId(String id) {
|
||||
if (tabController.state.value.tabs.isEmpty) {
|
||||
WindowController.fromWindowId(windowId()).hide();
|
||||
rustDeskWinManager.call(WindowType.Main, kWindowEventHide, {"id": windowId()});
|
||||
WindowController.fromWindowId(windowId()).close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +97,6 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
}
|
||||
_update_remote_count();
|
||||
});
|
||||
Future.delayed(Duration.zero, () {
|
||||
restoreWindowPosition(WindowType.RemoteDesktop, windowId: windowId());
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -321,10 +318,9 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void onRemoveId(String id) {
|
||||
void onRemoveId(String id) async {
|
||||
if (tabController.state.value.tabs.isEmpty) {
|
||||
WindowController.fromWindowId(windowId()).hide();
|
||||
rustDeskWinManager.call(WindowType.Main, kWindowEventHide, {"id": windowId()});
|
||||
await WindowController.fromWindowId(windowId()).close();
|
||||
}
|
||||
ConnectionTypeState.delete(id);
|
||||
_update_remote_count();
|
||||
|
||||
@@ -500,15 +500,19 @@ class WindowActionPanelState extends State<WindowActionPanel>
|
||||
|
||||
@override
|
||||
void onWindowClose() async {
|
||||
print("onWindowClose");
|
||||
// hide window on close
|
||||
if (widget.isMainWindow) {
|
||||
await windowManager.hide();
|
||||
rustDeskWinManager.unregisterActiveWindow(0);
|
||||
} else {
|
||||
widget.onClose?.call();
|
||||
WindowController.fromWindowId(windowId!).hide();
|
||||
final frame = await WindowController.fromWindowId(windowId!).getFrame();
|
||||
await WindowController.fromWindowId(windowId!).hide();
|
||||
rustDeskWinManager
|
||||
.call(WindowType.Main, kWindowEventHide, {"id": windowId!});
|
||||
final frame2 = await WindowController.fromWindowId(windowId!).getFrame();
|
||||
print("${frame} ---hide--> ${frame2}");
|
||||
}
|
||||
super.onWindowClose();
|
||||
}
|
||||
@@ -555,12 +559,9 @@ class WindowActionPanelState extends State<WindowActionPanel>
|
||||
// note: the main window can be restored by tray icon
|
||||
Future.delayed(Duration.zero, () async {
|
||||
if (widget.isMainWindow) {
|
||||
await windowManager.hide();
|
||||
rustDeskWinManager.unregisterActiveWindow(0);
|
||||
await windowManager.close();
|
||||
} else {
|
||||
await WindowController.fromWindowId(windowId!).hide();
|
||||
rustDeskWinManager.call(
|
||||
WindowType.Main, kWindowEventHide, {"id": windowId!});
|
||||
await WindowController.fromWindowId(windowId!).close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user