mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 19:45:09 +00:00
Enable Windows DPI awareness
This commit is contained in:
+8
-6
@@ -923,6 +923,12 @@ end;
|
||||
// Settings helpers
|
||||
// ===========================================================================
|
||||
|
||||
function CurrentScreenDPI: Integer;
|
||||
begin
|
||||
Result := Screen.PixelsPerInch;
|
||||
if Result <= 0 then Result := 96;
|
||||
end;
|
||||
|
||||
procedure TMainForm.RestoreWindowBounds;
|
||||
var
|
||||
L, T, Wd, Ht, SavedDPI, CurDPI: Integer;
|
||||
@@ -932,9 +938,7 @@ begin
|
||||
FSettings.LoadWindowBounds(L, T, Wd, Ht, SavedDPI);
|
||||
if (Wd > 400) and (Ht > 300) then
|
||||
begin
|
||||
CurDPI := PixelsPerInch;
|
||||
if CurDPI <= 0 then CurDPI := Screen.PixelsPerInch;
|
||||
if CurDPI <= 0 then CurDPI := 96;
|
||||
CurDPI := CurrentScreenDPI;
|
||||
if SavedDPI <= 0 then SavedDPI := CurDPI;
|
||||
|
||||
if SavedDPI <> CurDPI then
|
||||
@@ -977,9 +981,7 @@ begin
|
||||
end;
|
||||
|
||||
if (Wd <= 400) or (Ht <= 300) then Exit;
|
||||
DPI := PixelsPerInch;
|
||||
if DPI <= 0 then DPI := Screen.PixelsPerInch;
|
||||
if DPI <= 0 then DPI := 96;
|
||||
DPI := CurrentScreenDPI;
|
||||
FSettings.SaveWindowBounds(L, T, Wd, Ht, DPI);
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user