[at-spi2-core] Add a sender to the AtspiEvent struct.



commit 8decb77c551536ef527f2b5c07968fd4da4e2e61
Author: Mike Gorse <mgorse alum wpi edu>
Date:   Thu Jul 18 18:29:45 2019 -0500

    Add a sender to the AtspiEvent struct.
    
    Normally, this is set to the application / root accessible from the
    application corresponding to the event source, but screen-reader-generated
    events are actually generated by the screen reader. The sender is set based on
    the application that sent the signal over dbus, so, in the latter case, this
    will be set to the screen reader.
    
    Per discussion at https://gitlab.gnome.org/GNOME/orca/issues/36

 atspi/atspi-event-listener.c | 7 ++++++-
 atspi/atspi-types.h          | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c
index 9b95c3d..5fb8402 100644
--- a/atspi/atspi-event-listener.c
+++ b/atspi/atspi-event-listener.c
@@ -882,6 +882,7 @@ atspi_event_copy (AtspiEvent *src)
   dst->detail2 = src->detail2;
   g_value_init (&dst->any_data, G_VALUE_TYPE (&src->any_data));
   g_value_copy (&src->any_data, &dst->any_data);
+  dst->sender = g_object_ref (src->sender);
   return dst;
 }
 
@@ -892,6 +893,7 @@ atspi_event_free (AtspiEvent *event)
   g_free (event->type);
   g_value_unset (&event->any_data);
   g_free (event);
+  g_object_unref (event->sender);
 }
 
 static gboolean
@@ -961,6 +963,7 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data)
 {
   char *detail = NULL;
   const char *category = dbus_message_get_interface (message);
+  const char *sender = dbus_message_get_sender (message);
   const char *member = dbus_message_get_member (message);
   const char *signature = dbus_message_get_signature (message);
   gchar *name;
@@ -1026,7 +1029,7 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data)
   e.type = converted_type;
   if (strcmp (category, "ScreenReader") != 0)
   {
-    e.source = _atspi_ref_accessible (dbus_message_get_sender(message), dbus_message_get_path(message));
+    e.source = _atspi_ref_accessible (sender, dbus_message_get_path (message));
     if (e.source == NULL)
     {
       g_warning ("Got no valid source accessible for signal %s from interface %s\n", member, category);
@@ -1084,6 +1087,8 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data)
     cache = _atspi_dbus_update_cache_from_dict (e.source, &iter);
   }
 
+  e.sender = _atspi_ref_accessible (sender, ATSPI_DBUS_PATH_ROOT);
+
   if (!strncmp (e.type, "object:children-changed", 23))
   {
     cache_process_children_changed (&e);
diff --git a/atspi/atspi-types.h b/atspi/atspi-types.h
index e458a8e..211d543 100644
--- a/atspi/atspi-types.h
+++ b/atspi/atspi-types.h
@@ -89,6 +89,7 @@ struct _AtspiEvent
   gint         detail1;
   gint         detail2;
   GValue any_data;
+  AtspiAccessible *sender;
 };
 
 /**


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