History

mac/title: remove old libmpv material setter fallback

der richter committed 1 year ago

Commit 51af3ca1 parent 11a9f352 files · +25 −32Browse files

Unified · Split

2 files
  1. video/out/mac/common.swift +1 −1
  2. video/out/mac/title_bar.swift +24 −31
video/out/mac/common.swift+1−1
@@ -666,7 +666,7 @@ class Common: NSObject { · 665 unmodified lines
666666 case TypeHelper.toPointer(&option.macPtr.pointee.macos_title_bar_appearance):
667667 titleBar?.set(appearance: option.mac.macos_title_bar_appearance)
668668 case TypeHelper.toPointer(&option.macPtr.pointee.macos_title_bar_material):
669− titleBar?.set(material: Int(option.mac.macos_title_bar_material))
669+ titleBar?.set(material: option.mac.macos_title_bar_material)
670670 case TypeHelper.toPointer(&option.macPtr.pointee.macos_title_bar_color):
671671 titleBar?.set(color: option.mac.macos_title_bar_color)
672672 case TypeHelper.toPointer(&option.macPtr.pointee.cocoa_cb_output_csp):
video/out/mac/title_bar.swift+24−31
@@ -59,7 +59,7 @@ class TitleBar: NSVisualEffectView { · 58 unmodified lines
5959 window.titlebarAppearsTransparent = true
6060 window.styleMask.insert(.fullSizeContentView)
6161 set(appearance: option.mac.macos_title_bar_appearance)
62− set(material: Int(option.mac.macos_title_bar_material))
62+ set(material: option.mac.macos_title_bar_material)
6363 set(color: option.mac.macos_title_bar_color)
6464 }
6565
@@ -107,12 +107,29 @@ class TitleBar: NSVisualEffectView { · 41 unmodified lines
107107 }()
108108 }
109109
110− func set(material: Any) {
111− if material is Int {
112− self.material = materialFrom(string: String(material as? Int ?? 0))
113− } else {
114− self.material = materialFrom(string: material as? String ?? "titlebar")
115− }
110+ func set(material: Int32) {
111+ self.material = { switch material {
112+ case 0: return .titlebar
113+ case 1: return .selection
114+ case 2: return .menu
115+ case 3: return .popover
116+ case 4: return .sidebar
117+ case 5: return .headerView
118+ case 6: return .sheet
119+ case 7: return .windowBackground
120+ case 8: return .hudWindow
121+ case 9: return .fullScreenUI
122+ case 10: return .toolTip
123+ case 11: return .contentBackground
124+ case 12: return .underWindowBackground
125+ case 13: return .underPageBackground
126+ case 14: return .dark
127+ case 15: return .light
128+ case 16: return .mediumLight
129+ case 17: return .ultraDark
130+ default: return .titlebar
131+ }
132+ }()
116133 }
117134
118135 func set(color: Any) {
@@ -174,28 +191,4 @@ class TitleBar: NSVisualEffectView { · 55 unmodified lines
174191 object: nil)
175192 perform(#selector(hide), with: nil, afterDelay: 0.5)
176193 }
177−
178− func materialFrom(string: String) -> NSVisualEffectView.Material {
179− switch string {
180− case "0", "titlebar": return .titlebar
181− case "1", "selection": return .selection
182− case "2", "menu": return .menu
183− case "3", "popover": return .popover
184− case "4", "sidebar": return .sidebar
185− case "5", "headerView": return .headerView
186− case "6", "sheet": return .sheet
187− case "7", "windowBackground": return .windowBackground
188− case "8", "hudWindow": return .hudWindow
189− case "9", "fullScreen": return .fullScreenUI
190− case "10", "toolTip": return .toolTip
191− case "11", "contentBackground": return .contentBackground
192− case "12", "underWindowBackground": return .underWindowBackground
193− case "13", "underPageBackground": return .underPageBackground
194− case "14", "dark": return .dark
195− case "15", "light": return .light
196− case "16", "mediumLight": return .mediumLight
197− case "17", "ultraDark": return .ultraDark
198− default: return .titlebar
199− }
200− }
201194 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t