mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-27 04:08:53 +01:00
internal/ui: forbid a green button when a max window size limit is specified
Updates #2260
This commit is contained in:
parent
128215eedd
commit
40fc96d78c
@ -1319,6 +1319,9 @@ func (u *userInterfaceImpl) updateWindowSizeLimits() {
|
|||||||
maxh = int(u.dipToGLFWPixel(float64(maxh), m))
|
maxh = int(u.dipToGLFWPixel(float64(maxh), m))
|
||||||
}
|
}
|
||||||
u.window.SetSizeLimits(minw, minh, maxw, maxh)
|
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.
|
// adjustWindowSizeBasedOnSizeLimitsInDIP adjust the size based on the window size limits.
|
||||||
|
@ -348,11 +348,22 @@ func (u *userInterfaceImpl) adjustViewSizeAfterFullscreen() {
|
|||||||
window.SetBackgroundColor(cocoa.NSColor_colorWithSRGBRedGreenBlueAlpha(0, 0, 0, 0))
|
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) {
|
func (u *userInterfaceImpl) setWindowResizingModeForOS(mode WindowResizingMode) {
|
||||||
allowFullscreen := mode == WindowResizingModeOnlyFullscreenEnabled ||
|
|
||||||
mode == WindowResizingModeEnabled
|
|
||||||
var collectionBehavior uint
|
var collectionBehavior uint
|
||||||
if allowFullscreen {
|
if u.isFullscreenAllowedFromUI(mode) {
|
||||||
collectionBehavior |= cocoa.NSWindowCollectionBehaviorManaged
|
collectionBehavior |= cocoa.NSWindowCollectionBehaviorManaged
|
||||||
collectionBehavior |= cocoa.NSWindowCollectionBehaviorFullScreenPrimary
|
collectionBehavior |= cocoa.NSWindowCollectionBehaviorFullScreenPrimary
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user