uidriver/glfw: Refactoring

This commit is contained in:
Hajime Hoshi 2020-10-17 02:57:03 +09:00
parent d2c4a6fc9f
commit 1db7bed2a7

View File

@ -854,14 +854,11 @@ func (u *UserInterface) update() error {
_ = u.t.Call(func() error { _ = u.t.Call(func() error {
defer hooks.ResumeAudio() defer hooks.ResumeAudio()
for !u.isRunnableOnUnfocused() && u.window.GetAttrib(glfw.Focused) == 0 { for !u.isRunnableOnUnfocused() && u.window.GetAttrib(glfw.Focused) == 0 && !u.window.ShouldClose() {
hooks.SuspendAudio() hooks.SuspendAudio()
// Wait for an arbitrary period to avoid busy loop. // Wait for an arbitrary period to avoid busy loop.
time.Sleep(time.Second / 60) time.Sleep(time.Second / 60)
glfw.PollEvents() glfw.PollEvents()
if u.window.ShouldClose() {
return nil
}
} }
return nil return nil
}) })