uidriver/glfw: Bug fix: Need to call updateVsync after setWindowSize

Fixes #1363
This commit is contained in:
Hajime Hoshi 2020-09-22 18:40:52 +09:00
parent 9a3a72e0ec
commit 1ead096f67

View File

@ -811,6 +811,17 @@ func (u *UserInterface) update(context driver.UIContext) error {
u.setInitFullscreen(false)
}
// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
// Calling this inside setWindowSize didn't work (#1363).
_ = u.t.Call(func() error {
if !u.vsyncInited {
u.vsync = u.isInitVsyncEnabled()
u.updateVsync()
u.vsyncInited = true
}
return nil
})
// This call is needed for initialization.
u.updateSize(context)
@ -1026,13 +1037,6 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
u.windowWidth = width
u.windowHeight = height
if !u.vsyncInited {
// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
u.vsync = u.isInitVsyncEnabled()
u.updateVsync()
u.vsyncInited = true
}
u.toChangeSize = true
return nil
})