mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
internal/uidriver/glfw: Call fromGLFWPixels from the main thread
fromGLFWPixels can invoke driverScaleFactor, and then using the main thread is safer.
This commit is contained in:
parent
b6364c46fe
commit
e2ceb7b3a6
@ -207,8 +207,12 @@ func (w *window) Size() (int, int) {
|
||||
ww, wh := w.ui.getInitWindowSize()
|
||||
return w.ui.adjustWindowSizeBasedOnSizeLimitsInDP(ww, wh)
|
||||
}
|
||||
ww := int(w.ui.fromGLFWPixel(float64(w.ui.windowWidth)))
|
||||
wh := int(w.ui.fromGLFWPixel(float64(w.ui.windowHeight)))
|
||||
ww, wh := 0, 0
|
||||
_ = w.ui.t.Call(func() error {
|
||||
ww = int(w.ui.fromGLFWPixel(float64(w.ui.windowWidth)))
|
||||
wh = int(w.ui.fromGLFWPixel(float64(w.ui.windowHeight)))
|
||||
return nil
|
||||
})
|
||||
return ww, wh
|
||||
}
|
||||
|
||||
@ -217,9 +221,9 @@ func (w *window) SetSize(width, height int) {
|
||||
w.ui.setInitWindowSize(width, height)
|
||||
return
|
||||
}
|
||||
ww := int(w.ui.toGLFWPixel(float64(width)))
|
||||
wh := int(w.ui.toGLFWPixel(float64(height)))
|
||||
_ = w.ui.t.Call(func() error {
|
||||
ww := int(w.ui.toGLFWPixel(float64(width)))
|
||||
wh := int(w.ui.toGLFWPixel(float64(height)))
|
||||
w.ui.setWindowSize(ww, wh, w.ui.isFullscreen())
|
||||
return nil
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user