diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-03 17:18:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-02 14:32:25 +0200 |
commit | b2ec0da95641d9cec006fa9699e6d082ad35db0b (patch) | |
tree | c6ceef7e1527b98f3eda33b6e525d65ee1d810a6 /src/platformsupport/linuxaccessibility/atspiadaptor_p.h | |
parent | 8dfe1385b5f05b7242802a72897258a63af1ca1d (diff) |
Cache QAccessibleInterfaces.
Since there already is a one-to-one relationship
between QObject and QAccessibleInterface it makes
little sense to create and destroy the interfaces
on each call to queryAccessibleInterface.
Add a cache and keep created interfaces around for
the lifetime of the corresponding QObject.
This changes the memory management rules: accessible
interfaces must no longer be deleted. If you get an
QAccessibleIntrface pointer that pointer will stay
valid as long as the corresponding QObject is not
deleted.
This also re-enables accessibility for Mac.
We limit the range of the IDs so that they are
useable for Windows directly.
That means we can get rid of the event cache there.
This is based on: Iebf2f374916fc70a9dd29e95f45a6444b85f6cee
Change-Id: I9fe6531812c0dbc5b41101ac05830a6dd75e13a3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/platformsupport/linuxaccessibility/atspiadaptor_p.h')
-rw-r--r-- | src/platformsupport/linuxaccessibility/atspiadaptor_p.h | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h index 0bc3290baa..aafaecfeae 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h +++ b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h @@ -59,7 +59,6 @@ class QAccessibleInterface; class QSpiAccessibleInterface; class QSpiApplicationAdaptor; -typedef QSharedPointer<QAccessibleInterface> QAIPointer; class AtSpiAdaptor :public QDBusVirtualObject { @@ -90,45 +89,45 @@ private: bool sendDBusSignal(const QString &path, const QString &interface, const QString &name, const QVariantList &arguments) const; QVariant variantForPath(const QString &path) const; - void sendFocusChanged(const QAIPointer &interface) const; - void notifyAboutCreation(const QAIPointer &interface) const; - void notifyAboutDestruction(const QAIPointer &interface) const; + void sendFocusChanged(QAccessibleInterface *interface) const; + void notifyAboutCreation(QAccessibleInterface *interface) const; + void notifyAboutDestruction(QAccessibleInterface *interface) const; // handlers for the different accessible interfaces - bool applicationInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool accessibleInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool componentInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool actionInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool textInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool editableTextInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool valueInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); - bool tableInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); + bool tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection); void sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const; - QAIPointer interfaceFromPath(const QString& dbusPath) const; - QString pathForInterface(const QAIPointer &interface, bool inDestructor = false) const; + QAccessibleInterface *interfaceFromPath(const QString& dbusPath) const; + QString pathForInterface(QAccessibleInterface *interface) const; QString pathForObject(QObject *object) const; - void notifyStateChange(const QAIPointer& interface, const QString& state, int value); + void notifyStateChange(QAccessibleInterface *interface, const QString& state, int value); // accessible helper functions - AtspiRole getRole(const QAIPointer &interface) const; - QSpiRelationArray relationSet(const QAIPointer &interface, const QDBusConnection &connection) const; - QStringList accessibleInterfaces(const QAIPointer &interface) const; + AtspiRole getRole(QAccessibleInterface *interface) const; + QSpiRelationArray relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const; + QStringList accessibleInterfaces(QAccessibleInterface *interface) const; // component helper functions - static QRect getExtents(const QAIPointer &interface, uint coordType); - static QRect translateRectToWindowCoordinates(const QAIPointer &interface, const QRect &rect); + static QRect getExtents(QAccessibleInterface *interface, uint coordType); + static QRect translateRectToWindowCoordinates(QAccessibleInterface *interface, const QRect &rect); // action helper functions QSpiActionArray getActions(QAccessibleActionInterface* interface) const; // text helper functions - QVariantList getAttributes(const QAIPointer &, int offset, bool includeDefaults) const; - QVariantList getAttributeValue(const QAIPointer &, int offset, const QString &attributeName) const; - QRect getCharacterExtents(const QAIPointer &, int offset, uint coordType) const; - QRect getRangeExtents(const QAIPointer &, int startOffset, int endOffset, uint coordType) const; + QVariantList getAttributes(QAccessibleInterface *, int offset, bool includeDefaults) const; + QVariantList getAttributeValue(QAccessibleInterface *, int offset, const QString &attributeName) const; + QRect getCharacterExtents(QAccessibleInterface *, int offset, uint coordType) const; + QRect getRangeExtents(QAccessibleInterface *, int startOffset, int endOffset, uint coordType) const; QAccessible2::BoundaryType qAccessibleBoundaryType(int atspiTextBoundaryType) const; static bool inheritsQAction(QObject *object); @@ -140,8 +139,6 @@ private: /// Assigned from the accessibility registry. int m_applicationId; - mutable QHash<quintptr, QPointer<QObject> > m_handledObjects; - // Bit fields - which updates to send // AT-SPI has some events that we do not care about: |