From 1db7bed2a7378f7d6b6a944c15df94cb57ee26b8 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 17 Oct 2020 02:57:03 +0900 Subject: [PATCH] uidriver/glfw: Refactoring --- internal/uidriver/glfw/ui.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index 598593cae..25fbf492e 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -854,14 +854,11 @@ func (u *UserInterface) update() error { _ = u.t.Call(func() error { 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() // Wait for an arbitrary period to avoid busy loop. time.Sleep(time.Second / 60) glfw.PollEvents() - if u.window.ShouldClose() { - return nil - } } return nil })