ui: Bug fix: devicescale.GetAt must be called on the main thread

This commit is contained in:
Hajime Hoshi 2019-03-12 00:28:37 +09:00
parent 2d2d022b3d
commit a3882dbc37

View File

@ -427,21 +427,25 @@ func ScreenPadding() (x0, y0, x1, y1 float64) {
return ox, 0, ox, 0 return ox, 0, ox, 0
} }
m := u.window.GetMonitor() d := 0.0
d := devicescale.GetAt(m.GetPos())
v := m.GetVideoMode()
sx := 0.0 sx := 0.0
sy := 0.0 sy := 0.0
gs := 0.0 gs := 0.0
vw := 0.0
vh := 0.0
_ = mainthread.Run(func() error { _ = mainthread.Run(func() error {
m := u.window.GetMonitor()
d = devicescale.GetAt(m.GetPos())
sx = float64(u.width) * u.actualScreenScale() sx = float64(u.width) * u.actualScreenScale()
sy = float64(u.height) * u.actualScreenScale() sy = float64(u.height) * u.actualScreenScale()
gs = glfwScale() gs = glfwScale()
v := m.GetVideoMode()
vw, vh = float64(v.Width), float64(v.Height)
return nil return nil
}) })
mx := float64(v.Width) * d / gs mx := vw * d / gs
my := float64(v.Height) * d / gs my := vh * d / gs
ox := (mx - sx) / 2 ox := (mx - sx) / 2
oy := (my - sy) / 2 oy := (my - sy) / 2