Skip to content

Commit

Permalink
Don't use pixel ratio for DS resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Feb 3, 2025
1 parent d3205fb commit 5b3b7ec
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
},
onResizeToDSChanged: (value) async {
setState(() {
if (value && widget.ntConnection.dsClient.driverStationDocked) {
if (value && true) {
_onDriverStationDocked();
} else {
_onDriverStationUndocked();
Expand Down Expand Up @@ -1712,15 +1712,11 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {

void _onDriverStationDocked() async {
Display primaryDisplay = await screenRetriever.getPrimaryDisplay();
double pixelRatio = primaryDisplay.scaleFactor?.toDouble() ?? 1.0;
Size screenSize =
(primaryDisplay.visibleSize ?? primaryDisplay.size) * pixelRatio;
Size screenSize = primaryDisplay.visibleSize ?? primaryDisplay.size;

await windowManager.unmaximize();

Size newScreenSize =
Size(screenSize.width, (screenSize.height) - (200 * pixelRatio)) /
pixelRatio;
Size newScreenSize = Size(screenSize.width, screenSize.height - 200);

await windowManager.setSize(newScreenSize);

Expand All @@ -1739,8 +1735,10 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
await windowManager.setResizable(true);

// Re-adds the window frame, window manager's API for this is weird
await windowManager.setTitleBarStyle(TitleBarStyle.hidden,
windowButtonVisibility: false);
await windowManager.setTitleBarStyle(
TitleBarStyle.hidden,
windowButtonVisibility: false,
);
}

void _showWindowCloseConfirmation(BuildContext context) {
Expand Down

0 comments on commit 5b3b7ec

Please sign in to comment.