diff --git a/lib/desktop/window_manager_helper/_wm_helper_windows_impl.dart b/lib/desktop/window_manager_helper/_wm_helper_windows_impl.dart index f7b316b8..df5e4bfa 100644 --- a/lib/desktop/window_manager_helper/_wm_helper_windows_impl.dart +++ b/lib/desktop/window_manager_helper/_wm_helper_windows_impl.dart @@ -58,14 +58,17 @@ class WindowManagerHelperWindows { final primaryDisplay = await screenRetriever.getPrimaryDisplay(); final primaryScaleFactor = primaryDisplay.scaleFactor?.toDouble() ?? 1.0; - final savedScaleFactor = prefs.getDouble(_keyPrimaryScaleFactor) ?? 1.0; + final savedScaleFactor = prefs.getDouble(_keyPrimaryScaleFactor); + final hasSavedScaleFactor = savedScaleFactor != null; - final savedBounds = Rect.fromLTWH( - bounds.left, - bounds.top, - bounds.width / savedScaleFactor * primaryScaleFactor, - bounds.height / savedScaleFactor * primaryScaleFactor, - ); + var height = hasSavedScaleFactor + ? bounds.height / savedScaleFactor * primaryScaleFactor + : bounds.height; + var width = hasSavedScaleFactor + ? bounds.width / savedScaleFactor * primaryScaleFactor + : bounds.width; + + final savedBounds = Rect.fromLTWH(bounds.left, bounds.top, width, height); final configChanged = await _displayConfigurationChanged(prefs); final windowRect =