From: Carlos Garnacho Date: Tue, 6 Sep 2022 19:38:35 +0000 (+0200) Subject: gtktext: Avoid early IM reset on updates X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~2^2~21^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=085374198fdf6a66e5cadd4dd07cca79e5243839;p=gtk4.git 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 --- 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); } }