From bf9bdf5328172db65aafaee74d8fb9cbeaa9cc16 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 11 Jan 2012 16:31:35 +0100 Subject: Use events for accessibility updates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/windows/qwindowsaccessibility.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsaccessibility.cpp') 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 - } /* -- cgit v1.2.3