aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-10-31 11:35:09 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-11-28 16:11:45 +0100
commitb4e4933852d5c9673feae24e52e0927b09226027 (patch)
tree142ff78761166dfbddb4d4c702ada12d637af3ed
parentAdd HDHITTESTINFO (diff)
downloadwireguard-windows-pkg/walk-win.tar.xz
wireguard-windows-pkg/walk-win.zip
user32: do more faithful emulation of GetSystemMetricsForDpi for Win<10 on HiDPIpkg/walk-win
-rw-r--r--user32.go3
1 files changed, 2 insertions, 1 deletions
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,