aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-01-09 18:14:26 +0800
committerPo Lu2022-01-09 18:16:46 +0800
commit3dfefb8bb4d99ea67b576bf177804dd386159874 (patch)
tree0d325f891e5068754deff844ab0e17738861f182
parent262a7c9ea0e9702cadd71146d2c9af8c75bdab35 (diff)
downloademacs-3dfefb8bb4d99ea67b576bf177804dd386159874.tar.gz
emacs-3dfefb8bb4d99ea67b576bf177804dd386159874.zip
Fix native GTK input for cyrillic input methods
* src/gtkutil.c (xg_widget_key_press_cb): Get unicode mapping of keyval if string doesn't exist. * src/xterm.c (handle_one_xevent): Fix build without HAVE_X_I18N.
-rw-r--r--src/gtkutil.c21
-rw-r--r--src/xterm.c2
2 files changed, 20 insertions, 3 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index c62bd898fb5..5ed871a8226 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -6118,6 +6118,7 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
6118 gunichar *cb; 6118 gunichar *cb;
6119 ptrdiff_t i; 6119 ptrdiff_t i;
6120 glong len; 6120 glong len;
6121 gunichar uc;
6121 6122
6122 FOR_EACH_FRAME (tail, tem) 6123 FOR_EACH_FRAME (tail, tem)
6123 { 6124 {
@@ -6216,8 +6217,7 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
6216 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */ 6217 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
6217 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */ 6218 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
6218 /* Any "vendor-specific" key is ok. */ 6219 /* Any "vendor-specific" key is ok. */
6219 || (keysym & (1 << 28)) 6220 || (keysym & (1 << 28)))
6220 || (keysym != GDK_KEY_VoidSymbol && !event->key.string))
6221 && !(event->key.is_modifier)) 6221 && !(event->key.is_modifier))
6222 { 6222 {
6223 inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT; 6223 inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
@@ -6243,6 +6243,23 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
6243 6243
6244 inev.ie.kind = NO_EVENT; 6244 inev.ie.kind = NO_EVENT;
6245 } 6245 }
6246 else
6247 {
6248 uc = gdk_keyval_to_unicode (keysym);
6249
6250 if (uc)
6251 {
6252 inev.ie.kind = (SINGLE_BYTE_CHAR_P (uc)
6253 ? ASCII_KEYSTROKE_EVENT
6254 : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
6255 inev.ie.code = uc;
6256 }
6257 else
6258 {
6259 inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
6260 inev.ie.code = keysym;
6261 }
6262 }
6246 6263
6247 done: 6264 done:
6248 if (inev.ie.kind != NO_EVENT) 6265 if (inev.ie.kind != NO_EVENT)
diff --git a/src/xterm.c b/src/xterm.c
index 6a05ad98949..1c4907f7eaa 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10727,7 +10727,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
10727 goto XI_OTHER; 10727 goto XI_OTHER;
10728#endif 10728#endif
10729 10729
10730#ifdef HAVE_X_I18N
10731 XKeyPressedEvent xkey; 10730 XKeyPressedEvent xkey;
10732 10731
10733 memset (&xkey, 0, sizeof xkey); 10732 memset (&xkey, 0, sizeof xkey);
@@ -10745,6 +10744,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
10745 xkey.keycode = xev->detail; 10744 xkey.keycode = xev->detail;
10746 xkey.same_screen = True; 10745 xkey.same_screen = True;
10747 10746
10747#ifdef HAVE_X_I18N
10748#ifdef USE_GTK 10748#ifdef USE_GTK
10749 if ((!x_gtk_use_native_input 10749 if ((!x_gtk_use_native_input
10750 && x_filter_event (dpyinfo, (XEvent *) &xkey)) 10750 && x_filter_event (dpyinfo, (XEvent *) &xkey))