From f80f73d502062cf3127596356be6559c6fa95fee Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 20 Aug 2022 19:10:40 +0900 Subject: [PATCH] internal/ui: bug fix: do not register a framebuffer-size callback on macOS When a decorating state is switched, a framebuffer-size callback was invoked but with wrong parameters on macOS. This callback was originally implemented for i3 window manager, and was not needed for macOS. Then, let's not use this on macOS. Probably we can also skip this registering on Windows. Updates #1960 Closes #2257 --- internal/ui/ui_glfw.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index a7b97bc86..d887dfc50 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -747,10 +747,13 @@ func (u *userInterfaceImpl) registerWindowCloseCallback() { // registerWindowFramebufferSizeCallback must be called from the main thread. func (u *userInterfaceImpl) registerWindowFramebufferSizeCallback() { - if u.defaultFramebufferSizeCallback == 0 { + if u.defaultFramebufferSizeCallback == 0 && runtime.GOOS != "darwin" { // When the window gets resized (either by manual window resize or a window // manager), glfw sends a framebuffer size callback which we need to handle (#1960). // This event is the only way to handle the size change at least on i3 window manager. + // + // When a decorating state changes, the callback of arguments might be an unexpected value on macOS (#2257) + // Then, do not register this callback on macOS. u.defaultFramebufferSizeCallback = glfw.ToFramebufferSizeCallback(func(_ *glfw.Window, w, h int) { if u.isFullscreen() { return