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 3c71eba446
commit 9890dc51da

View File

@ -831,6 +831,17 @@ func (u *UserInterface) update() error {
u.setInitFullscreen(false) 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. // This call is needed for initialization.
u.updateSize() u.updateSize()
@ -1046,13 +1057,6 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
u.windowWidth = width u.windowWidth = width
u.windowHeight = height 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 u.toChangeSize = true
return nil return nil
}) })