[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: change in X character input processing
From: |
Stefan Monnier |
Subject: |
Re: change in X character input processing |
Date: |
Fri, 01 Nov 2002 14:53:39 -0500 |
The new code you installed works very differently from the one you had before.
Now your x-keysym-table overrides the usual XmbLookupString+decode process
This means that when you do
address@hidden emacs -q --no-site-file
with your code an eacute will insert a latin-1 eacute whereas with
the previous code it inserted a latin-9 eacute.
I'm not sure we want to do that just now.
I suggest we revert to the code you had before, so that the
XmbLookupString+decode is used as before and x-keysym-table is
only used if that failed (which is only the case if the key you hit
translates into a char that doesn't exist in the coding-system
corresponding to your locale, such as when you hit EuroSign in
a latin-1 locale).
The reason why I'd like to revert is that your code basically does
a form of unify-on-keyboard-input and I'm not sure that we want to do
that already since we don't have unify-on-decoding turned on by default.
I.e. I suggest the patch below (against the version before your latest fix).
See after my sig for the patch against the current version.
*** src/xterm.c 30 Oct 2002 19:12:37 -0000 1.759
--- src/xterm.c 1 Nov 2002 19:47:22 -0000
***************
*** 10821,10850 ****
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = 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;
}
--- 10822,10840 ----
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = keysym;
! if (NATNUMP (c = Fgethash (make_number (keysym),
! Vx_keysym_table,
! Qnil)))
{
! bufp->code = XFASTINT (c);
! bufp->kind = (SINGLE_BYTE_CHAR_P (bufp->code)
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
}
else
{
! /* Not a character keysym. make_lispy_event
! will convert it to a symbolic key. */
bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
bufp->code = keysym;
}
As you can see all it does is remove the ASCII handling (because it
basically can't happen here and because it uses variable `c' before
it's initialized) and fixes some int/Lisp_Object mixup (and uses NATNUMP
rather then EQ (..., Qnil)).
Stefan
Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.760
diff -c -r1.760 xterm.c
*** src/xterm.c 31 Oct 2002 17:59:30 -0000 1.760
--- src/xterm.c 1 Nov 2002 19:45:01 -0000
***************
*** 10738,10871 ****
if (numchars > 1)
{
! Lisp_Object c;
!
! /* 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 = keysym;
! XSETFRAME (bufp->frame_or_window, f);
! bufp->arg = Qnil;
! bufp->modifiers
! = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
! modifiers);
! bufp->timestamp = event.xkey.time;
! bufp++;
! count++;
! numchars--;
! }
! /* Now non-ASCII. */
! 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;
! XSETFRAME (bufp->frame_or_window, f);
! bufp->arg = Qnil;
! bufp->modifiers
! = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
! modifiers);
! bufp->timestamp = event.xkey.time;
! bufp++;
! count++;
! numchars--;
! }
! /* Random non-modifier sorts of keysyms. */
! else if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
! || keysym == XK_Delete
#ifdef XK_ISO_Left_Tab
! || (keysym >= XK_ISO_Left_Tab
! && keysym <= XK_ISO_Enter)
#endif
! || IsCursorKey (keysym) /* 0xff50 <= x < 0xff60
*/
! || IsMiscFunctionKey (keysym) /* 0xff60 <= x <
VARIES */
#ifdef HPUX
! /* This recognizes the "extended function
! keys". It seems there's no cleaner way.
! Test IsModifierKey to avoid handling
! mode_switch incorrectly. */
! || ((unsigned) (keysym) >= XK_Select
! && (unsigned)(keysym) < XK_KP_Space)
#endif
#ifdef XK_dead_circumflex
! || orig_keysym == XK_dead_circumflex
#endif
#ifdef XK_dead_grave
! || orig_keysym == XK_dead_grave
#endif
#ifdef XK_dead_tilde
! || orig_keysym == XK_dead_tilde
#endif
#ifdef XK_dead_diaeresis
! || orig_keysym == XK_dead_diaeresis
#endif
#ifdef XK_dead_macron
! || orig_keysym == XK_dead_macron
#endif
#ifdef XK_dead_degree
! || orig_keysym == XK_dead_degree
#endif
#ifdef XK_dead_acute
! || orig_keysym == XK_dead_acute
#endif
#ifdef XK_dead_cedilla
! || orig_keysym == XK_dead_cedilla
#endif
#ifdef XK_dead_breve
! || orig_keysym == XK_dead_breve
#endif
#ifdef XK_dead_ogonek
! || orig_keysym == XK_dead_ogonek
#endif
#ifdef XK_dead_caron
! || orig_keysym == XK_dead_caron
#endif
#ifdef XK_dead_doubleacute
! || orig_keysym == XK_dead_doubleacute
#endif
#ifdef XK_dead_abovedot
! || orig_keysym == XK_dead_abovedot
#endif
! || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe
*/
! || IsFunctionKey (keysym) /* 0xffbe <= x <
0xffe1 */
! /* Any "vendor-specific" key is ok. */
! || (orig_keysym & (1 << 28))
! || (keysym != NoSymbol && nbytes == 0))
! && ! (IsModifierKey (orig_keysym)
#ifndef HAVE_X11R5
#ifdef XK_Mode_switch
! || ((unsigned)(orig_keysym) ==
XK_Mode_switch)
#endif
#ifdef XK_Num_Lock
! || ((unsigned)(orig_keysym) == XK_Num_Lock)
#endif
#endif /* not HAVE_X11R5 */
! /* The symbols from XK_ISO_Lock
! to XK_ISO_Last_Group_Lock
! don't have real modifiers but
! should be treated similarly to
! Mode_switch by Emacs. */
#if defined XK_ISO_Lock && defined XK_ISO_Last_Group_Lock
! || ((unsigned)(orig_keysym)
! >= XK_ISO_Lock
! && (unsigned)(orig_keysym)
! <= XK_ISO_Last_Group_Lock)
#endif
! ))
{
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = keysym;
! /* make_lispy_event will convert this to a symbolic
! key. */
! bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
! bufp->code = keysym;
XSETFRAME (bufp->frame_or_window, f);
bufp->arg = Qnil;
bufp->modifiers
--- 10738,10843 ----
if (numchars > 1)
{
! if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
! || keysym == XK_Delete
#ifdef XK_ISO_Left_Tab
! || (keysym >= XK_ISO_Left_Tab && keysym <=
XK_ISO_Enter)
#endif
! || (keysym >= XK_Kanji && keysym <= XK_Eisu_toggle)
! || IsCursorKey (keysym) /* 0xff50 <= x < 0xff60 */
! || IsMiscFunctionKey (keysym) /* 0xff60 <= x <
VARIES */
#ifdef HPUX
! /* This recognizes the "extended function keys".
! It seems there's no cleaner way.
! Test IsModifierKey to avoid handling mode_switch
! incorrectly. */
! || ((unsigned) (keysym) >= XK_Select
! && (unsigned)(keysym) < XK_KP_Space)
#endif
#ifdef XK_dead_circumflex
! || orig_keysym == XK_dead_circumflex
#endif
#ifdef XK_dead_grave
! || orig_keysym == XK_dead_grave
#endif
#ifdef XK_dead_tilde
! || orig_keysym == XK_dead_tilde
#endif
#ifdef XK_dead_diaeresis
! || orig_keysym == XK_dead_diaeresis
#endif
#ifdef XK_dead_macron
! || orig_keysym == XK_dead_macron
#endif
#ifdef XK_dead_degree
! || orig_keysym == XK_dead_degree
#endif
#ifdef XK_dead_acute
! || orig_keysym == XK_dead_acute
#endif
#ifdef XK_dead_cedilla
! || orig_keysym == XK_dead_cedilla
#endif
#ifdef XK_dead_breve
! || orig_keysym == XK_dead_breve
#endif
#ifdef XK_dead_ogonek
! || orig_keysym == XK_dead_ogonek
#endif
#ifdef XK_dead_caron
! || orig_keysym == XK_dead_caron
#endif
#ifdef XK_dead_doubleacute
! || orig_keysym == XK_dead_doubleacute
#endif
#ifdef XK_dead_abovedot
! || orig_keysym == XK_dead_abovedot
#endif
! || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
! || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
! /* Any "vendor-specific" key is ok. */
! || (orig_keysym & (1 << 28))
! || (keysym != NoSymbol && nbytes == 0))
! && ! (IsModifierKey (orig_keysym)
#ifndef HAVE_X11R5
#ifdef XK_Mode_switch
! || ((unsigned)(orig_keysym) == XK_Mode_switch)
#endif
#ifdef XK_Num_Lock
! || ((unsigned)(orig_keysym) == XK_Num_Lock)
#endif
#endif /* not HAVE_X11R5 */
! /* The symbols from XK_ISO_Lock to
! XK_ISO_Last_Group_Lock doesn't have real
! modifiers but should be treated similarly
! to Mode_switch by Emacs. */
#if defined XK_ISO_Lock && defined XK_ISO_Last_Group_Lock
! || ((unsigned)(orig_keysym) >= XK_ISO_Lock
! && (unsigned)(orig_keysym) <=
XK_ISO_Last_Group_Lock)
#endif
! ))
{
+ Lisp_Object c;
+
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
temp_buffer[temp_index++] = keysym;
! if (NATNUMP (c = Fgethash (make_number (keysym),
! Vx_keysym_table,
! Qnil)))
! {
! bufp->code = XFASTINT (c);
! bufp->kind = (SINGLE_BYTE_CHAR_P (bufp->code)
! ? ASCII_KEYSTROKE_EVENT
! : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
! }
! 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
***************
*** 10877,10883 ****
numchars--;
}
else if (numchars > nbytes)
! { /* Raw bytes, not keysym. */
register int i;
register int c;
int nchars, len;
--- 10849,10855 ----
numchars--;
}
else if (numchars > nbytes)
! {
register int i;
register int c;
int nchars, len;
- Re: change in X character input processing, Dave Love, 2002/11/01
- Re: change in X character input processing, Stefan Monnier, 2002/11/01
- Re: change in X character input processing,
Stefan Monnier <=
- Re: change in X character input processing, Dave Love, 2002/11/02
- Re: change in X character input processing, Stefan Monnier, 2002/11/02
- Re: change in X character input processing, Dave Love, 2002/11/06
- Re: change in X character input processing, Stefan Monnier, 2002/11/06
- Re: change in X character input processing, Kim F. Storm, 2002/11/07
- Re: change in X character input processing, Dave Love, 2002/11/11
- Re: change in X character input processing, Dave Love, 2002/11/11
- Re: change in X character input processing, Stefan Monnier, 2002/11/11