From edca32e520a1a48969ce9c88d30f4630a901ac33 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 9 Feb 2022 23:29:00 +0900 Subject: [PATCH] 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 --- internal/ui/ui_glfw.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index d39a4a20e..3d098b1eb 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -1252,14 +1252,20 @@ 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 } - // 126 is an arbitrary number and I guess this is small enough. - return 126 + // 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) {