summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_application.m
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-06-04 22:12:23 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-06-04 23:02:23 +0200
commit213ad5d6c41f32cf9086fa377cd6d6df1236bb76 (patch)
treed265eda1e4deca9ad58de8e2137852d1cf3e8c1e /osdep/macosx_application.m
parent1b6888ae8e30331033bf197b862742d9bda21843 (diff)
downloadmpv-213ad5d6c41f32cf9086fa377cd6d6df1236bb76.tar.bz2
mpv-213ad5d6c41f32cf9086fa377cd6d6df1236bb76.tar.xz
osx: improve Media Keys support
This commit addresses some issues with the users had with the previous implementation in commit c39efb9. Here's the changes: * Use Quartz Event Taps to remove Media Key events mpv handles from the global OS X queue. This prevents conflicts with iTunes. I did this on the main thread since it is mostly idling. It's the playloop thread that actually does all the work so there is no danger of blocking the event tap callback. * Introduce `--no-media-keys` switch so that users can disable all of mpv's media key handling at runtime (some prefer iTunes for example). * Use mpv's bindings so that users can customize what the media keys do via input.conf. Current bindings are: MK_PLAY cycle pause MK_PREV playlist_prev MK_NEXT playlist_next An additional benefit of this implementation is that it is completly handled by the `macosx_events` file instead of `macosx_application` making the project organization more straightforward.
Diffstat (limited to 'osdep/macosx_application.m')
-rw-r--r--osdep/macosx_application.m14
1 files changed, 1 insertions, 13 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index 1329091e12..665a04b222 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -120,19 +120,7 @@ static NSString *escape_loadfile_name(NSString *input)
- (void)sendEvent:(NSEvent *)event
{
- if ([event type] == NSSystemDefined && [event subtype] == 8) {
- // It's a media key! Handle it specially. The magic numbers are reverse
- // engineered and found on several blog posts. Unfortunately there is
- // no public API for this. F-bomb.
- int code = (([event data1] & 0xFFFF0000) >> 16);
- int flags = ([event data1] & 0x0000FFFF);
- int down = (((flags & 0xFF00) >> 8)) == 0xA;
-
- if (down)
- [self.eventsResponder handleMediaKey:code];
- } else {
- [super sendEvent:event];
- }
+ [super sendEvent:event];
if (self.inputContext)
mp_input_wakeup(self.inputContext);