[gtk+] GtkEntryAccessible: Emit signal after insertion



commit fc00381d306400977c7c83e564a7eb552cc8250d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jun 9 18:31:19 2014 -0400

    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 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c
index c19be10..599f8cf 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]