mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
internal/uidriver/glfw: Clear the device scale cache when monitors are changed
This commit is contained in:
parent
f665abc8d4
commit
ec2f823420
@ -37,11 +37,20 @@ func GetAt(x, y int) float64 {
|
||||
}
|
||||
s := impl(x, y)
|
||||
cache[pos{x, y}] = s
|
||||
return s
|
||||
}
|
||||
|
||||
// TODO: Provide a way to invalidate the cache, or move the cache.
|
||||
// CelarCache clears the cache.
|
||||
// This should be called when monitors are changed by connecting or disconnecting.
|
||||
func ClearCache() {
|
||||
// TODO: This should be called not only when monitors are changed but also a monitor's scales are changed.
|
||||
// The device scale can vary even for the same monitor.
|
||||
// The only known case is when the application works on macOS, with OpenGL, with a wider screen mode,
|
||||
// and in the fullscreen mode (#1573).
|
||||
|
||||
return s
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
for k := range cache {
|
||||
delete(cache, k)
|
||||
}
|
||||
}
|
||||
|
@ -232,6 +232,7 @@ func updateMonitors() {
|
||||
})
|
||||
}
|
||||
clearVideoModeScaleCache()
|
||||
devicescale.ClearCache()
|
||||
}
|
||||
|
||||
func ensureMonitors() []*monitor {
|
||||
|
Loading…
Reference in New Issue
Block a user