From 4bd3f6efc977e529483a97e0a3b33737648d80d3 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 31 Oct 2019 11:35:09 +0100 Subject: [PATCH] user32: do more faithful emulation of GetSystemMetricsForDpi for Win<10 on HiDPI --- user32.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user32.go b/user32.go index 478813db..a20583e2 100644 --- a/user32.go +++ b/user32.go @@ -7,6 +7,7 @@ package win import ( + "math" "syscall" "unsafe" @@ -2648,7 +2649,7 @@ func GetSystemMetrics(nIndex int32) int32 { func GetSystemMetricsForDpi(nIndex int32, dpi uint32) int32 { if getSystemMetricsForDpi.Find() != nil { - return GetSystemMetrics(nIndex) + return int32(math.Round(float64(GetSystemMetrics(nIndex)) * float64(dpi) / float64(GetDpiForWindow(0)))) } ret, _, _ := syscall.Syscall(getSystemMetricsForDpi.Addr(), 2,