mirror of
https://github.com/mpv-player/mpv
synced 2025-03-01 03:40:43 +00:00
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.
This commit is contained in:
parent
9ffd1cdaf8
commit
4a8ee6d9a4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user