WINDOWS: Recompute default size based on scaling factor

This commit is contained in:
Elias Bonnici 2024-04-17 10:50:39 +02:00
parent d9b88b77de
commit cb3e491c32
No known key found for this signature in database
GPG Key ID: 5EAC28EA3F980CCF

View File

@ -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 =