[qt/qt/qtbase/kde/5.15] src/platformsupport/linuxaccessibility: Send string to Atspi DBus interface on name/description changed

Fushan Wen null at kde.org
Mon Oct 10 15:13:15 BST 2022


Git commit 23996edc504e9e5b5b0ec907380598bbe4bf591c by Fushan Wen.
Committed on 10/10/2022 at 11:31.
Pushed by apol into branch 'kde/5.15'.

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 at posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer at qt.io>
(cherry picked from commit c9758d76c73c7e4bf6363a7f357ad8c2dfb8b4bc)

CCMAIL: kde-accessibility at kde.org

M  +22   -4    src/platformsupport/linuxaccessibility/atspiadaptor.cpp

https://invent.kde.org/qt/qt/qtbase/commit/23996edc504e9e5b5b0ec907380598bbe4bf591c

diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index 7ea6680fba..c8c717ba6b 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -913,8 +913,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(QLatin1String("accessible-name"), 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(
+                QLatin1String("accessible-name"), 0, 0,
+                QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Name))));
             sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
                            QLatin1String("PropertyChange"), args);
         }
@@ -922,8 +931,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(QLatin1String("accessible-description"), 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(
+                QLatin1String("accessible-description"), 0, 0,
+                QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Description))));
             sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
                            QLatin1String("PropertyChange"), args);
         }


More information about the kde-accessibility mailing list