* nsterm.m (keyDown): Interpret flags without left/right bits

as the left key.

Fixes: debbugs:11670
This commit is contained in:
Jan Djärv 2012-07-16 13:02:09 +02:00
parent 01795a1bcf
commit 5d127af98d
2 changed files with 30 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2012-07-16 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.m (keyDown): Interpret flags without left/right bits
as the left key (Bug#11670).
2012-07-16 Dmitry Antipov <dmantipov@yandex.ru>
Remove empty and useless init functions.

View file

@ -4720,8 +4720,13 @@ most recently updated (I guess), which is not the correct one. */
if (!processingCompose)
{
/* When using screen sharing, no left or right information is sent,
so use Left key in those cases. */
int is_left_key, is_right_key;
code = ([[theEvent charactersIgnoringModifiers] length] == 0) ?
0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0];
/* (Carbon way: [theEvent keyCode]) */
/* is it a "function key"? */
@ -4746,13 +4751,17 @@ most recently updated (I guess), which is not the correct one. */
if (flags & NSShiftKeyMask)
emacs_event->modifiers |= shift_modifier;
if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask)
is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask;
is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
|| (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask);
if (is_right_key)
emacs_event->modifiers |= parse_solitary_modifier
(EQ (ns_right_command_modifier, Qleft)
? ns_command_modifier
: ns_right_command_modifier);
if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask)
if (is_left_key)
{
emacs_event->modifiers |= parse_solitary_modifier
(ns_command_modifier);
@ -4789,13 +4798,17 @@ most recently updated (I guess), which is not the correct one. */
}
}
if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask)
is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask;
is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask
|| (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask);
if (is_right_key)
emacs_event->modifiers |= parse_solitary_modifier
(EQ (ns_right_control_modifier, Qleft)
? ns_control_modifier
: ns_right_control_modifier);
if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask)
if (is_left_key)
emacs_event->modifiers |= parse_solitary_modifier
(ns_control_modifier);
@ -4806,7 +4819,13 @@ most recently updated (I guess), which is not the correct one. */
left_is_none = NILP (ns_alternate_modifier)
|| EQ (ns_alternate_modifier, Qnone);
if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)
is_right_key = (flags & NSRightAlternateKeyMask)
== NSRightAlternateKeyMask;
is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask
|| (! is_right_key
&& (flags & NSAlternateKeyMask) == NSAlternateKeyMask);
if (is_right_key)
{
if ((NILP (ns_right_alternate_modifier)
|| EQ (ns_right_alternate_modifier, Qnone)
@ -4826,7 +4845,7 @@ most recently updated (I guess), which is not the correct one. */
: ns_right_alternate_modifier);
}
if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */
if (is_left_key) /* default = meta */
{
if (left_is_none && !fnKeysym)
{ /* accept pre-interp alt comb */