From fc00381d306400977c7c83e564a7eb552cc8250d Mon Sep 17 00:00:00 2001 From: Joanmarie Diggs Date: Mon, 9 Jun 2014 18:31:19 -0400 Subject: [PATCH] GtkEntryAccessible: Emit signal after insertion The signal needs to be emitted after the text insertion as at-spi gets the text to compute the inserted text due to the AtkText::insert-text signal not containing it. Also adjust position to reflect changes to the offsets. https://bugzilla.gnome.org/show_bug.cgi?id=731429 --- gtk/a11y/gtkentryaccessible.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c index c19be104ba..599f8cfe2d 100644 --- a/gtk/a11y/gtkentryaccessible.c +++ b/gtk/a11y/gtkentryaccessible.c @@ -456,7 +456,7 @@ gtk_entry_accessible_initialize (AtkObject *obj, gtk_entry_accessible->priv->selection_bound = start_pos; /* Set up signal callbacks */ - g_signal_connect (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL); + g_signal_connect_after (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL); g_signal_connect (entry, "delete-text", G_CALLBACK (delete_text_cb), NULL); if (gtk_entry_get_visibility (entry)) @@ -1390,16 +1390,18 @@ insert_text_cb (GtkEditable *editable, gint *position) { GtkEntryAccessible *accessible; + gint length; if (new_text_length == 0) return; accessible = GTK_ENTRY_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (editable))); + length = g_utf8_strlen (new_text, new_text_length); g_signal_emit_by_name (accessible, "text-changed::insert", - *position, - g_utf8_strlen (new_text, new_text_length)); + *position - length, + length); } /* We connect to GtkEditable::delete-text, since it carries