internal/ui: bug fix: FPS drop on fullscreen on macOS 13

Updates #1745
Closes #2495
This commit is contained in:
Hajime Hoshi 2022-12-16 02:59:04 +09:00
parent 9911b760c5
commit 61a009e508
2 changed files with 0 additions and 20 deletions

View File

@ -49,7 +49,6 @@ var (
sel_UTF8String = objc.RegisterName("UTF8String") sel_UTF8String = objc.RegisterName("UTF8String")
sel_length = objc.RegisterName("length") sel_length = objc.RegisterName("length")
sel_processInfo = objc.RegisterName("processInfo") sel_processInfo = objc.RegisterName("processInfo")
sel_isOperatingSystemAtLeastVersion = objc.RegisterName("isOperatingSystemAtLeastVersion:")
sel_frame = objc.RegisterName("frame") sel_frame = objc.RegisterName("frame")
sel_contentView = objc.RegisterName("contentView") sel_contentView = objc.RegisterName("contentView")
sel_setBackgroundColor = objc.RegisterName("setBackgroundColor:") sel_setBackgroundColor = objc.RegisterName("setBackgroundColor:")
@ -123,18 +122,6 @@ func NSProcessInfo_processInfo() NSProcessInfo {
return NSProcessInfo{objc.ID(class_NSProcessInfo).Send(sel_processInfo)} return NSProcessInfo{objc.ID(class_NSProcessInfo).Send(sel_processInfo)}
} }
func (p NSProcessInfo) IsOperatingSystemAtLeastVersion(version NSOperatingSystemVersion) bool {
sig := NSMethodSignature_instanceMethodSignatureForSelector(objc.ID(class_NSProcessInfo), sel_isOperatingSystemAtLeastVersion)
inv := NSInvocation_invocationWithMethodSignature(sig)
inv.SetTarget(p.ID)
inv.SetSelector(sel_isOperatingSystemAtLeastVersion)
inv.SetArgumentAtIndex(unsafe.Pointer(&version), 2)
inv.Invoke()
var ret int
inv.GetReturnValue(unsafe.Pointer(&ret))
return ret != 0
}
type NSWindow struct { type NSWindow struct {
objc.ID objc.ID
} }

View File

@ -341,13 +341,6 @@ func (u *userInterfaceImpl) adjustViewSizeAfterFullscreen() {
return return
} }
// Apparently, adjusting the view size is not needed as of macOS 12 (#1745).
if cocoa.NSProcessInfo_processInfo().IsOperatingSystemAtLeastVersion(cocoa.NSOperatingSystemVersion{
Major: 12,
}) {
return
}
// Reduce the view height (#1745). // Reduce the view height (#1745).
// https://stackoverflow.com/questions/27758027/sprite-kit-serious-fps-issue-in-full-screen-mode-on-os-x // https://stackoverflow.com/questions/27758027/sprite-kit-serious-fps-issue-in-full-screen-mode-on-os-x
windowSize := window.Frame().Size windowSize := window.Frame().Size