From 8f31e74bc70d3da2947b81fbc671cb651ccdbabf Mon Sep 17 00:00:00 2001 From: Michael Marchionna Date: Sun, 4 Nov 2012 11:34:10 +0800 Subject: [PATCH] * nsterm.m: Add NSClearLineFunctionKey and keypad keys. (keyDown): Remap keypad keys to X11 virtual key codes. Fixes: debbugs:8680 --- src/ChangeLog | 5 +++++ src/nsterm.m | 26 +++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e2d86b75e57..b30b2163435 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-11-04 Michael Marchionna + + * nsterm.m: Add NSClearLineFunctionKey and keypad keys (Bug#8680). + (keyDown): Remap keypad keys to X11 virtual key codes. + 2012-11-03 Paul Eggert Fix data-loss with --batch (Bug#9574). diff --git a/src/nsterm.m b/src/nsterm.m index 9b2e544c75b..e4621247854 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -100,6 +100,7 @@ static unsigned convert_ns_to_X_keysym[] = NSBeginFunctionKey, 0x58, NSSelectFunctionKey, 0x60, NSPrintFunctionKey, 0x61, + NSClearLineFunctionKey, 0x0B, NSExecuteFunctionKey, 0x62, NSInsertFunctionKey, 0x63, NSUndoFunctionKey, 0x65, @@ -144,6 +145,23 @@ static unsigned convert_ns_to_X_keysym[] = NSNewlineCharacter, 0x0D, NSEnterCharacter, 0x8D, + 0x41, 0xAE, /* KP_Decimal */ + 0x43, 0xAA, /* KP_Multiply */ + 0x45, 0xAB, /* KP_Add */ + 0x4B, 0xAF, /* KP_Divide */ + 0x4E, 0xAD, /* KP_Subtract */ + 0x51, 0xBD, /* KP_Equal */ + 0x52, 0xB0, /* KP_0 */ + 0x53, 0xB1, /* KP_1 */ + 0x54, 0xB2, /* KP_2 */ + 0x55, 0xB3, /* KP_3 */ + 0x56, 0xB4, /* KP_4 */ + 0x57, 0xB5, /* KP_5 */ + 0x58, 0xB6, /* KP_6 */ + 0x59, 0xB7, /* KP_7 */ + 0x5B, 0xB8, /* KP_8 */ + 0x5C, 0xB9, /* KP_9 */ + 0x1B, 0x1B /* escape */ }; @@ -4754,12 +4772,12 @@ not_in_argv (NSString *arg) Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); int code; unsigned fnKeysym = 0; - int flags; static NSMutableArray *nsEvArray; #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 static BOOL firstTime = YES; #endif int left_is_none; + unsigned int flags = [theEvent modifierFlags]; NSTRACE (keyDown); @@ -4810,7 +4828,10 @@ not_in_argv (NSString *arg) /* (Carbon way: [theEvent keyCode]) */ /* is it a "function key"? */ - fnKeysym = ns_convert_key (code); + fnKeysym = (code < 0x00ff && (flags&NSNumericPadKeyMask)) + ? ns_convert_key ([theEvent keyCode]) + : ns_convert_key (code); + if (fnKeysym) { /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', @@ -4823,7 +4844,6 @@ not_in_argv (NSString *arg) /* are there modifiers? */ emacs_event->modifiers = 0; - flags = [theEvent modifierFlags]; if (flags & NSHelpKeyMask) emacs_event->modifiers |= hyper_modifier; -- 2.39.5