Skip to content

Commit

Permalink
internal/ui: a more robust fix for the unfocused-window loop
Browse files Browse the repository at this point in the history
Depending on the member variable bufferOnceSwapped is a little fragile.
Detect whether the window is shown or not instead.

Updates #2620
  • Loading branch information
hajimehoshi committed Mar 31, 2023
1 parent 2698c6f commit e41c2c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/ui/ui_glfw.go
Expand Up @@ -1019,7 +1019,8 @@ func (u *userInterfaceImpl) update() (float64, float64, error) {
return 0, 0, err
}

for u.bufferOnceSwapped && !u.isRunnableOnUnfocused() && u.window.GetAttrib(glfw.Focused) == 0 && !u.window.ShouldClose() {
// In the initial state on macOS, the window is not shown (#2620).
for u.window.GetAttrib(glfw.Visible) != 0 && !u.isRunnableOnUnfocused() && u.window.GetAttrib(glfw.Focused) == 0 && !u.window.ShouldClose() {
if err := hooks.SuspendAudio(); err != nil {
return 0, 0, err
}
Expand Down

0 comments on commit e41c2c7

Please sign in to comment.