mirror of https://github.com/mpv-player/mpv
mac/common: fix light sensor deprecations
This commit is contained in:
parent
23843b4aa5
commit
6f009a91a6
|
@ -44,6 +44,10 @@ extension NSDraggingInfo {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_MACOS_12_FEATURES
|
||||||
|
let kIOMainPortDefault: mach_port_t = kIOMasterPortDefault
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_MACOS_12_FEATURES && HAVE_MACOS_11_FEATURES
|
#if !HAVE_MACOS_12_FEATURES && HAVE_MACOS_11_FEATURES
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 11.0, *)
|
||||||
extension CGColorSpace {
|
extension CGColorSpace {
|
||||||
|
|
|
@ -281,13 +281,13 @@ class Common: NSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initLightSensor() {
|
func initLightSensor() {
|
||||||
let srv = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleLMUController"))
|
let srv = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("AppleLMUController"))
|
||||||
if srv == IO_OBJECT_NULL {
|
if srv == IO_OBJECT_NULL {
|
||||||
log.verbose("Can't find an ambient light sensor")
|
log.verbose("Can't find an ambient light sensor")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
lightSensorIOPort = IONotificationPortCreate(kIOMasterPortDefault)
|
lightSensorIOPort = IONotificationPortCreate(kIOMainPortDefault)
|
||||||
IONotificationPortSetDispatchQueue(lightSensorIOPort, queue)
|
IONotificationPortSetDispatchQueue(lightSensorIOPort, queue)
|
||||||
var n = io_object_t()
|
var n = io_object_t()
|
||||||
IOServiceAddInterestNotification(lightSensorIOPort, srv, kIOGeneralInterest, lightSensorCallback,
|
IOServiceAddInterestNotification(lightSensorIOPort, srv, kIOGeneralInterest, lightSensorCallback,
|
||||||
|
|
Loading…
Reference in New Issue