diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index 2a1f5fa6c..fa73b3d2e 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -814,7 +814,6 @@ func (u *UserInterface) init() error { if err := u.createWindow(); err != nil { return err } - u.setSizeCallbackEnabled = true setSize := func() { ww, wh := u.getInitWindowSize() @@ -849,6 +848,10 @@ func (u *UserInterface) init() error { g.SetWindow(u.nativeWindow()) } + // Enable the SetSize callback after all the initialization finishes. Or, unexpected the callback + // is fired unexpectedly at the initial phase with a very small size on Linux. + u.setSizeCallbackEnabled = true + return nil }