Mercurial > emacs
changeset 111700:3242c8febbd0
Bug 7458: Make key press like Left + right ctrl work when right is not control.
Ditto Alt and Command.
* src/nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask)
(NSLeftAlternateKeyMask): New defines.
(keyDown): Parse left and right keys separatly.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Wed, 24 Nov 2010 08:50:08 +0100 |
parents | 316e4e1b628c |
children | 3fbe2d0ad0f8 |
files | src/ChangeLog src/nsterm.m |
diffstat | 2 files changed, 51 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Nov 24 06:50:28 2010 +0000 +++ b/src/ChangeLog Wed Nov 24 08:50:08 2010 +0100 @@ -1,3 +1,9 @@ +2010-11-24 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask) + (NSLeftAlternateKeyMask): New defines. + (keyDown): Parse left and right keys separatly (Bug#7458). + 2010-11-23 Eli Zaretskii <eliz@gnu.org> * intervals.c (temp_set_point_both): Define before calling, to
--- a/src/nsterm.m Wed Nov 24 06:50:28 2010 +0000 +++ b/src/nsterm.m Wed Nov 24 08:50:08 2010 +0100 @@ -233,9 +233,12 @@ /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 -#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) +#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) #define NSRightControlKeyMask (0x002000 | NSControlKeyMask) +#define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask) #define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) +#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask) +#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) #define EV_MODIFIERS(e) \ ((([e modifierFlags] & NSHelpKeyMask) ? \ hyper_modifier : 0) \ @@ -4419,7 +4422,7 @@ code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; /* (Carbon way: [theEvent keyCode]) */ - + /* is it a "function key"? */ fnKeysym = ns_convert_key (code); if (fnKeysym) @@ -4442,15 +4445,16 @@ if (flags & NSShiftKeyMask) emacs_event->modifiers |= shift_modifier; - if (flags & NSCommandKeyMask) + if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_command_modifier, Qleft) + ? ns_command_modifier + : ns_right_command_modifier); + + if (flags & NSLeftCommandKeyMask) { - if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask - && !EQ (ns_right_command_modifier, Qleft)) - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_command_modifier); - else - emacs_event->modifiers |= parse_solitary_modifier - (ns_command_modifier); + emacs_event->modifiers |= parse_solitary_modifier + (ns_command_modifier); /* if super (default), take input manager's word so things like dvorak / qwerty layout work */ @@ -4484,30 +4488,43 @@ } } - if (flags & NSControlKeyMask) - { - if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask - && !EQ (ns_right_control_modifier, Qleft)) - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_control_modifier); - else - emacs_event->modifiers |= parse_solitary_modifier - (ns_control_modifier); - } + if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_control_modifier, Qleft) + ? ns_control_modifier + : ns_right_control_modifier); + + if (flags & NSLeftControlKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (ns_control_modifier); if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) emacs_event->modifiers |= parse_solitary_modifier (ns_function_modifier); - if (!EQ (ns_right_alternate_modifier, Qleft) - && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)) - { - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_alternate_modifier); - } - else if (flags & NSAlternateKeyMask) /* default = meta */ + if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) { - if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) + if ((NILP (ns_right_alternate_modifier) + || EQ (ns_right_alternate_modifier, Qnone)) + && !fnKeysym) + { /* accept pre-interp alt comb */ + if ([[theEvent characters] length] > 0) + code = [[theEvent characters] characterAtIndex: 0]; + /*HACK: clear lone shift modifier to stop next if from firing */ + if (emacs_event->modifiers == shift_modifier) + emacs_event->modifiers = 0; + } + else + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_alternate_modifier, Qleft) + ? ns_alternate_modifier + : ns_right_alternate_modifier); + } + + if (flags & NSLeftAlternateKeyMask) /* default = meta */ + { + if ((NILP (ns_alternate_modifier) + || EQ (ns_alternate_modifier, Qnone)) && !fnKeysym) { /* accept pre-interp alt comb */ if ([[theEvent characters] length] > 0)