From e93bcd9e557e5176e3281b06cb83f53193864b37 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 13 Mar 2023 21:40:25 +0900 Subject: [PATCH] internal/ui: bug fix: needed to wait for swapping buffers before entering fullscreen Closes #2599 --- internal/ui/ui_glfw.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 2fcc7556c..20e6f120a 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -92,6 +92,8 @@ type userInterfaceImpl struct { initWindowFloating bool initWindowMaximized bool + bufferOnceSwapped bool + origWindowPosX int origWindowPosY int origWindowWidthInDIP int @@ -974,7 +976,8 @@ func (u *userInterfaceImpl) update() (float64, float64, error) { return 0, 0, RegularTermination } - if u.isInitFullscreen() { + // On macOS, one swapping buffers seems required before entering fullscreen (#2599). + if u.isInitFullscreen() && (u.bufferOnceSwapped || runtime.GOOS != "darwin") { u.setFullscreen(true) u.setInitFullscreen(false) } @@ -1067,6 +1070,8 @@ func (u *userInterfaceImpl) updateGame() error { // This works only for OpenGL. u.swapBuffersOnRenderThread() + + u.bufferOnceSwapped = true }) if unfocused {