summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_events.m
diff options
context:
space:
mode:
authorVivek Jain <viveksjain@gmail.com>2013-11-30 21:23:39 -0800
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-12-02 09:03:31 +0100
commit6fb020f5de1487484712e7113db0e86dd97481bd (patch)
tree7561b28161f061d8b6c3a1146f131361b59fd686 /osdep/macosx_events.m
parenta74d9c1803462e0f7862f7b0659ab70939b92e15 (diff)
downloadmpv-6fb020f5de1487484712e7113db0e86dd97481bd.tar.bz2
mpv-6fb020f5de1487484712e7113db0e86dd97481bd.tar.xz
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
Diffstat (limited to 'osdep/macosx_events.m')
-rw-r--r--osdep/macosx_events.m10
1 files changed, 8 insertions, 2 deletions
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];