mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +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()
|
ww, wh := w.ui.getInitWindowSize()
|
||||||
return w.ui.adjustWindowSizeBasedOnSizeLimitsInDP(ww, wh)
|
return w.ui.adjustWindowSizeBasedOnSizeLimitsInDP(ww, wh)
|
||||||
}
|
}
|
||||||
ww := int(w.ui.fromGLFWPixel(float64(w.ui.windowWidth)))
|
ww, wh := 0, 0
|
||||||
wh := int(w.ui.fromGLFWPixel(float64(w.ui.windowHeight)))
|
_ = 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
|
return ww, wh
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,9 +221,9 @@ func (w *window) SetSize(width, height int) {
|
|||||||
w.ui.setInitWindowSize(width, height)
|
w.ui.setInitWindowSize(width, height)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ww := int(w.ui.toGLFWPixel(float64(width)))
|
|
||||||
wh := int(w.ui.toGLFWPixel(float64(height)))
|
|
||||||
_ = w.ui.t.Call(func() error {
|
_ = 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())
|
w.ui.setWindowSize(ww, wh, w.ui.isFullscreen())
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user