emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3dfefb8bb4: Fix native GTK input for cyrillic input methods


From: Po Lu
Subject: master 3dfefb8bb4: Fix native GTK input for cyrillic input methods
Date: Sun, 9 Jan 2022 05:17:12 -0500 (EST)

branch: master
commit 3dfefb8bb4d99ea67b576bf177804dd386159874
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/gtkutil.c | 21 +++++++++++++++++++--
 src/xterm.c   |  2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index c62bd898fb..5ed871a822 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -6118,6 +6118,7 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent 
*event,
   gunichar *cb;
   ptrdiff_t i;
   glong len;
+  gunichar uc;
 
   FOR_EACH_FRAME (tail, tem)
     {
@@ -6216,8 +6217,7 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent 
*event,
        || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
        || IsFunctionKey (keysym)       /* 0xffbe <= x < 0xffe1 */
        /* Any "vendor-specific" key is ok.  */
-       || (keysym & (1 << 28))
-       || (keysym != GDK_KEY_VoidSymbol && !event->key.string))
+       || (keysym & (1 << 28)))
       && !(event->key.is_modifier))
     {
       inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
@@ -6243,6 +6243,23 @@ xg_widget_key_press_event_cb (GtkWidget *widget, 
GdkEvent *event,
 
       inev.ie.kind = NO_EVENT;
     }
+  else
+    {
+      uc = gdk_keyval_to_unicode (keysym);
+
+      if (uc)
+       {
+         inev.ie.kind = (SINGLE_BYTE_CHAR_P (uc)
+                         ? ASCII_KEYSTROKE_EVENT
+                         : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+         inev.ie.code = uc;
+       }
+      else
+       {
+         inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
+         inev.ie.code = keysym;
+       }
+    }
 
  done:
   if (inev.ie.kind != NO_EVENT)
diff --git a/src/xterm.c b/src/xterm.c
index 6a05ad9894..1c4907f7ea 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10727,7 +10727,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                goto XI_OTHER;
 #endif
 
-#ifdef HAVE_X_I18N
              XKeyPressedEvent xkey;
 
              memset (&xkey, 0, sizeof xkey);
@@ -10745,6 +10744,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              xkey.keycode = xev->detail;
              xkey.same_screen = True;
 
+#ifdef HAVE_X_I18N
 #ifdef USE_GTK
              if ((!x_gtk_use_native_input
                   && x_filter_event (dpyinfo, (XEvent *) &xkey))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]