mirror of https://github.com/mpv-player/mpv
mac/remote: use AppHub directly instead of the singleton
This commit is contained in:
parent
6846338cf2
commit
37b2e59787
|
@ -42,6 +42,7 @@ extension RemoteCommandCenter {
|
||||||
class RemoteCommandCenter: EventSubscriber {
|
class RemoteCommandCenter: EventSubscriber {
|
||||||
unowned let appHub: AppHub
|
unowned let appHub: AppHub
|
||||||
var event: EventHelper? { get { return appHub.event } }
|
var event: EventHelper? { get { return appHub.event } }
|
||||||
|
var input: InputHelper { get { return appHub.input } }
|
||||||
var configs: [MPRemoteCommand:Config] = [:]
|
var configs: [MPRemoteCommand:Config] = [:]
|
||||||
var disabledCommands: [MPRemoteCommand] = []
|
var disabledCommands: [MPRemoteCommand] = []
|
||||||
var isPaused: Bool = false { didSet { updateInfoCenter() } }
|
var isPaused: Bool = false { didSet { updateInfoCenter() } }
|
||||||
|
@ -168,7 +169,7 @@ class RemoteCommandCenter: EventSubscriber {
|
||||||
self.configs[event.command]?.state = state
|
self.configs[event.command]?.state = state
|
||||||
}
|
}
|
||||||
|
|
||||||
AppHub.shared.input.put(key: config.key | Int32(state))
|
self.input.put(key: config.key | Int32(state))
|
||||||
|
|
||||||
return .success
|
return .success
|
||||||
}
|
}
|
||||||
|
@ -179,7 +180,7 @@ class RemoteCommandCenter: EventSubscriber {
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmd = String(format: "seek %.02f absolute", posEvent.positionTime)
|
let cmd = String(format: "seek %.02f absolute", posEvent.positionTime)
|
||||||
return AppHub.shared.input.command(cmd) ? .success : .commandFailed
|
return self.input.command(cmd) ? .success : .commandFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
func handle(event: EventHelper.Event) {
|
func handle(event: EventHelper.Event) {
|
||||||
|
|
Loading…
Reference in New Issue