[gtk/matthiasc/for-master] atsi: Fix emission of text selection changes



commit e20a3339bfdf69c23f036024692c710812d5154a
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 20 21:31:23 2020 -0400

    atsi: Fix emission of text selection changes
    
    We were not emitting text-selection-changed and
    text-caret-moved as expected.

 gtk/a11y/gtkatspicontext.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index a72a6ad40e..b030d1cfd7 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -729,14 +729,24 @@ emit_text_selection_changed (GtkAtSpiContext *self,
                              const char      *kind,
                              int              cursor_position)
 {
-  g_dbus_connection_emit_signal (self->connection,
-                                 NULL,
-                                 self->context_path,
-                                 "org.a11y.atspi.Event.Object",
-                                 "TextChanged",
-                                 g_variant_new ("(siiva{sv})",
-                                                kind, cursor_position, 0, g_variant_new_string (""), NULL),
+  if (strcmp (kind, "text-caret-moved") == 0)
+    g_dbus_connection_emit_signal (self->connection,
+                                   NULL,
+                                   self->context_path,
+                                   "org.a11y.atspi.Event.Object",
+                                   "TextCaretMoved",
+                                   g_variant_new ("(siiva{sv})",
+                                                  "", cursor_position, 0, g_variant_new_string (""), NULL),
                                  NULL);
+  else
+    g_dbus_connection_emit_signal (self->connection,
+                                   NULL,
+                                   self->context_path,
+                                   "org.a11y.atspi.Event.Object",
+                                   "TextSelectionChanged",
+                                   g_variant_new ("(siiva{sv})",
+                                                  "", 0, 0, g_variant_new_string (""), NULL),
+                                   NULL);
 }
 
 static void


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