uidriver/glfw: Bug fix: Show the window at last on initialization

This commit is contained in:
Hajime Hoshi 2019-12-08 23:00:10 +09:00
parent e00a190f22
commit 3e89e7e561

View File

@ -671,8 +671,6 @@ func (u *UserInterface) createWindow() error {
u.reqHeight = h u.reqHeight = h
}) })
u.window.Show()
return nil return nil
} }
@ -766,6 +764,7 @@ func (u *UserInterface) run(width, height int, scale float64, title string, cont
x, y = adjustWindowPosition(x, y) x, y = adjustWindowPosition(x, y)
} }
u.window.SetPos(x, y) u.window.SetPos(x, y)
u.window.Show()
return nil return nil
}) })
@ -1018,13 +1017,13 @@ func (u *UserInterface) setScreenSize(width, height int, scale float64, fullscre
// TODO: This should return an error. // TODO: This should return an error.
panic(fmt.Sprintf("glfw: failed to recreate window: %v", err)) panic(fmt.Sprintf("glfw: failed to recreate window: %v", err))
} }
u.window.Show()
windowRecreated = true windowRecreated = true
} }
} }
oldW, oldH := u.window.GetSize() oldW, oldH := u.window.GetSize()
newW, newH := u.deviceDependentWindowSize() if newW, newH := u.deviceDependentWindowSize(); oldW != newW || oldH != newH {
if oldW != newW || oldH != newH {
ch := make(chan struct{}) ch := make(chan struct{})
u.window.SetFramebufferSizeCallback(func(_ *glfw.Window, _, _ int) { u.window.SetFramebufferSizeCallback(func(_ *glfw.Window, _, _ int) {
u.window.SetFramebufferSizeCallback(nil) u.window.SetFramebufferSizeCallback(nil)