summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorFushan Wen <qydwhotmail@gmail.com>2022-07-23 00:48:37 +0800
committerFushan Wen <qydwhotmail@gmail.com>2022-10-10 08:23:20 +0000
commitc9758d76c73c7e4bf6363a7f357ad8c2dfb8b4bc (patch)
treeac2f3d2b94e77a1bc2f96ca55e78b5fd78dc60c6 /src/gui/accessible
parentac17a394a5701174c705050640e26c9cb95d289b (diff)
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>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
index 2e6fb720c5..04fdfe14c3 100644
--- a/src/gui/accessible/linux/atspiadaptor.cpp
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -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);
}