From b710ff17c8ed9cd72dc066528988ad3c75aedb3e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 15 Sep 2023 03:19:33 +0900 Subject: [PATCH] internal/ui: bug fix: wait for a while after exiting fullscreen on macOS Closes #2758 --- internal/ui/ui_glfw.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 600df71d9..570b94530 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -367,6 +367,14 @@ func (u *userInterfaceImpl) setWindowMonitor(monitor int) { // This is copied from setFullscreen. They should probably use a shared function. if fullscreen { u.setFullscreen(false) + // Just after exiting fullscreen, the window state seems very unstable (#2758). + // Wait for a while with polling events. + if runtime.GOOS == "darwin" { + for i := 0; i < 60; i++ { + glfw.PollEvents() + time.Sleep(time.Second / 60) + } + } } x, y := m.GetPos()