diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index 3d192b408..aa814c13d 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -180,9 +180,9 @@ func cacheMonitors() { // returns false if monitor is not found. // // getCachedMonitor must be called on the main thread. -func getCachedMonitor(wx, wy int) (*cachedMonitor, bool) { +func getCachedMonitor(glfwMonitor *glfw.Monitor) (*cachedMonitor, bool) { for _, m := range monitors { - if m.x <= wx && wx < m.x+m.vm.Width && m.y <= wy && wy < m.y+m.vm.Height { + if m.m == glfwMonitor { return m, true } } @@ -537,7 +537,7 @@ func (u *UserInterface) DeviceScaleFactor() float64 { // deviceScaleFactor must be called from the main thread. func (u *UserInterface) deviceScaleFactor() float64 { // Avoid calling monitor.GetPos if we have the monitor position cached already. - if cm, ok := getCachedMonitor(u.window.GetPos()); ok { + if cm, ok := getCachedMonitor(u.window.GetMonitor()); ok { return devicescale.GetAt(cm.x, cm.y) } // TODO: When is this reached?