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
47 }47 }
48}48}
49 49
50extension 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
62extension NSEvent.ModifierFlags {50extension NSEvent.ModifierFlags {
63 public static var optionLeft: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICELALTKEYMASK))51 public static var optionLeft: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICELALTKEYMASK))
64 public static var optionRight: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICERALTKEYMASK))52 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
132 }()132 }()
133 }133 }
134 134
135 func set(color: Any) {135 func set(color: m_color) {
136 if color is String {136 layer?.backgroundColor = NSColor(calibratedRed: CGFloat(color.r)/255,
137 layer?.backgroundColor = NSColor(hex: color as? String ?? "#00000000").cgColor137 green: CGFloat(color.g)/255,
138 } else {138 blue: CGFloat(color.b)/255,
139 let col = color as? m_color ?? m_color(r: 0, g: 0, b: 0, a: 0)139 alpha: CGFloat(color.a)/255).cgColor
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 }
147 }140 }
148 141
149 func show() {142 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