From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Marchionna Newsgroups: gmane.emacs.bugs Subject: bug#8680: nsterm.m does not distinguish key on the key pad Date: Tue, 17 May 2011 10:34:01 -0700 Message-ID: <93A6F1F6-C459-48BB-B9FB-956653A09D51@pacbell.net> References: <625A3C9C-ACF2-42A0-B4E8-8ABDDA060131@pacbell.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1305653713 11738 80.91.229.12 (17 May 2011 17:35:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 May 2011 17:35:13 +0000 (UTC) To: 8680@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 17 19:35:09 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QMOAl-0007xv-JE for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 May 2011 19:35:07 +0200 Original-Received: from localhost ([::1]:60452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMOAl-0004e9-4x for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 May 2011 13:35:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMOAh-0004cf-Rj for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 13:35:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMOAg-0007wQ-Nz for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 13:35:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMOAg-0007wG-Gv for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 13:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QMOAf-0005aV-PV; Tue, 17 May 2011 13:35:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <625A3C9C-ACF2-42A0-B4E8-8ABDDA060131@pacbell.net> Resent-From: Michael Marchionna Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 May 2011 17:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8680 X-GNU-PR-Package: emacs,ns X-GNU-PR-Keywords: Original-Received: via spool by 8680-submit@debbugs.gnu.org id=B8680.130565365121418 (code B ref 8680); Tue, 17 May 2011 17:35:01 +0000 Original-Received: (at 8680) by debbugs.gnu.org; 17 May 2011 17:34:11 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMO9r-0005ZO-9p for submit@debbugs.gnu.org; Tue, 17 May 2011 13:34:11 -0400 Original-Received: from nm22.access.bullet.mail.sp2.yahoo.com ([98.139.44.149]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QMO9p-0005ZC-HT for 8680@debbugs.gnu.org; Tue, 17 May 2011 13:34:10 -0400 Original-Received: from [98.139.44.103] by nm22.access.bullet.mail.sp2.yahoo.com with NNFMP; 17 May 2011 17:34:03 -0000 Original-Received: from [98.139.44.70] by tm8.access.bullet.mail.sp2.yahoo.com with NNFMP; 17 May 2011 17:34:03 -0000 Original-Received: from [127.0.0.1] by omp1007.access.mail.sp2.yahoo.com with NNFMP; 17 May 2011 17:34:03 -0000 X-Yahoo-Newman-Id: 406132.60078.bm@omp1007.access.mail.sp2.yahoo.com Original-Received: (qmail 35579 invoked from network); 17 May 2011 17:34:02 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-Mailer; b=FZAFf3a5iKS/PZmFKoYistvIzUF/4hMUQdvqjKBo0KNujWXqpziLq7etnevtG48wK5DxqwfTWMb7TiXO7crT5RA/g7WPPnfJbl7b9IW+u2os+sNcYOunCg85GqqIDn8cVaZcaYar9S/IEwxH6AjG4hnBAHp2Wu+cshLLDI/wuRo= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pacbell.net; s=s1024; t=1305653642; bh=cKhVdStDeZ3MgVtIS9nzvzvKwOgl2a5tpKzDpzHrcek=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-Mailer; b=2GAG118ofOM2V33gMF/xnnSjNctVfS1azEyFNvDYto1GPSoPcHu8ExtIhhV4aRMwCIY4UF5qxUMl5/mK1jglyLQmyEonR3JhW8sdnNQo2PZFvwzAa7GDnH68GZ0mqU2JxTPikicqPClqHW+AKD72oLWE/UOqnkNSOaFbLfsOHrk= Original-Received: from morbo.el-rayo-x.foo (tralfaz@216.101.161.154 with plain) by smtp101.sbc.mail.ne1.yahoo.com with SMTP; 17 May 2011 10:34:02 -0700 PDT X-Yahoo-SMTP: uVslrc.swBAsbr9qUoHctqw_w91g6l3qy9ZsMsYbaY4- X-YMail-OSG: nVDIhNkVM1kYOPI4KPXDzMAJ3DAxGeOQkjYO7ezk5D1gzo9 Zct9kS4p_vVwWW26UYcyTOTdil6_p8XajslFb_E.aWM5W8C54cvCCkRsrY7U 8NLNdbv12jtskmwpTcc8FVgEFMKDxOvz6mqIBYp3pdUM6WWdaBv3V.Gn2Rch bm4CYyRW9qj26YxFgqOYvoA0GHOQm3quvHdAAHjriv46cZ9ZJDGuv84REOLC eGubVAD1al.LkegkD0FlkUwJFJJzevxUmS4Dv2ygLDy852O4eVHgbJPxynrM 2U.OhpjoilJHmYaGpuUu3_DALhtZMs9.Du4do5hx8uReGqaJ7agorftgHCXw OsugqHqSNVcoTmzoMTvz7c5oo.h36g7pjfOLu0uk- X-Yahoo-Newman-Property: ymail-3 X-Mailer: Apple Mail (2.1084) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 17 May 2011 13:35:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46519 Archived-At: In addition to the clear/NumLock key not being mapped the rest of the = keypad keys do not seem to be translated as well, and hence can not be distinguished from keys on the = main keyboard. What follows is a patch that remaps the keypad keys. at least on a aluminum apple = keyboard, to the appropriate X11 virtual key codes. Note the Clear/NumLock key is hardcoded to = XK_Clear. There should probably be a way to make it possible to configure it so that it translates to = XK_Num_Lock. diff --git a/src/nsterm.m b/src/nsterm.m index 91f0cbb..322c9d9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -87,6 +87,7 @@ static unsigned convert_ns_to_X_keysym[] =3D NSBeginFunctionKey, 0x58, NSSelectFunctionKey, 0x60, NSPrintFunctionKey, 0x61, + NSClearLineFunctionKey, 0x0B, NSExecuteFunctionKey, 0x62, NSInsertFunctionKey, 0x63, NSUndoFunctionKey, 0x65, @@ -131,7 +132,24 @@ static unsigned convert_ns_to_X_keysym[] =3D NSNewlineCharacter, 0x0D, NSEnterCharacter, 0x8D, =20 - 0x1B, 0x1B /* escape */ + 0x1B, 0x1B, /* escape */ + + 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 */ }; =20 =20 @@ -4503,10 +4521,10 @@ ns_term_shutdown (int sig) Mouse_HLInfo *hlinfo =3D MOUSE_HL_INFO (emacsframe); int code; unsigned fnKeysym =3D 0; - int flags; static NSMutableArray *nsEvArray; static BOOL firstTime =3D YES; int left_is_none; + unsigned int flags =3D [theEvent modifierFlags]; =20 NSTRACE (keyDown); =20 @@ -4550,9 +4568,13 @@ ns_term_shutdown (int sig) code =3D ([[theEvent charactersIgnoringModifiers] length] =3D=3D = 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: = 0]; /* (Carbon way: [theEvent keyCode]) */ + =20 =20 /* is it a "function key"? */ - fnKeysym =3D ns_convert_key (code); + if ( code < 0x00ff && (flags&NSNumericPadKeyMask) ) + fnKeysym =3D ns_convert_key([theEvent keyCode]); + else + fnKeysym =3D ns_convert_key (code); if (fnKeysym) { /* COUNTERHACK: map 'Delete' on upper-right main KB to = 'Backspace', @@ -4565,7 +4587,6 @@ ns_term_shutdown (int sig) =20 /* are there modifiers? */ emacs_event->modifiers =3D 0; - flags =3D [theEvent modifierFlags]; =20 if (flags & NSHelpKeyMask) emacs_event->modifiers |=3D hyper_modifier;=