mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 09:57:34 +00:00
mac/helper: make wakeup callback declaration consistent
This commit is contained in:
parent
6df06e5dc5
commit
984c890661
@ -27,7 +27,7 @@ extension EventSubscriber {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension EventHelper {
|
extension EventHelper {
|
||||||
typealias wakeup_cb = (@convention(c) (UnsafeMutableRawPointer?) -> Void)?
|
typealias WakeupCallback = (@convention(c) (UnsafeMutableRawPointer?) -> Void)?
|
||||||
|
|
||||||
struct Event {
|
struct Event {
|
||||||
var id: String {
|
var id: String {
|
||||||
@ -91,7 +91,7 @@ class EventHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let wakeup: wakeup_cb = { ( ctx ) in
|
let wakeup: WakeupCallback = { ( ctx ) in
|
||||||
let event = unsafeBitCast(ctx, to: EventHelper.self)
|
let event = unsafeBitCast(ctx, to: EventHelper.self)
|
||||||
DispatchQueue.main.async { event.eventLoop() }
|
DispatchQueue.main.async { event.eventLoop() }
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
typealias swift_wakeup_cb_fn = (@convention(c) (UnsafeMutableRawPointer?) -> Void)?
|
extension OptionHelper {
|
||||||
|
typealias WakeupCallback = (@convention(c) (UnsafeMutableRawPointer?) -> Void)?
|
||||||
|
}
|
||||||
|
|
||||||
class OptionHelper {
|
class OptionHelper {
|
||||||
var voCachePtr: UnsafeMutablePointer<m_config_cache>
|
var voCachePtr: UnsafeMutablePointer<m_config_cache>
|
||||||
@ -64,7 +66,7 @@ class OptionHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setMacOptionCallback(_ callback: swift_wakeup_cb_fn, context object: AnyObject) {
|
func setMacOptionCallback(_ callback: WakeupCallback, context object: AnyObject) {
|
||||||
m_config_cache_set_wakeup_cb(macCachePtr, callback, TypeHelper.bridge(obj: object))
|
m_config_cache_set_wakeup_cb(macCachePtr, callback, TypeHelper.bridge(obj: object))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ class Common: NSObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let macOptsWakeupCallback: swift_wakeup_cb_fn = { ( ctx ) in
|
let macOptsWakeupCallback: OptionHelper.WakeupCallback = { ( ctx ) in
|
||||||
let com = unsafeBitCast(ctx, to: Common.self)
|
let com = unsafeBitCast(ctx, to: Common.self)
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
com.macOptsUpdate()
|
com.macOptsUpdate()
|
||||||
|
Loading…
Reference in New Issue
Block a user