diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index a3a569dc9..f8a4dd66d 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -1427,6 +1427,14 @@ func (u *userInterfaceImpl) updateWindowSizeLimits() { u.window.SetSizeLimits(minw, minh, maxw, maxh) } +// disableWindowSizeLimits disables a window size limitation temporarily, especially for fullscreen +// In order to enable the size limitation, call updateWindowSizeLimits. +// +// disableWindowSizeLimits must be called from the main thread. +func (u *userInterfaceImpl) disableWindowSizeLimits() { + u.window.SetSizeLimits(glfw.DontCare, glfw.DontCare, glfw.DontCare, glfw.DontCare) +} + // adjustWindowSizeBasedOnSizeLimitsInDIP adjust the size based on the window size limits. // width and height are in device-independent pixels. func (u *userInterfaceImpl) adjustWindowSizeBasedOnSizeLimitsInDIP(width, height int) (int, int) { @@ -1496,6 +1504,8 @@ func (u *userInterfaceImpl) setFullscreen(fullscreen bool) { // Enter the fullscreen. if fullscreen { + u.disableWindowSizeLimits() + if x, y := u.origWindowPos(); x == invalidPos || y == invalidPos { u.setOrigWindowPos(u.window.GetPos()) } @@ -1516,6 +1526,7 @@ func (u *userInterfaceImpl) setFullscreen(fullscreen bool) { } // Exit the fullscreen. + u.updateWindowSizeLimits() // Get the original window position and size before changing the state of fullscreen. // TODO: Why? diff --git a/internal/ui/ui_glfw_darwin.go b/internal/ui/ui_glfw_darwin.go index 2c3f18a73..4e1b169b7 100644 --- a/internal/ui/ui_glfw_darwin.go +++ b/internal/ui/ui_glfw_darwin.go @@ -122,6 +122,7 @@ func init() { { Cmd: sel_windowWillEnterFullScreen, Fn: func(id objc.ID, cmd objc.SEL, notification objc.ID) { + theUI.disableWindowSizeLimits() pushResizableState(id, cocoa.NSNotification{ID: notification}.Object()) }, }, @@ -135,6 +136,7 @@ func init() { Cmd: sel_windowWillExitFullScreen, Fn: func(id objc.ID, cmd objc.SEL, notification objc.ID) { pushResizableState(id, cocoa.NSNotification{ID: notification}.Object()) + theUI.updateWindowSizeLimits() }, }, {