diff options
author | Andre de la Rocha <andre.rocha@qt.io> | 2018-08-06 15:27:21 +0200 |
---|---|---|
committer | Andre de la Rocha <andre.rocha@qt.io> | 2018-08-06 19:34:23 +0000 |
commit | f271dd8f960ad9f61697dfa57b26c4071441cadc (patch) | |
tree | 5bcff1fd97308ea8dee9549c991acbec1b73fa78 | |
parent | a09a28879e76bb011e0eefe0be0219ce396362d9 (diff) |
Windows QPA: Fix UIA-to-MSAA accessibility bridge
According to MS sample code, MSAA requests should be replied with
UI Automation providers to enable the use the UIA-to-MSAA bridge, in
order to support MSAA-only clients. Also changing the mapping of
QAccessible::Client from UIA_CustomControlTypeId to UIA_GroupControlTypeId,
as it seems more appropriate and avoids an incorrect mapping to a push button
type in the UIA-to-MSAA conversion.
Change-Id: I5149d250da2d1bd7b14b44ca46e856a81c9be045
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp | 27 | ||||
-rw-r--r-- | src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp | 2 |
2 files changed, 13 insertions, 16 deletions
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp index 907883bf5b..0f0f42fafe 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp @@ -68,21 +68,18 @@ QWindowsUiaAccessibility::~QWindowsUiaAccessibility() // Handles UI Automation window messages. bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult) { - if (lParam == LPARAM(UiaRootObjectId)) { - - // Start handling accessibility internally - QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true); - - // Ignoring all requests while starting up / shutting down - if (QCoreApplication::startingUp() || QCoreApplication::closingDown()) - return false; - - if (QWindow *window = QWindowsContext::instance()->findWindow(hwnd)) { - if (QAccessibleInterface *accessible = window->accessibleRoot()) { - QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible); - *lResult = QWindowsUiaWrapper::instance()->returnRawElementProvider(hwnd, wParam, lParam, provider); - return true; - } + // Start handling accessibility internally + QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true); + + // Ignoring all requests while starting up / shutting down + if (QCoreApplication::startingUp() || QCoreApplication::closingDown()) + return false; + + if (QWindow *window = QWindowsContext::instance()->findWindow(hwnd)) { + if (QAccessibleInterface *accessible = window->accessibleRoot()) { + QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible); + *lResult = QWindowsUiaWrapper::instance()->returnRawElementProvider(hwnd, wParam, lParam, provider); + return true; } } return false; diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp index 89e5075dcb..f777a59ce9 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp @@ -149,7 +149,7 @@ long roleToControlTypeId(QAccessible::Role role) {QAccessible::Caret, UIA_CustomControlTypeId}, {QAccessible::AlertMessage, UIA_CustomControlTypeId}, {QAccessible::Window, UIA_WindowControlTypeId}, - {QAccessible::Client, UIA_CustomControlTypeId}, + {QAccessible::Client, UIA_GroupControlTypeId}, {QAccessible::PopupMenu, UIA_MenuControlTypeId}, {QAccessible::MenuItem, UIA_MenuItemControlTypeId}, {QAccessible::ToolTip, UIA_ToolTipControlTypeId}, |