internal/ui: forbide RestoreWindow when the window size limits are specified

Closes #2259
This commit is contained in:
Hajime Hoshi 2022-08-20 22:35:57 +09:00
parent 31141d5112
commit 833473316f
2 changed files with 9 additions and 2 deletions

View File

@ -289,6 +289,11 @@ func (u *userInterfaceImpl) setWindowSizeLimitsInDIP(minw, minh, maxw, maxh int)
return true
}
func (u *userInterfaceImpl) areWindowSizeLimitsSpecified() bool {
minw, minh, maxw, maxh := u.getWindowSizeLimitsInDIP()
return minw != glfw.DontCare || minh != glfw.DontCare || maxw != glfw.DontCare || maxh != glfw.DontCare
}
func (u *userInterfaceImpl) isInitFullscreen() bool {
u.m.RLock()
v := u.initFullscreen

View File

@ -119,8 +119,7 @@ func (w *glfwWindow) Maximize() {
return
}
minw, minh, maxw, maxh := w.ui.getWindowSizeLimitsInDIP()
if minw != glfw.DontCare || minh != glfw.DontCare || maxw != glfw.DontCare || maxh != glfw.DontCare {
if w.ui.areWindowSizeLimitsSpecified() {
return
}
@ -151,6 +150,9 @@ func (w *glfwWindow) Minimize() {
}
func (w *glfwWindow) Restore() {
if w.ui.areWindowSizeLimitsSpecified() {
return
}
if !w.ui.isRunning() {
// Do nothing
return