internal/ui: bug fix: the window size callback was not called on macOS

This is basically a revert of e150745598.

As the window size callback was not called, ebiten.WindowSize didn't
work correctly for a while.

Even after this change, the issue #2257 could not be reproduced. This
is mysterious, but probably macOS itself has updated.

Updates #2257
Closes #3029
This commit is contained in:
Hajime Hoshi 2024-06-30 15:59:12 +09:00
parent ec9b0882ab
commit f4ceb961af

View File

@ -905,13 +905,10 @@ func (u *UserInterface) registerWindowCloseCallback() error {
// registerWindowFramebufferSizeCallback must be called from the main thread.
func (u *UserInterface) registerWindowFramebufferSizeCallback() error {
if u.defaultFramebufferSizeCallback == nil && runtime.GOOS != "darwin" {
if u.defaultFramebufferSizeCallback == nil {
// 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 = func(_ *glfw.Window, w, h int) {
f, err := u.isFullscreen()
if err != nil {