summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_events.m
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/macosx_events.m')
-rw-r--r--osdep/macosx_events.m22
1 files changed, 12 insertions, 10 deletions
diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m
index 661ef638ca..aff83a866f 100644
--- a/osdep/macosx_events.m
+++ b/osdep/macosx_events.m
@@ -232,13 +232,7 @@ void cocoa_put_key(int keycode)
@(NX_KEYTYPE_FAST): @(MP_MK_NEXT),
};
- int mpkey = [keymap[@(key)] intValue];
- if (mpkey > 0) {
- cocoa_put_key(mpkey);
- return YES;
- } else {
- return NO;
- }
+ return [self handleKey:key withMapping:keymap];
}
- (NSEvent*)handleKeyDown:(NSEvent *)event
{
@@ -296,8 +290,16 @@ void cocoa_put_key(int keycode)
@(kHIDRemoteButtonCodeDownHold): @(MP_AR_VDOWN_HOLD),
};
- int key = [keymap[@(buttonCode)] intValue];
- if (key > 0)
- cocoa_put_key(key);
+ [self handleKey:buttonCode withMapping:keymap];
+}
+-(BOOL)handleKey:(int)key withMapping:(NSDictionary *)mapping
+{
+ int mpkey = [mapping[@(key)] intValue];
+ if (mpkey > 0) {
+ cocoa_put_key(mpkey);
+ return YES;
+ } else {
+ return NO;
+ }
}
@end