From 6fb020f5de1487484712e7113db0e86dd97481bd Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Sat, 30 Nov 2013 21:23:39 -0800 Subject: options: add option to disable using right Alt key as Alt Gr mpv was hardcoded to always consider the right Alt key as Alt Gr, but there are parituclar combinations of platforms and keyboard layouts where it's more convenient to treat the right Alt as a keyboard modifier just like the left one. Fixes #388 --- osdep/macosx_events.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'osdep') diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index ef67647f61..4831904aa7 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -174,6 +174,11 @@ void cocoa_put_key_with_modifiers(int keycode, int modifiers) HIDRemote *_remote; } +- (BOOL)useAltGr +{ + return mp_input_use_alt_gr(mpv_shared_app().inputContext); +} + - (void)startAppleRemote { dispatch_async(dispatch_get_main_queue(), ^{ @@ -287,7 +292,8 @@ void cocoa_put_key_with_modifiers(int keycode, int modifiers) mask |= MP_KEY_MODIFIER_SHIFT; if (cocoaModifiers & NSControlKeyMask) mask |= MP_KEY_MODIFIER_CTRL; - if (LeftAltPressed(cocoaModifiers)) + if (LeftAltPressed(cocoaModifiers) || + RightAltPressed(cocoaModifiers) && ![self useAltGr]) mask |= MP_KEY_MODIFIER_ALT; if (cocoaModifiers & NSCommandKeyMask) mask |= MP_KEY_MODIFIER_META; @@ -333,7 +339,7 @@ void cocoa_put_key_with_modifiers(int keycode, int modifiers) NSString *chars; - if (RightAltPressed([event modifierFlags])) + if ([self useAltGr] && RightAltPressed([event modifierFlags])) chars = [event characters]; else chars = [event charactersIgnoringModifiers]; -- cgit v1.2.3