internal/ui: bug fix: do not set the minimum window width for macOS

Shrinking a window size by a cursor sometimes makes a smaller window
than 126px. To avoid such flaky behavior, do not set the limitation of
the minimum window width.

On Linux/UNIX, there should not be reasons to limit the window width.

Updates #165
This commit is contained in:
Hajime Hoshi 2022-02-09 23:29:00 +09:00
parent ad675640b1
commit edca32e520

View File

@ -1252,16 +1252,22 @@ func (u *UserInterface) setWindowSizeInDIP(width, height int, fullscreen bool) {
}
func (u *UserInterface) minimumWindowWidth() int {
// On Windows, giving a too small width doesn't call a callback (#165).
// To prevent hanging up, return asap if the width is too small.
if u.window.GetAttrib(glfw.Decorated) == glfw.False {
return 1
}
// On Windows, giving a too small width doesn't call a callback (#165).
// To prevent hanging up, return asap if the width is too small.
// 126 is an arbitrary number and I guess this is small enough .
if runtime.GOOS == "windows" {
return 126
}
// On macOS, resizing the window by cursor sometimes ignores the minimum size.
// To avoid the flaky behavior, do not add a limitation.
return 1
}
func (u *UserInterface) setWindowSizeInDIPImpl(width, height int, fullscreen bool) {
if fullscreen {
if x, y := u.origPos(); x == invalidPos || y == invalidPos {