internal/ui: bug fix: make the window resizable after the window is created

Making the window resizable BEFORE the window is created doesn't
work correctly, especially when switching to enable resizing later.

Closes #1987
This commit is contained in:
Hajime Hoshi 2022-02-10 00:53:18 +09:00
parent 5899470511
commit 0291986658

View File

@ -885,11 +885,9 @@ func (u *UserInterface) init() error {
glfw.WindowHint(glfw.TransparentFramebuffer, transparent)
Graphics().SetTransparent(u.isInitScreenTransparent())
resizable := glfw.False
if u.isInitWindowResizable() {
resizable = glfw.True
}
glfw.WindowHint(glfw.Resizable, resizable)
// Before creating a window, set it unresizable no matter what u.isInitWindowResizable() is (#1987).
// Making the window resizable here doesn't work correctly when switching to enable resizing.
glfw.WindowHint(glfw.Resizable, glfw.False)
floating := glfw.False
if u.isInitWindowFloating() {
@ -924,6 +922,8 @@ func (u *UserInterface) init() error {
u.setWindowPositionInDIP(wx, wy, u.initMonitor)
u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
u.setWindowResizable(u.isInitWindowResizable())
// Maximizing a window requires a proper size and position. Call Maximize here (#1117).
if u.isInitWindowMaximized() {
u.window.Maximize()