diff --git a/internal/devicescale/devicescale.go b/internal/devicescale/devicescale.go index b353f88d9..f48554046 100644 --- a/internal/devicescale/devicescale.go +++ b/internal/devicescale/devicescale.go @@ -22,7 +22,7 @@ var ( m sync.Mutex ) -func DeviceScale() float64 { +func Get() float64 { m.Lock() defer m.Unlock() return impl() diff --git a/internal/ui/devicescale.go b/internal/ui/devicescale.go index 6e8efa96c..af61bc884 100644 --- a/internal/ui/devicescale.go +++ b/internal/ui/devicescale.go @@ -31,7 +31,7 @@ func (d *deviceScale) Update() { func (d *deviceScale) Get() float64 { // As devicescale.DeviceScale accesses OS API, not call this too often. if d.val == 0 || d.frame-d.lastUpdated > 30 { - d.val = devicescale.DeviceScale() + d.val = devicescale.Get() d.lastUpdated = d.frame } return d.val diff --git a/internal/ui/ui_mobile.go b/internal/ui/ui_mobile.go index 053eacc32..8eba0ad57 100644 --- a/internal/ui/ui_mobile.go +++ b/internal/ui/ui_mobile.go @@ -84,7 +84,7 @@ func deviceScale() float64 { defer deviceScaleM.Unlock() if deviceScaleVal == 0 { - deviceScaleVal = devicescale.DeviceScale() + deviceScaleVal = devicescale.Get() } return deviceScaleVal } diff --git a/internal/ui/ui_unix.go b/internal/ui/ui_unix.go index 8b0ae0006..40b163764 100644 --- a/internal/ui/ui_unix.go +++ b/internal/ui/ui_unix.go @@ -23,7 +23,7 @@ import ( ) func glfwScale() float64 { - return devicescale.DeviceScale() + return devicescale.Get() } func adjustWindowPosition(x, y int) (int, int) { diff --git a/run.go b/run.go index bc7be7c3c..51c557e66 100644 --- a/run.go +++ b/run.go @@ -528,7 +528,7 @@ func SetWindowIcon(iconImages []image.Image) { // // DeviceScaleFactor is concurrent-safe. func DeviceScaleFactor() float64 { - return devicescale.DeviceScale() + return devicescale.Get() } // IsVsyncEnabled returns a boolean value indicating whether