Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some deprecated issues #5130

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Fix some deprecated issues #5130

wants to merge 2 commits into from

Conversation

siieo
Copy link

@siieo siieo commented Aug 12, 2024


Description:

In reviewing the code, I identified several deprecated APIs that need to be updated to ensure compatibility with the latest macOS versions. To address these issues, I have replaced the deprecated methods with their modern counterparts, aligning with current best practices and API recommendations.


Works fine in intel and Apple Silicon with Xcode 15.4

Works fine in intel and Apple Silicon
@@ -710,7 +710,7 @@ class MainWindowController: PlayerWindowController {
}

private func setupOSCToolbarButtons(_ buttons: [Preference.ToolBarButton]) {
var buttons = buttons
let buttons = buttons
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let buttons = buttons

There's no reason to shadow buttons here, just delete it.

@@ -57,7 +57,7 @@ class PlaySliderCell: NSSliderCell {
NSGraphicsContext.saveGraphicsState()
let shadow = NSShadow()
shadow.shadowBlurRadius = 1
shadow.shadowColor = .controlShadowColor
shadow.shadowColor = NSColor.separatorColor // Use the separatorColor for shadows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
shadow.shadowColor = NSColor.separatorColor // Use the separatorColor for shadows
shadow.shadowColor = .separatorColor

@@ -68,7 +68,7 @@ class PlaySliderCell: NSSliderCell {

if isLightTheme {
path.lineWidth = 0.4
NSColor.controlShadowColor.setStroke()
NSColor.separatorColor.setStroke() // Use separatorColor instead of controlShadowColor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NSColor.separatorColor.setStroke() // Use separatorColor instead of controlShadowColor
NSColor.separatorColor.setStroke()

@uiryuu
Copy link
Member

uiryuu commented Aug 12, 2024

I'm not sure whether or not separatorColor is the correct color to use here

Copy link
Contributor

@low-batt low-batt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code in FFmpegController is needed and must not be removed. See my comment on the change for details.

} else if (@available(macOS 10.15.4, *)) {
cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020_PQ);
} else if (@available(macOS 10.14.6, *)) {
cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020_PQ_EOTF);
Copy link
Contributor

@low-batt low-batt Oct 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code must not be removed.

Thank you very much for working to reduce the deprecated warnings. The IINA project considers it important to fix compiler warnings. Your help is appreciated. Unfortunately Xcode is BROKEN and can trick you into removing code that is needed. The file Configs/Deployment.xconfig contains:

MACOSX_DEPLOYMENT_TARGET = 10.15
MACOSX_DEPLOYMENT_TARGET[arch=arm64] = 12

This has confused Xcode and it is emitting deprecated messages as if the minimum macOS version for IINA is macOS Monterey. It is not. The minimum macOS version is macOS Catalina. If you are building on a Mac with a M series chip, in Xcode change your build destination to My Mac (Rosetta) then clean and rebuild. You will see many of these deprecated warnings disappear. To do that you may have to enable the Rosetta destination. Apple is pushing developers away from Rosetta by hiding that destination in Xcode by default. If you have trouble enabling Rosetta another way to see this is to change the above file to use 10.15 for arch=arm64 then clean and rebuild.

if (@available(macOS 10.15.4, *)) {
cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3_PQ);
} else if (@available(macOS 10.14.6, *)) {
cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3_PQ_EOTF);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS 10.15 is still supported, so this code can not be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants