[gtk/gtk-3-24: 4/9] gtkentry: Avoid early IM reset on updates
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 4/9] gtkentry: Avoid early IM reset on updates
- Date: Thu, 6 Oct 2022 10:57:36 +0000 (UTC)
commit 7b1f9a3b083e170849bc94d4a5da01367ee27d0d
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Sep 6 21:38:35 2022 +0200
gtkentry: 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.
gtk/gtkentry.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 12974d6f26..d26f4de176 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4897,7 +4897,7 @@ gtk_entry_key_press (GtkWidget *widget,
{
if (gtk_im_context_filter_keypress (priv->im_context, event))
{
- gtk_im_context_reset (priv->im_context);
+ priv->need_im_reset = TRUE;
retval = TRUE;
goto out;
}
@@ -4939,7 +4939,7 @@ gtk_entry_key_release (GtkWidget *widget,
{
if (gtk_im_context_filter_keypress (priv->im_context, event))
{
- gtk_im_context_reset (priv->im_context);
+ priv->need_im_reset = TRUE;
retval = TRUE;
goto out;
}
@@ -6082,7 +6082,10 @@ gtk_entry_commit_cb (GtkIMContext *context,
GtkEntryPrivate *priv = entry->priv;
if (priv->editable)
- gtk_entry_enter_text (entry, str);
+ {
+ gtk_entry_enter_text (entry, str);
+ gtk_im_context_reset (context);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]