[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 919cb31: Fix XI2 keysym translation
From: |
Po Lu |
Subject: |
master 919cb31: Fix XI2 keysym translation |
Date: |
Mon, 22 Nov 2021 20:04:52 -0500 (EST) |
branch: master
commit 919cb31cf7f2aec2d8134783b0a5bb93a621fcaf
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix XI2 keysym translation
* src/xterm.c (handle_one_xevent): Handle XI_KeyPress events
that can't be translated into strings.
---
src/xterm.c | 53 +++++++++++++++++++----------------------------------
1 file changed, 19 insertions(+), 34 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 197776c..11e7e60 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10324,7 +10324,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
memset (&xkey, 0, sizeof xkey);
xkey.type = KeyPress;
- xkey.serial = 0;
+ xkey.serial = xev->serial;
xkey.send_event = xev->send_event;
xkey.display = xev->display;
xkey.window = xev->event;
@@ -10439,53 +10439,38 @@ handle_one_xevent (struct x_display_info *dpyinfo,
emacs_abort ();
}
else
- {
#endif
+ {
#ifdef HAVE_XKB
int overflow = 0;
KeySym sym = keysym;
if (dpyinfo->xkb_desc)
{
- if (!(nbytes = XkbTranslateKeySym (dpyinfo->display,
&sym,
- state &
~mods_rtrn, copy_bufptr,
- copy_bufsiz,
&overflow)))
- goto XI_OTHER;
- }
- else
-#else
- {
- block_input ();
- char *str = XKeysymToString (keysym);
- if (!str)
+ nbytes = XkbTranslateKeySym (dpyinfo->display, &sym,
+ state & ~mods_rtrn,
copy_bufptr,
+ copy_bufsiz, &overflow);
+ if (overflow)
{
- unblock_input ();
- goto XI_OTHER;
+ copy_bufptr = alloca ((copy_bufsiz += overflow)
+ * sizeof *copy_bufptr);
+ overflow = 0;
+ nbytes = XkbTranslateKeySym (dpyinfo->display,
&sym,
+ state & ~mods_rtrn,
copy_bufptr,
+ copy_bufsiz,
&overflow);
+
+ if (overflow)
+ nbytes = 0;
}
- nbytes = strlen (str) + 1;
- copy_bufptr = alloca (nbytes);
- strcpy (copy_bufptr, str);
- unblock_input ();
}
+ else
#endif
-#ifdef HAVE_XKB
- if (overflow)
{
- overflow = 0;
- copy_bufptr = alloca (copy_bufsiz + overflow);
- keysym = sym;
- if (!(nbytes = XkbTranslateKeySym (dpyinfo->display,
&sym,
- state &
~mods_rtrn, copy_bufptr,
- copy_bufsiz +
overflow, &overflow)))
- goto XI_OTHER;
-
- if (overflow)
- goto XI_OTHER;
+ nbytes = XLookupString (&xkey, copy_bufptr,
+ copy_bufsiz, &keysym,
+ &compose_status);
}
-#endif
-#ifdef HAVE_X_I18N
}
-#endif
/* First deal with keysyms which have defined
translations to characters. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 919cb31: Fix XI2 keysym translation,
Po Lu <=