aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-02-19 09:18:27 +0800
committerPo Lu2022-02-19 09:18:27 +0800
commit02bca34852b1f9dd2b3e5364274452d377686f6a (patch)
tree28d56d2d80fdcf949c051bd39f31da3a7e2ba1f4 /src
parent51e51ce2df46fc0c6e17a97e74b00366bb9c09d8 (diff)
downloademacs-02bca34852b1f9dd2b3e5364274452d377686f6a.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/gtkutil.c28
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,
6095{ 6095{
6096 struct frame *f = user_data; 6096 struct frame *f = user_data;
6097 struct input_event ie; 6097 struct input_event ie;
6098 gunichar *ucs4_str;
6099 6098
6100 ucs4_str = g_utf8_to_ucs4_fast (str, -1, NULL); 6099 EVENT_INIT (ie);
6100 ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
6101 ie.arg = build_unibyte_string (str);
6102 XSETFRAME (ie.frame_or_window, f);
6103 ie.modifiers = 0;
6104 ie.timestamp = 0;
6101 6105
6102 if (!ucs4_str) 6106 kbd_buffer_store_event (&ie);
6103 return;
6104
6105 for (gunichar *c = ucs4_str; *c; c++)
6106 {
6107 EVENT_INIT (ie);
6108 ie.kind = (SINGLE_BYTE_CHAR_P (*c)
6109 ? ASCII_KEYSTROKE_EVENT
6110 : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
6111 ie.arg = Qnil;
6112 ie.code = *c;
6113 XSETFRAME (ie.frame_or_window, f);
6114 ie.modifiers = 0;
6115 ie.timestamp = 0;
6116
6117 kbd_buffer_store_event (&ie);
6118 }
6119
6120 g_free (ucs4_str);
6121} 6107}
6122 6108
6123static void 6109static void