From dcaa1f9722a76d516311f24ecff04c8f7015a4aa Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 19 Apr 2021 01:28:56 +0900 Subject: [PATCH] internal/uidriver/glfw: Bug fix: Need to reregister the callback after recreating the window Updates #1588 Closes #1593 --- internal/uidriver/glfw/ui.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index e7660070f..f2cb0d485 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -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())