diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2011-11-26 16:21:42 +0100 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-11-26 20:04:16 +0200 |
commit | 4a8ee6d9a4266589b25a817eb9fbc71a11704bc8 (patch) | |
tree | 660403f127114cafe1673f1f8551ef5b4c476a9d /libvo | |
parent | 9ffd1cdaf802acf71c7e4db86b650be33b7c05ba (diff) | |
download | mpv-4a8ee6d9a4266589b25a817eb9fbc71a11704bc8.tar.bz2 mpv-4a8ee6d9a4266589b25a817eb9fbc71a11704bc8.tar.xz |
vo_corevideo: fix key interpretation with modifiers
When interpreting a key event, use the "charactersIgnoringModifiers"
method of the event in order to extract Alt+key combinations while
keeping the normal meaning of "key". When the right alt modifier is
pressed use the "characters" method to allow AltGr behavior to be used
to generate different characters.
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_corevideo.m | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 3b83051eb7..e937460636 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -938,8 +938,15 @@ static int control(uint32_t request, void *data) */ - (void) keyDown: (NSEvent *) theEvent { - int key = convert_key([theEvent keyCode], *[[theEvent characters] UTF8String]); - if (key != -1) { + unsigned char charcode; + if (([theEvent modifierFlags] & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) + charcode = *[[theEvent characters] UTF8String]; + else + charcode = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; + + int key = convert_key([theEvent keyCode], charcode); + + if (key > -1) { if([theEvent modifierFlags] & NSShiftKeyMask) key |= KEY_MODIFIER_SHIFT; if([theEvent modifierFlags] & NSControlKeyMask) |