Mercurial > emacs
changeset 48085:1c06bf924a62
(Qeql): Declare.
(Vx_keysym_table): New.
(syms_of_xterm): Initialize it.
(XTread_socket): Use it. Deal with ASCII keysyms.
(XSetIMValues) [HAVE_X11R6]: Prototype.
author | Dave Love <fx@gnu.org> |
---|---|
date | Wed, 30 Oct 2002 19:12:37 +0000 |
parents | 7853f9048269 |
children | b61109579f17 |
files | src/xterm.c |
diffstat | 1 files changed, 44 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Wed Oct 30 18:59:01 2002 +0000 +++ b/src/xterm.c Wed Oct 30 19:12:37 2002 +0000 @@ -380,7 +380,7 @@ extern Lisp_Object Vx_no_window_manager; -extern Lisp_Object Qface, Qmouse_face; +extern Lisp_Object Qface, Qmouse_face, Qeql; extern int errno; @@ -391,6 +391,7 @@ /* The keysyms to use for the various modifiers. */ Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym; +Lisp_Object Vx_keysym_table; static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value; static Lisp_Object Qvendor_specific_keysyms; @@ -8777,7 +8778,7 @@ i.e. line or page up or down. WIDGET is the Xaw scroll bar widget. CLIENT_DATA is a pointer to the scroll_bar structure for the scroll bar. CALL_DATA is an integer specifying the action that - has taken place. It's magnitude is in the range 0..height of the + has taken place. Its magnitude is in the range 0..height of the scroll bar. Negative values mean scroll towards buffer start. Values < height of scroll bar mean line-wise movement. */ @@ -10815,11 +10816,38 @@ #endif )) { + Lisp_Object c; + if (temp_index == sizeof temp_buffer / sizeof (short)) temp_index = 0; temp_buffer[temp_index++] = keysym; - bufp->kind = NON_ASCII_KEYSTROKE_EVENT; - bufp->code = keysym; + /* First deal with keysyms which have + defined translations to characters. */ + if (keysym >= 32 && keysym < 128) + /* Avoid explicitly decoding each ASCII + character. */ + { + bufp->kind = ASCII_KEYSTROKE_EVENT; + bufp->code = c; + } + else if (! EQ ((c = Fgethash (make_number (keysym), + Vx_keysym_table, + Qnil)), + Qnil)) + { + bufp->kind = (SINGLE_BYTE_CHAR_P (c) + ? ASCII_KEYSTROKE_EVENT + : MULTIBYTE_CHAR_KEYSTROKE_EVENT); + bufp->code = c; + } + else + { + /* Not a character keysym. + make_lispy_event will convert it to a + symbolic key. */ + bufp->kind = NON_ASCII_KEYSTROKE_EVENT; + bufp->code = keysym; + } XSETFRAME (bufp->frame_or_window, f); bufp->arg = Qnil; bufp->modifiers @@ -10831,7 +10859,7 @@ numchars--; } else if (numchars > nbytes) - { + { /* Raw bytes, not keysym. */ register int i; register int c; int nchars, len; @@ -12614,6 +12642,11 @@ #endif /* HAVE_X11R6 */ +#ifdef HAVE_X11R6 +/* This isn't prototyped in OSF 5.0 or 5.1a. */ +extern char *XSetIMValues P_ ((XIM, ...)); +#endif + /* Open the connection to the XIM server on display DPYINFO. RESOURCE_NAME is the resource name Emacs uses. */ @@ -12640,7 +12673,6 @@ #ifdef HAVE_X11R6 destroy.callback = xim_destroy_callback; destroy.client_data = (XPointer)dpyinfo; - /* This isn't prototyped in OSF 5.0. */ XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); #endif } @@ -15362,6 +15394,12 @@ default is nil, which is the same as `super'. */); Vx_super_keysym = Qnil; + DEFVAR_LISP ("x-keysym-table", &Vx_keysym_table, + doc: /* Hash table of character codes indexed by X keysym codes. */); + Vx_keysym_table = make_hash_table (Qeql, make_number (900), + make_float (DEFAULT_REHASH_SIZE), + make_float (DEFAULT_REHASH_THRESHOLD), + Qnil, Qnil, Qnil); } #endif /* HAVE_X_WINDOWS */