Send string to Atspi DBus interface on name/description changed

Orca only accepts string or list type for
object:property-change:accessible-name and
object:property-change:accessible-description events. This fixes
NameChanged and DescriptionChanged not being announced by Orca.

This also adds check for accessible interface and will ignore events
from invalid interfaces on name/description changed.

See also: https://gitlab.gnome.org/GNOME/orca/-/issues/255

Pick-to: 6.4 6.2
Change-Id: Iaaa50678e7223951e0f3af99c5e04aa7458e4d0d
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Fushan Wen 2022-07-23 00:48:37 +08:00
parent ac17a394a5
commit c9758d76c7
1 changed files with 22 additions and 4 deletions

View File

@ -917,8 +917,17 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
}
case QAccessible::NameChanged: {
if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) {
QString path = pathForInterface(event->accessibleInterface());
QVariantList args = packDBusSignalArguments("accessible-name"_L1, 0, 0, variantForPath(path));
QAccessibleInterface *iface = event->accessibleInterface();
if (!iface) {
qCDebug(lcAccessibilityAtspi,
"NameChanged event from invalid accessible.");
return;
}
QString path = pathForInterface(iface);
QVariantList args = packDBusSignalArguments(
"accessible-name"_L1, 0, 0,
QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Name))));
sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
"PropertyChange"_L1, args);
}
@ -926,8 +935,17 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
}
case QAccessible::DescriptionChanged: {
if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) {
QString path = pathForInterface(event->accessibleInterface());
QVariantList args = packDBusSignalArguments("accessible-description"_L1, 0, 0, variantForPath(path));
QAccessibleInterface *iface = event->accessibleInterface();
if (!iface) {
qCDebug(lcAccessibilityAtspi,
"DescriptionChanged event from invalid accessible.");
return;
}
QString path = pathForInterface(iface);
QVariantList args = packDBusSignalArguments(
"accessible-description"_L1, 0, 0,
QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Description))));
sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
"PropertyChange"_L1, args);
}