[gtk/input-tweaks: 5/7] imcontext: Handle Escape in Compose sequence




commit b6c0155836d354dc2984c3381147f8cdd66f6325
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jul 29 08:39:17 2021 -0400

    imcontext: Handle Escape in Compose sequence
    
    Treat Escape the same in hex sequences and in
    Compose sequence: reset the state.

 gtk/gtkimcontextsimple.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 71f9094aee..8289aad7bc 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -1001,16 +1001,22 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
   
       return TRUE;
     }
-  
+
+  if (is_escape)
+    {
+      if (priv->in_hex_sequence || priv->in_compose_sequence)
+        {
+         gtk_im_context_simple_reset (context);
+         return TRUE;
+        }
+
+      return FALSE;
+    }
+
   if (priv->in_hex_sequence)
     {
       if (hex_keyval && n_compose < 6)
        priv->compose_buffer[n_compose++] = hex_keyval;
-      else if (is_escape)
-       {
-         gtk_im_context_simple_reset (context);
-         return TRUE;
-       }
       else if (!is_hex_end)
        {
          /* non-hex character in hex sequence, or sequence too long */


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