Commit 50795d1f authored by Jan Djärv's avatar Jan Djärv
Browse files

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.
parent 69881db0
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
......
......@@ -233,9 +233,12 @@ the Function modifier (laptops). May be any of the modifier lisp symbols. */
/* 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 @@ most recently updated (I guess), which is not the correct one. */
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 @@ most recently updated (I guess), which is not the correct one. */
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 @@ most recently updated (I guess), which is not the correct one. */
}
}
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_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))
if ((NILP (ns_alternate_modifier)
|| EQ (ns_alternate_modifier, Qnone))
&& !fnKeysym)
{ /* accept pre-interp alt comb */
if ([[theEvent characters] length] > 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment