Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit 8b832e6

Browse files
low-battCarterLi
authored andcommitted
Fix wrong title shown in window menu, iina#4229
This commit will remove the check that suppressed the workaround in MainWindowController.windowWillOpen for the title problem when running under macOS 12+. The workaround was conditionalized because AppKit was confirmed to be working correctly under macOS 12.3. The assumption was that we could count of AppKit working correctly going forward. However the problem is back in macOS 13.2.1. Not clear when it was re-introduced.
1 parent e7c826a commit 8b832e6

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

Diff for: iina/MainWindowController.swift

+14-20
Original file line numberDiff line numberDiff line change
@@ -1052,26 +1052,20 @@ class MainWindowController: PlayerWindowController {
10521052
// MARK: - Window delegate: Open / Close
10531053

10541054
func windowWillOpen() {
1055-
if #available(macOS 12, *) {
1056-
// Apparently Apple fixed AppKit for Monterey so the workaround below is only needed for
1057-
// previous versions of macOS. Support for #unavailable is coming in Swift 5.6. The version of
1058-
// Xcode being used at the time of this writing supports Swift 5.5.
1059-
} else {
1060-
// Must workaround an AppKit defect in earlier versions of macOS. This defect is known to
1061-
// exist in Catalina and Big Sur. The problem was not reproducible in Monterey. The status of
1062-
// other versions of macOS is unknown, however the workaround should be safe to apply in any
1063-
// version of macOS. The problem was reported in issues #3159, #3097 and #3253. The titles of
1064-
// open windows shown in the "Window" menu are automatically managed by the AppKit framework.
1065-
// To improve performance PlayerCore caches and reuses player instances along with their
1066-
// windows. This technique is valid and recommended by Apple. But in older versions of macOS,
1067-
// if a window is reused the framework will display the title first used for the window in the
1068-
// "Window" menu even after IINA has updated the title of the window. This problem can also be
1069-
// seen when right-clicking or control-clicking the IINA icon in the dock. As a workaround
1070-
// reset the window's title to "Window" before it is reused. This is the default title AppKit
1071-
// assigns to a window when it is first created. Surprising and rather disturbing this works
1072-
// as a workaround, but it does.
1073-
window!.title = "Window"
1074-
}
1055+
// Must workaround an AppKit defect in some versions of macOS. This defect is known to exist in
1056+
// Catalina and Big Sur. The problem was not reproducible in early versions of Monterey. It
1057+
// reappeared in Ventura. The status of other versions of macOS is unknown, however the
1058+
// workaround should be safe to apply in any version of macOS. The problem was reported in
1059+
// issues #4229, #3159, #3097 and #3253. The titles of open windows shown in the "Window" menu
1060+
// are automatically managed by the AppKit framework. To improve performance PlayerCore caches
1061+
// and reuses player instances along with their windows. This technique is valid and recommended
1062+
// by Apple. But in some versions of macOS, if a window is reused the framework will display the
1063+
// title first used for the window in the "Window" menu even after IINA has updated the title of
1064+
// the window. This problem can also be seen when right-clicking or control-clicking the IINA
1065+
// icon in the dock. As a workaround reset the window's title to "Window" before it is reused.
1066+
// This is the default title AppKit assigns to a window when it is first created. Surprising and
1067+
// rather disturbing this works as a workaround, but it does.
1068+
window!.title = "Window"
10751069

10761070
// As there have been issues in this area, log details about the screen selection process.
10771071
NSScreen.log("window!.screen", window!.screen)

0 commit comments

Comments
 (0)