[gtk/gtk-4-6: 3/15] gtktext: Avoid early IM reset on updates




commit c4f53588263609fa4c8c01eebe88613fcb88ef4a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Sep 6 21:38:35 2022 +0200

    gtktext: Avoid early IM reset on updates
    
    Resetting the IM on IM updates is too eager and indeed the simple
    IM context doesn't like that this happens in the middle of dead
    key handling.
    
    We however want to reset the IM after actual text buffer changes
    (say, a committed string) moved the cursor position, altered the
    surrounding text, etc. So that the IM implementation does know to
    update its state.
    
    Fixes: 9e29739e66 ("gtktext: Shuffle the places doing IM reset")
    Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133

 gtk/gtktext.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 14e2e920d8..348f968466 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1946,7 +1946,7 @@ gtk_text_init (GtkText *self)
   g_signal_connect (priv->key_controller, "key-pressed",
                     G_CALLBACK (gtk_text_key_controller_key_pressed), self);
   g_signal_connect_swapped (priv->key_controller, "im-update",
-                            G_CALLBACK (gtk_im_context_reset), priv->im_context);
+                            G_CALLBACK (gtk_text_schedule_im_reset), self);
   gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller),
                                            priv->im_context);
   gtk_widget_add_controller (GTK_WIDGET (self), priv->key_controller);
@@ -4276,6 +4276,7 @@ gtk_text_commit_cb (GtkIMContext *context,
     {
       gtk_text_enter_text (self, str);
       gtk_text_obscure_mouse_cursor (self);
+      gtk_im_context_reset (context);
     }
 }
 


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