unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* More keysyms on MacOSX/Aqua
@ 2003-01-06 11:19 Benjamin Riefenstahl
  2003-01-28 19:02 ` Andrew Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Riefenstahl @ 2003-01-06 11:19 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

Hi all,


On MacOSX/Aqua, I was missing the ability to bind <s-escape>.  The
reason was that the escape key sends the ASCII ESC instead of the
keysym <escape>, and ASCII keys can not be combined with the shift key
(there is an exception for SPC in src/keyboard.c, make_lispy_event()).

The attached patch adds generation of keysyms for <tab>, <backspace>
and <escape>.  The current keysym converter does not allow to encode
<space> (and space already has that special exception anyway), so I
left that alone.

I also added some entries in function-key-map for these keys, copied
from the X11 and MS Windows files.  Is there a reason why these
mappings are not in a platform-independent file?  They are not used on
a character terminal but they don't pose a problem there either.  OTOH
they are currently maintained in three separate places for the GUI
systems.

Thirdly I cleaned up the table keycode_to_xkeysym_table a bit and
added more comments.  I can send a patch without that change if you
prefer that.

Finally it would be possible to extend the mentioned SPC exception in
make_lispy_event() to other ASCII special keys, that would achive a
similar effect, although it wouldn't be as portable.

ChangeLog:

2002-12-15  Benjamin Riefenstahl  <Benjamin.Riefenstahl@epost.de>

	* src/macterm.c (keycode_to_xkeysym_table): Add <tab>,
        <backspace>, <escape>.
        (keycode_to_xkeysym_table): Reformat and add more comments.
        (XTread_socket): Drop special case for backspace. 

        * lisp/term/mac-win.el: Add entries in function-key-map for
        [tab], [backspace], [escape]. 


so long, benny



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs.keysym.diff --]
[-- Type: text/x-patch, Size: 4803 bytes --]

Index: lisp/term/mac-win.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/term/mac-win.el,v
retrieving revision 1.13
diff -c -p -r1.13 mac-win.el
*** lisp/term/mac-win.el	4 Oct 2002 15:03:02 -0000	1.13
--- lisp/term/mac-win.el	15 Dec 2002 18:09:36 -0000
*************** ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac
*** 249,254 ****
--- 249,261 ----
  ;; Map certain keypad keys into ASCII characters that people usually expect
  (define-key function-key-map [return] [?\C-m])
  (define-key function-key-map [M-return] [?\M-\C-m])
+ (define-key function-key-map [tab] [?\t])
+ (define-key function-key-map [M-tab] [?\M-\t])
+ (define-key function-key-map [backspace] [127])
+ (define-key function-key-map [M-backspace] [?\M-\d])
+ (define-key function-key-map [escape] [?\e])
+ (define-key function-key-map [M-escape] [?\M-\e])
+ 
  ;; Tell read-char how to convert special chars to ASCII
  (put 'return 'ascii-character 13)
  
Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.27
diff -c -p -r1.27 macterm.c
*** src/macterm.c	8 Dec 2002 05:56:37 -0000	1.27
--- src/macterm.c	15 Dec 2002 18:10:09 -0000
*************** main (void)
*** 12535,12565 ****
  /* Table for translating Mac keycode to X keysym values.  Contributed
     by Sudhir Shenoy.  */
  static unsigned char keycode_to_xkeysym_table[] = {
! /* 0x00 - 0x3f */
!   0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	0, 0, 0, 0, 0, 0,
!   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
!   0, 0, 0, 0, '\x0d', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
!   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! /* 0x40 */
!   0, '\xae' /* kp. */, 0, '\xaa' /* kp* */, 
!   0, '\xab' /* kp+ */, 0, '\x7f' /* kp_clr */,
!   0, 0, 0, '\xaf' /* kp/ */,
!   '\x8d' /* kp_ent */, 0, '\xad' /* kp- */, 0,
! /* 0x50 */
!   0, '\xbd' /* kp= */, '\xb0' /* kp0 */, '\xb1' /* kp1 */,
!   '\xb2' /* kp2 */, '\xb3' /* kp3 */, '\xb4' /* kp4 */, '\xb5' /* kp5 */,
!   '\xb6' /* kp6 */, '\xb7' /* kp7 */, 0, '\xb8' /* kp8 */,
!   '\xb9' /* kp9 */, 0, 0, 0,
! /* 0x60 */
!   '\xc2' /* F5 */, '\xc3' /* F6 */, '\xc4' /* F7 */, '\xc0' /* F3 */,
!   '\xc5' /* F8 */, '\xc6' /* F9 */, 0, '\xc8' /* F11 */, 
!   0, '\xca' /* F13 */, 0, '\xcb' /* F14 */, 
!   0, '\xc7' /* F10 */, 0, '\xc9' /* F12 */,   
! /* 0x70 */
!   0, '\xcc' /* F15 */, '\x9e' /* ins */, '\x95' /* home */,
!   '\x9a' /* pgup */, '\x9f' /* del */, '\xc1' /* F4 */, '\x9c' /* end */,
!   '\xbf' /* F2 */, '\x9b' /* pgdown */, '\xbe' /* F1 */, '\x51' /* left */,
!   '\x53' /* right */, '\x54' /* down */, '\x52' /* up */, 0
  };
  
  static int
--- 12535,12568 ----
  /* Table for translating Mac keycode to X keysym values.  Contributed
     by Sudhir Shenoy.  */
  static unsigned char keycode_to_xkeysym_table[] = {
!   /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
!   /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
!   /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 
!   /*0x30*/ 0x09 /*tab*/, 0 /*0x0020 space*/, 0, 0x08 /*backspace*/,
!   /*0x34*/ 0, 0x1b /*escape*/, 0, 0,
!   /*0x38*/ 0, 0, 0, 0,
!   /*0x3C*/ 0, 0, 0, 0,
! 
!   /*0x40*/ 0, 0xae /*kp-.*/, 0, 0xaa /*kp-**/, 
!   /*0x44*/ 0, 0xab /*kp-+*/, 0, 0x7f /*kp-clear*/,
!   /*0x48*/ 0, 0, 0, 0xaf /*kp-/*/,
!   /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp--*/, 0,
! 
!   /*0x50*/ 0, 0xbd /*kp-=*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
!   /*0x54*/ 0xb2 /*kp-2*/, 0xb3 /*kp-3*/, 0xb4 /*kp-4*/, 0xb5 /*kp-5*/,
!   /*0x58*/ 0xb6 /*kp-6*/, 0xb7 /*kp-7*/, 0, 0xb8 /*kp-8*/,
!   /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0,
! 
!   /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/,
!   /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, 
!   /*0x68*/ 0, 0xca /*f13*/, 0, 0xcb /*f14*/, 
!   /*0x6C*/ 0, 0xc7 /*f10*/, 0, 0xc9 /*f12*/,
! 
!   /*0x70*/ 0, 0xcc /*f15*/, 0x9e /*insert (or 0x6a==help)*/, 0x95 /*home*/,
!   /*0x74*/ 0x9a /*pgup*/, 0x9f /*delete*/, 0xc1 /*f4*/, 0x9c /*end*/,
!   /*0x78*/ 0xbf /*f2*/, 0x9b /*pgdown*/, 0xbe /*f1*/, 0x51 /*left*/,
!   /*0x7C*/ 0x53 /*right*/, 0x54 /*down*/, 0x52 /*up*/, 0
  };
  
  static int
*************** XTread_socket (int sd, struct input_even
*** 12921,12932 ****
  	  
  	  ObscureCursor ();
  	  
! 	  if (keycode == 0x33)  /* delete key (charCode translated to 0x8) */
! 	    {
! 	      bufp->code = 0x7f;
! 	      bufp->kind = ASCII_KEYSTROKE_EVENT;
! 	    }
! 	  else if (keycode_to_xkeysym (keycode, &xkeysym))
  	    {
  	      bufp->code = 0xff00 | xkeysym;
  	      bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
--- 12924,12930 ----
  	  
  	  ObscureCursor ();
  	  
! 	  if (keycode_to_xkeysym (keycode, &xkeysym))
  	    {
  	      bufp->code = 0xff00 | xkeysym;
  	      bufp->kind = NON_ASCII_KEYSTROKE_EVENT;

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: More keysyms on MacOSX/Aqua
  2003-01-06 11:19 More keysyms on MacOSX/Aqua Benjamin Riefenstahl
@ 2003-01-28 19:02 ` Andrew Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Choi @ 2003-01-28 19:02 UTC (permalink / raw)
  Cc: emacs-devel

Benjamin Riefenstahl <benjamin.riefenstahl@epost.de> writes:

> [...] The attached patch adds generation of keysyms for <tab>,
> <backspace> and <escape>.  The current keysym converter does not allow
> to encode <space> (and space already has that special exception
> anyway), so I left that alone.  [...]

I've just tested and checked in this patch.  Thank you for your
contribution, Benny.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-28 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-06 11:19 More keysyms on MacOSX/Aqua Benjamin Riefenstahl
2003-01-28 19:02 ` Andrew Choi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).