diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2012-01-11 16:31:35 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-31 12:02:33 +0100 |
commit | bf9bdf5328172db65aafaee74d8fb9cbeaa9cc16 (patch) | |
tree | 666ab14504b421d34f269b8ffd7a4f7210bbd133 /src/plugins/platforms | |
parent | cf52c268b036d808901313acc554587465bdd746 (diff) |
Use events for accessibility updates.
The problem with the old updates is that it was impossible
to send details about the update.
For the Linux implementation to work properly with AT-SPI I need to know
which state changed (currently I only get a generic "state changed" event)
or which part of the text was changed for long texts (imagine a word processor sending updates).
This also gives us more options when updating with events generated from not QObject based objects.
Change-Id: If0b6c83c523092565eb48e79f3f6de5a1b905ea8
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsaccessibility.cpp | 14 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsaccessibility.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp index 4ecc8439a7..2678fd7f23 100644 --- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp @@ -1296,10 +1296,10 @@ QWindowsAccessibility::QWindowsAccessibility() } -void QWindowsAccessibility::notifyAccessibilityUpdate(QObject *o, int who, QAccessible::Event reason) +void QWindowsAccessibility::notifyAccessibilityUpdate(const QAccessibleEvent &event) { QString soundName; - switch (reason) { + switch (event.type()) { case QAccessible::PopupMenuStart: soundName = QLatin1String("MenuPopup"); break; @@ -1370,8 +1370,9 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QObject *o, int who, QAcce // An event has to be associated with a window, // so find the first parent that is a widget and that has a WId - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o); + QAccessibleInterface *iface = event.accessibleInterface(); QWindow *window = iface ? window_helper(iface) : 0; + delete iface; if (!window) { window = QGuiApplication::activeWindow(); @@ -1382,18 +1383,17 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QObject *o, int who, QAcce QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface(); HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window); - if (reason != QAccessible::MenuCommand) { // MenuCommand is faked + if (event.type() != QAccessible::MenuCommand) { // MenuCommand is faked // See comment "SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE" eventNum %= 50; //[0..49] int eventId = - eventNum - 1; - qAccessibleRecentSentEvents()->insert(eventId, qMakePair(o, who)); - ptrNotifyWinEvent(reason, hWnd, OBJID_CLIENT, eventId ); + qAccessibleRecentSentEvents()->insert(eventId, qMakePair(event.object(), event.child())); + ptrNotifyWinEvent(event.type(), hWnd, OBJID_CLIENT, eventId ); ++eventNum; } #endif // Q_WS_WINCE - } /* diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.h b/src/plugins/platforms/windows/qwindowsaccessibility.h index d3c9c11088..addd748523 100644 --- a/src/plugins/platforms/windows/qwindowsaccessibility.h +++ b/src/plugins/platforms/windows/qwindowsaccessibility.h @@ -50,12 +50,12 @@ class QWindowsAccessibility : public QPlatformAccessibility public: QWindowsAccessibility(); static bool handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult); - virtual void notifyAccessibilityUpdate(QObject *o, int who, QAccessible::Event reason); + virtual void notifyAccessibilityUpdate(const QAccessibleEvent &event); /* virtual void setRootObject(QObject *o); virtual void initialize(); virtual void cleanup(); -*/ + */ }; #endif // QWINDOWSACCESSIBILITY_H |