mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-26 07:38:55 +00:00
* fix(flutter): keep CM side panels on the current Windows monitor
Set the final physical position and size together when toggling CM chat or
file panels. This avoids an intermediate resize crossing into a monitor
with a different DPI before the position is applied.
Limit the change to the Windows CM path and add a positioning regression test.
* fix(flutter): fall back when the CM window screen is unavailable
getWindowInfo() could throw before the side-panel toggle reset its guard,
which locked the chat and file buttons and dropped the incoming message
that opened the panel. A failure now takes the previous setSizeAlignment
path, which also makes the existing no-screen fallback reachable.
The test now starts from the reported setup, the window at the right
edge of a 100% monitor, and checks that each toggle is a single
setBounds, since a resize followed by a move is what crossed monitors.
The 150% case keeps covering the scaled size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
* test(flutter): cover CM window info fallback
* Revert "test(flutter): cover CM window info fallback"
This reverts commit 9204e6a021.
---------
Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
897 B
Dart
30 lines
897 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:window_manager/window_manager.dart';
|
|
import 'package:window_size/window_size.dart' as window_size;
|
|
|
|
Future<void> setWindowsCmWindowBounds(Size size) async {
|
|
window_size.PlatformWindow? window;
|
|
try {
|
|
window = await window_size.getWindowInfo();
|
|
} catch (e) {
|
|
debugPrint('Failed to get the CM window screen: $e');
|
|
}
|
|
final screen = window?.screen;
|
|
if (window == null || screen == null) {
|
|
await windowManager.setSizeAlignment(size, Alignment.topRight);
|
|
return;
|
|
}
|
|
|
|
// Keep monitor coordinates and window dimensions in physical pixels.
|
|
final scaledSize = size * window.scaleFactor;
|
|
await windowManager.setBounds(
|
|
Rect.fromLTWH(
|
|
screen.visibleFrame.right - scaledSize.width,
|
|
screen.visibleFrame.top,
|
|
scaledSize.width,
|
|
scaledSize.height,
|
|
),
|
|
ignoreDevicePixelRatio: true,
|
|
);
|
|
}
|