internal/ui: bug fix: wrong for-loop condition

Closes #2847
This commit is contained in:
Hajime Hoshi 2023-11-18 20:01:19 +09:00
parent 058973adda
commit acd317bf91

View File

@ -1358,20 +1358,32 @@ func (u *UserInterface) update() (float64, float64, error) {
} }
} }
// In the initial state on macOS, the window is not shown (#2620). for !u.isRunnableOnUnfocused() {
visible, err := u.window.GetAttrib(glfw.Visible) // In the initial state on macOS, the window is not shown (#2620).
if err != nil { visible, err := u.window.GetAttrib(glfw.Visible)
return 0, 0, err if err != nil {
} return 0, 0, err
focused, err := u.window.GetAttrib(glfw.Focused) }
if err != nil { if visible == glfw.False {
return 0, 0, err break
} }
shouldClose, err := u.window.ShouldClose()
if err != nil { focused, err := u.window.GetAttrib(glfw.Focused)
return 0, 0, err if err != nil {
} return 0, 0, err
for visible != 0 && !u.isRunnableOnUnfocused() && focused == 0 && !shouldClose { }
if focused != glfw.False {
break
}
shouldClose, err := u.window.ShouldClose()
if err != nil {
return 0, 0, err
}
if shouldClose {
break
}
if err := hook.SuspendAudio(); err != nil { if err := hook.SuspendAudio(); err != nil {
return 0, 0, err return 0, 0, err
} }
@ -1381,6 +1393,7 @@ func (u *UserInterface) update() (float64, float64, error) {
return 0, 0, err return 0, 0, err
} }
} }
if err := hook.ResumeAudio(); err != nil { if err := hook.ResumeAudio(); err != nil {
return 0, 0, err return 0, 0, err
} }