diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 35634c026..389cd6fa7 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -1319,6 +1319,9 @@ func (u *userInterfaceImpl) updateWindowSizeLimits() { maxh = int(u.dipToGLFWPixel(float64(maxh), m)) } u.window.SetSizeLimits(minw, minh, maxw, maxh) + + // The window size limit affects the resizing mode, especially on macOS (#). + u.setWindowResizingModeForOS(u.windowResizingMode) } // adjustWindowSizeBasedOnSizeLimitsInDIP adjust the size based on the window size limits. diff --git a/internal/ui/ui_glfw_darwin.go b/internal/ui/ui_glfw_darwin.go index 57ded86b0..e90d8e117 100644 --- a/internal/ui/ui_glfw_darwin.go +++ b/internal/ui/ui_glfw_darwin.go @@ -348,11 +348,22 @@ func (u *userInterfaceImpl) adjustViewSizeAfterFullscreen() { window.SetBackgroundColor(cocoa.NSColor_colorWithSRGBRedGreenBlueAlpha(0, 0, 0, 0)) } +func (u *userInterfaceImpl) isFullscreenAllowedFromUI(mode WindowResizingMode) bool { + if u.maxWindowWidthInDIP != glfw.DontCare || u.maxWindowHeightInDIP != glfw.DontCare { + return false + } + if mode == WindowResizingModeOnlyFullscreenEnabled { + return true + } + if mode == WindowResizingModeEnabled { + return true + } + return false +} + func (u *userInterfaceImpl) setWindowResizingModeForOS(mode WindowResizingMode) { - allowFullscreen := mode == WindowResizingModeOnlyFullscreenEnabled || - mode == WindowResizingModeEnabled var collectionBehavior uint - if allowFullscreen { + if u.isFullscreenAllowedFromUI(mode) { collectionBehavior |= cocoa.NSWindowCollectionBehaviorManaged collectionBehavior |= cocoa.NSWindowCollectionBehaviorFullScreenPrimary } else {