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
This commit is contained in:
Joanmarie Diggs 2014-06-09 18:31:19 -04:00 committed by Benjamin Otte
parent fbc6a0c400
commit fc00381d30

View File

@ -456,7 +456,7 @@ gtk_entry_accessible_initialize (AtkObject *obj,
gtk_entry_accessible->priv->selection_bound = start_pos; gtk_entry_accessible->priv->selection_bound = start_pos;
/* Set up signal callbacks */ /* 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); g_signal_connect (entry, "delete-text", G_CALLBACK (delete_text_cb), NULL);
if (gtk_entry_get_visibility (entry)) if (gtk_entry_get_visibility (entry))
@ -1390,16 +1390,18 @@ insert_text_cb (GtkEditable *editable,
gint *position) gint *position)
{ {
GtkEntryAccessible *accessible; GtkEntryAccessible *accessible;
gint length;
if (new_text_length == 0) if (new_text_length == 0)
return; return;
accessible = GTK_ENTRY_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (editable))); 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, g_signal_emit_by_name (accessible,
"text-changed::insert", "text-changed::insert",
*position, *position - length,
g_utf8_strlen (new_text, new_text_length)); length);
} }
/* We connect to GtkEditable::delete-text, since it carries /* We connect to GtkEditable::delete-text, since it carries