diff options
Diffstat (limited to 'osdep/macosx_events.m')
-rw-r--r-- | osdep/macosx_events.m | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index d1228bb471..26853628b3 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -20,6 +20,9 @@ // Carbon header is included but Carbon is NOT linked to mpv's binary. This // file only needs this include to use the keycode definitions in keymap. #import <Carbon/Carbon.h> + +// Media keys definitions +#import <IOKit/hidsystem/ev_keymap.h> #import <Cocoa/Cocoa.h> #include "talloc.h" @@ -107,6 +110,22 @@ void cocoa_put_key(int keycode) { return @[@"h", @"q", @"Q", @"0", @"1", @"2"]; } +- (void)handleMediaKey:(int)key +{ + switch (key) { + case NX_KEYTYPE_PLAY: + cocoa_put_key(MP_KEY_PLAY); + break; + + case NX_KEYTYPE_FAST: + cocoa_put_key(MP_KEY_NEXT); + break; + + case NX_KEYTYPE_REWIND: + cocoa_put_key(MP_KEY_PREV); + break; + } +} - (NSEvent*)handleKeyDown:(NSEvent *)event { NSString *chars; |