mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 05:00:07 +00:00
a11y atspi: Send ChildrenChanged with correct DBus signature
The DBus XML spec for the "ChildrenChanged" AT-SPI signal (see gtk/a11y/atspi/Event.xml) is the following: <signal name="ChildrenChanged"> <arg name="operation" type="s"/> <arg name="index_in_parent" type="i"/> <arg type="i"/> <arg name="child" type="v"/> <arg name="properties" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiEvent"/> </signal> Adhere to that when sending such a DBus signal: Use "(siiva{sv})" instead of "(siiv@(so))" for the GVariant type spec and pass a null array of properties instead of sending a reference to the sender as an argument. (The sender is already known because it is the event source.) The incorrect signature could e.g. be seen with an at-spi2-core version (git main as of commit 422cac4bd657ce783164324e6ae4b3d54a8aa761) with this additional local change on top: --- a/atspi/atspi-event-listener.c +++ b/atspi/atspi-event-listener.c @@ -28,6 +28,8 @@ #include <string.h> #include <strings.h> +#include <stdio.h> + /** * AtspiEventListener: * @@ -1110,6 +1112,8 @@ _atspi_dbus_handle_event (DBusMessage *message) g_assert (strncmp (category, "org.a11y.atspi.Event.", 21) == 0); + printf("sender: %s, signature: %s\n", sender, signature); + if (strcmp (signature, "siiv(so)") != 0 && strcmp (signature, "siiva{sv}") != 0) { and a corresponding pyatspi script: #!/usr/bin/python3 import pyatspi def listener(e): print(f'toolkit: {e.source.get_toolkit_name()} {e.source.get_toolkit_version()}') print(e) pyatspi.Registry.registerEventListener(listener, "object:children-changed") pyatspi.Registry.start() Corresponding output generated by this script without this change in place when starting the "Entry" -> "Completion" example from gtk4-demo: sender: :1.68, signature: siiv(so) toolkit: GTK 4.17.1 object:children-changed:add(1, 0, [frame | Completion]) source: [application | gtk4-demo] host_application: [application | gtk4-demo] sender: [application | gtk4-demo] Output with this change in place: sender: :1.70, signature: siiva{sv} toolkit: GTK 4.17.1 object:children-changed:add(1, 0, [frame | Completion]) source: [application | gtk4-demo] host_application: [application | gtk4-demo] sender: [application | gtk4-demo] This also matches the output seen for GTK 3's gtk3-demo: sender: :1.71, signature: siiva{sv} toolkit: gtk 3.24.43 object:children-changed:add(1, 0, [frame | Entry Completion]) source: [application | gtk3-demo] host_application: [application | gtk3-demo] sender: [application | gtk3-demo] The other events (in gtk/a11y/gtkatspicontext.c) already use the correct DBus signature.
This commit is contained in:
parent
f7f158b675
commit
0749f968f4
@ -902,15 +902,13 @@ emit_children_changed (GtkAtSpiContext *self,
|
||||
!gtk_at_spi_root_has_event_listeners (self->root))
|
||||
return;
|
||||
|
||||
GVariant *context_ref = gtk_at_spi_context_to_ref (self);
|
||||
GVariant *child_ref = gtk_at_spi_context_to_ref (child_context);
|
||||
|
||||
gtk_at_spi_emit_children_changed (self->connection,
|
||||
self->context_path,
|
||||
state,
|
||||
idx,
|
||||
child_ref,
|
||||
context_ref);
|
||||
child_ref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -484,8 +484,7 @@ gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
|
||||
self->root_path,
|
||||
state,
|
||||
idx,
|
||||
window_ref,
|
||||
gtk_at_spi_root_to_ref (self));
|
||||
window_ref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -339,8 +339,7 @@ gtk_at_spi_emit_children_changed (GDBusConnection *connection,
|
||||
const char *path,
|
||||
GtkAccessibleChildState state,
|
||||
int idx,
|
||||
GVariant *child_ref,
|
||||
GVariant *sender_ref)
|
||||
GVariant *child_ref)
|
||||
{
|
||||
const char *change;
|
||||
|
||||
@ -364,7 +363,7 @@ gtk_at_spi_emit_children_changed (GDBusConnection *connection,
|
||||
path,
|
||||
"org.a11y.atspi.Event.Object",
|
||||
"ChildrenChanged",
|
||||
g_variant_new ("(siiv@(so))", change, idx, 0, child_ref, sender_ref),
|
||||
g_variant_new ("(siiva{sv})", change, idx, 0, child_ref, NULL),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,7 @@ gtk_at_spi_emit_children_changed (GDBusConnection *connection,
|
||||
const char *path,
|
||||
GtkAccessibleChildState state,
|
||||
int idx,
|
||||
GVariant *child_ref,
|
||||
GVariant *sender_ref);
|
||||
GVariant *child_ref);
|
||||
|
||||
void
|
||||
gtk_at_spi_translate_coordinates_to_accessible (GtkAccessible *accessible,
|
||||
|
Loading…
Reference in New Issue
Block a user