From 69bec7866bcf09f672c99a330ace4ab9aa426266 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sat, 19 Jul 2014 10:02:23 +0200 Subject: Accessibility Linux: send children changed notifications The badly named ObjectReorder actually stands for any of this object's children may have changed. This event is used in webengine and should trigger the ATs to drop their caches (eg when loading a new website). Change-Id: I44080f8d43c1161285d9ace4891fe18531f16e09 Reviewed-by: Andras Becsi --- src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 17 ++++++++++++++++- src/platformsupport/linuxaccessibility/atspiadaptor_p.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index f9d2f21b0c..48cd01413f 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -910,6 +910,11 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) notifyAboutDestruction(event->accessibleInterface()); break; } + case QAccessible::ObjectReorder: { + if (sendObject || sendObject_children_changed) + childrenChanged(event->accessibleInterface()); + break; + } case QAccessible::NameChanged: { if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) { QString path = pathForInterface(event->accessibleInterface()); @@ -1148,7 +1153,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::TextAttributeChanged: case QAccessible::TextColumnChanged: case QAccessible::VisibleDataChanged: - case QAccessible::ObjectReorder: case QAccessible::SelectionAdd: case QAccessible::SelectionWithin: case QAccessible::LocationChanged: @@ -1184,6 +1188,17 @@ void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *interface) const } } +void AtSpiAdaptor::childrenChanged(QAccessibleInterface *interface) const +{ + QString parentPath = pathForInterface(interface); + int childCount = interface->childCount(); + for (int i = 0; i < interface->childCount(); ++i) { + QString childPath = pathForInterface(interface->child(i)); + QVariantList args = packDBusSignalArguments(QLatin1String("add"), childCount, 0, childPath); + sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); + } +} + void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *interface) const { // // say hello to d-bus diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h index 244d3d7594..e1e2f2b149 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h +++ b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h @@ -91,6 +91,7 @@ private: void sendFocusChanged(QAccessibleInterface *interface) const; void notifyAboutCreation(QAccessibleInterface *interface) const; void notifyAboutDestruction(QAccessibleInterface *interface) const; + void childrenChanged(QAccessibleInterface *interface) const; // handlers for the different accessible interfaces bool applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); -- cgit v1.2.3