[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r102500: Bug 7458: Make key press lik
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r102500: Bug 7458: Make key press like Left + right ctrl work when right is not control. |
Date: |
Wed, 24 Nov 2010 08:50:08 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 102500
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Wed 2010-11-24 08:50:08 +0100
message:
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.
modified:
src/ChangeLog
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2010-11-23 20:27:22 +0000
+++ b/src/ChangeLog 2010-11-24 07:50:08 +0000
@@ -1,3 +1,9 @@
+2010-11-24 Jan Djärv <address@hidden>
+
+ * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask)
+ (NSLeftAlternateKeyMask): New defines.
+ (keyDown): Parse left and right keys separatly (Bug#7458).
+
2010-11-23 Eli Zaretskii <address@hidden>
* intervals.c (temp_set_point_both): Define before calling, to
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2010-11-21 13:09:34 +0000
+++ b/src/nsterm.m 2010-11-24 07:50:08 +0000
@@ -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 ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier,
Qnone))
+ 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))
&& !fnKeysym)
{ /* accept pre-interp alt comb */
if ([[theEvent characters] length] > 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r102500: Bug 7458: Make key press like Left + right ctrl work when right is not control.,
Jan D. <=