internal/uidriver/glfw: Bug fix: Need to reregister the callback after recreating the window

Updates #1588
Closes #1593
This commit is contained in:
Hajime Hoshi 2021-04-19 01:28:56 +09:00
parent 73f90f324f
commit dcaa1f9722

View File

@ -705,12 +705,13 @@ func (u *UserInterface) createWindow() error {
u.window.SetTitle(u.title)
// TODO: Set icons
u.registerWindowSetSizeCallback()
return nil
}
// registerWindowSetSizeCallback must be called from the main thread.
func (u *UserInterface) registerWindowSetSizeCallback() {
u.setSizeCallbackEnabled = true
u.window.SetSizeCallback(func(_ *glfw.Window, width, height int) {
if !u.setSizeCallbackEnabled {
return
@ -802,7 +803,7 @@ func (u *UserInterface) init() error {
if err := u.createWindow(); err != nil {
return err
}
u.registerWindowSetSizeCallback()
u.setSizeCallbackEnabled = true
setPosition := func() {
u.iwindow.setPosition(u.getInitWindowPosition())