diff options
author | Po Lu <luangruo@yahoo.com> | 2022-02-19 09:18:27 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-02-19 09:18:27 +0800 |
commit | 02bca34852b1f9dd2b3e5364274452d377686f6a (patch) | |
tree | 28d56d2d80fdcf949c051bd39f31da3a7e2ba1f4 | |
parent | 51e51ce2df46fc0c6e17a97e74b00366bb9c09d8 (diff) | |
download | emacs-02bca34852b1f9dd2b3e5364274452d377686f6a.tar.gz emacs-02bca34852b1f9dd2b3e5364274452d377686f6a.tar.bz2 emacs-02bca34852b1f9dd2b3e5364274452d377686f6a.zip |
Utilize new string decoding feature in GTK native input
* src/gtkutil.c (xg_im_context_commit): Don't decode strings
manually using g_utf8_to_ucs4 but pass unibyte string as the
keystroke event arg instead.
-rw-r--r-- | src/gtkutil.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 5e41863c0ae..bed983c77e3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -6095,29 +6095,15 @@ xg_im_context_commit (GtkIMContext *imc, gchar *str, { struct frame *f = user_data; struct input_event ie; - gunichar *ucs4_str; - ucs4_str = g_utf8_to_ucs4_fast (str, -1, NULL); + EVENT_INIT (ie); + ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; + ie.arg = build_unibyte_string (str); + XSETFRAME (ie.frame_or_window, f); + ie.modifiers = 0; + ie.timestamp = 0; - if (!ucs4_str) - return; - - for (gunichar *c = ucs4_str; *c; c++) - { - EVENT_INIT (ie); - ie.kind = (SINGLE_BYTE_CHAR_P (*c) - ? ASCII_KEYSTROKE_EVENT - : MULTIBYTE_CHAR_KEYSTROKE_EVENT); - ie.arg = Qnil; - ie.code = *c; - XSETFRAME (ie.frame_or_window, f); - ie.modifiers = 0; - ie.timestamp = 0; - - kbd_buffer_store_event (&ie); - } - - g_free (ucs4_str); + kbd_buffer_store_event (&ie); } static void |