[gtk/wip/carlosg/im-reset: 1/4] gtktext: Avoid early IM reset on updates




commit 085374198fdf6a66e5cadd4dd07cca79e5243839
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 b95d6d8c51..0e10b9e947 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1910,7 +1910,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);
@@ -4241,6 +4241,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]