History

mac/title: remove old libmpv color setter fallback

der richter committed 1 year ago

Commit cd9fa6d1 parent 51af3ca2 files · +5 −24Browse files

Unified · Split

2 files
  1. osdep/mac/swift_extensions.swift +0 −12
  2. video/out/mac/title_bar.swift +5 −12
osdep/mac/swift_extensions.swift+0−12
@@ -47,18 +47,6 @@ extension NSScreen { · 46 unmodified lines
4747 }
4848 }
4949
50−extension NSColor {
51− convenience init(hex: String) {
52− let int = Int(hex.dropFirst(), radix: 16) ?? 0
53− let alpha = CGFloat((int >> 24) & 0x000000FF)/255
54− let red = CGFloat((int >> 16) & 0x000000FF)/255
55− let green = CGFloat((int >> 8) & 0x000000FF)/255
56− let blue = CGFloat((int) & 0x000000FF)/255
57−
58− self.init(calibratedRed: red, green: green, blue: blue, alpha: alpha)
59− }
60−}
61−
6250 extension NSEvent.ModifierFlags {
6351 public static var optionLeft: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICELALTKEYMASK))
6452 public static var optionRight: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICERALTKEYMASK))
video/out/mac/title_bar.swift+5−12
@@ -132,18 +132,11 @@ class TitleBar: NSVisualEffectView { · 131 unmodified lines
132132 }()
133133 }
134134
135− func set(color: Any) {
136− if color is String {
137− layer?.backgroundColor = NSColor(hex: color as? String ?? "#00000000").cgColor
138− } else {
139− let col = color as? m_color ?? m_color(r: 0, g: 0, b: 0, a: 0)
140− let red = CGFloat(col.r)/255
141− let green = CGFloat(col.g)/255
142− let blue = CGFloat(col.b)/255
143− let alpha = CGFloat(col.a)/255
144− layer?.backgroundColor = NSColor(calibratedRed: red, green: green,
145− blue: blue, alpha: alpha).cgColor
146− }
135+ func set(color: m_color) {
136+ layer?.backgroundColor = NSColor(calibratedRed: CGFloat(color.r)/255,
137+ green: CGFloat(color.g)/255,
138+ blue: CGFloat(color.b)/255,
139+ alpha: CGFloat(color.a)/255).cgColor
147140 }
148141
149142 func show() {

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