internal/uidriver/glfw: Bug fix: Delay to enable SetSize callback

On Linux, the SetSize callback is invoked with an unexpected value
at the initial phase. Just delay it until the initialization
finishes.
This commit is contained in:
Hajime Hoshi 2021-04-20 22:53:15 +09:00
parent 34be0371be
commit fbe6961528

View File

@ -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
}