summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2023-08-16 09:51:52 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2023-08-16 14:56:51 +0200
commit193fb8bb68e35f6ad25a7d62a6e321bd41ecf688 (patch)
tree34850b0f64bd7db8e6dc1de850a55997b1af3145
parent4e009da7ef0eeb29851b7c9e95f89d4411c072b8 (diff)
Revert "Windows QPA: Add support to UiaRaiseNotificationEvent()"
This reverts commit 566def740ec58e842e6bb37177f80e20aebaa245. The fix had some unwanted side-effects when the QAccessibleValueChangeEvent carried a value of type string. Only QComboBox uses QAccessibleValueChangeEvent in such a way. The consequence of the reverted patch was that it broke QComboBox so that the screen reader would read aloud the value change event regardless of the visibility or focus state of the QComboBox. (Thus, if you e.g. changed the QComboBox::currentIndex on a *hidden* combo box, the screen reader would still read aloud the event) This is also the root cause of what is described in QTBUG-93763. Also, due to the usage of NotificationProcessing_ImportantMostRecent the screen reader would treat it as such an important event that it would abort whatever it was currently speaking. In addition, the reverted change didn't fix any bugs and it failed to implement the suggested behavior in a correct way (as was described in QTBUG-75003 - albeit properly described after the change was merged). QTBUG-75003 has already been reopened due to this, and the change can therefore be reverted quite risk-free. Task-number: QTBUG-75003 Task-number: QTBUG-93763 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Ib91872adc563c31534fe2b30fd9c447bfcca6b40 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/gui/accessible/windows/apisupport/qwindowsuiawrapper.cpp10
-rw-r--r--src/gui/accessible/windows/apisupport/qwindowsuiawrapper_p.h3
-rw-r--r--src/gui/accessible/windows/apisupport/uiatypes_p.h16
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp26
4 files changed, 6 insertions, 49 deletions
diff --git a/src/gui/accessible/windows/apisupport/qwindowsuiawrapper.cpp b/src/gui/accessible/windows/apisupport/qwindowsuiawrapper.cpp
index d9ff723a61..a5ea7cd498 100644
--- a/src/gui/accessible/windows/apisupport/qwindowsuiawrapper.cpp
+++ b/src/gui/accessible/windows/apisupport/qwindowsuiawrapper.cpp
@@ -17,7 +17,6 @@ QWindowsUiaWrapper::QWindowsUiaWrapper()
m_pUiaHostProviderFromHwnd = reinterpret_cast<PtrUiaHostProviderFromHwnd>(uiaLib.resolve("UiaHostProviderFromHwnd"));
m_pUiaRaiseAutomationPropertyChangedEvent = reinterpret_cast<PtrUiaRaiseAutomationPropertyChangedEvent>(uiaLib.resolve("UiaRaiseAutomationPropertyChangedEvent"));
m_pUiaRaiseAutomationEvent = reinterpret_cast<PtrUiaRaiseAutomationEvent>(uiaLib.resolve("UiaRaiseAutomationEvent"));
- m_pUiaRaiseNotificationEvent = reinterpret_cast<PtrUiaRaiseNotificationEvent>(uiaLib.resolve("UiaRaiseNotificationEvent"));
m_pUiaClientsAreListening = reinterpret_cast<PtrUiaClientsAreListening>(uiaLib.resolve("UiaClientsAreListening"));
}
}
@@ -33,7 +32,7 @@ QWindowsUiaWrapper *QWindowsUiaWrapper::instance()
return &wrapper;
}
-// True if most symbols resolved (UiaRaiseNotificationEvent is optional).
+// True if all symbols resolved.
BOOL QWindowsUiaWrapper::ready()
{
return m_pUiaReturnRawElementProvider
@@ -78,12 +77,5 @@ HRESULT QWindowsUiaWrapper::raiseAutomationEvent(IRawElementProviderSimple *pPro
return m_pUiaRaiseAutomationEvent(pProvider, id);
}
-HRESULT QWindowsUiaWrapper::raiseNotificationEvent(IRawElementProviderSimple *provider, NotificationKind notificationKind, NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId)
-{
- if (!m_pUiaRaiseNotificationEvent)
- return UIA_E_NOTSUPPORTED;
- return m_pUiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId);
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/accessible/windows/apisupport/qwindowsuiawrapper_p.h b/src/gui/accessible/windows/apisupport/qwindowsuiawrapper_p.h
index 05b93f8393..94065c7c79 100644
--- a/src/gui/accessible/windows/apisupport/qwindowsuiawrapper_p.h
+++ b/src/gui/accessible/windows/apisupport/qwindowsuiawrapper_p.h
@@ -44,20 +44,17 @@ public:
HRESULT hostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider);
HRESULT raiseAutomationPropertyChangedEvent(IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue);
HRESULT raiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id);
- HRESULT raiseNotificationEvent(IRawElementProviderSimple *provider, NotificationKind notificationKind, NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId);
private:
typedef LRESULT (WINAPI *PtrUiaReturnRawElementProvider)(HWND, WPARAM, LPARAM, IRawElementProviderSimple *);
typedef HRESULT (WINAPI *PtrUiaHostProviderFromHwnd)(HWND, IRawElementProviderSimple **);
typedef HRESULT (WINAPI *PtrUiaRaiseAutomationPropertyChangedEvent)(IRawElementProviderSimple *, PROPERTYID, VARIANT, VARIANT);
typedef HRESULT (WINAPI *PtrUiaRaiseAutomationEvent)(IRawElementProviderSimple *, EVENTID);
- typedef HRESULT (WINAPI *PtrUiaRaiseNotificationEvent)(IRawElementProviderSimple *, NotificationKind, NotificationProcessing, BSTR, BSTR);
typedef BOOL (WINAPI *PtrUiaClientsAreListening)();
PtrUiaReturnRawElementProvider m_pUiaReturnRawElementProvider = nullptr;
PtrUiaHostProviderFromHwnd m_pUiaHostProviderFromHwnd = nullptr;
PtrUiaRaiseAutomationPropertyChangedEvent m_pUiaRaiseAutomationPropertyChangedEvent = nullptr;
PtrUiaRaiseAutomationEvent m_pUiaRaiseAutomationEvent = nullptr;
- PtrUiaRaiseNotificationEvent m_pUiaRaiseNotificationEvent = nullptr;
PtrUiaClientsAreListening m_pUiaClientsAreListening = nullptr;
};
diff --git a/src/gui/accessible/windows/apisupport/uiatypes_p.h b/src/gui/accessible/windows/apisupport/uiatypes_p.h
index 465bd07a07..ebee2f34ad 100644
--- a/src/gui/accessible/windows/apisupport/uiatypes_p.h
+++ b/src/gui/accessible/windows/apisupport/uiatypes_p.h
@@ -126,22 +126,6 @@ enum ExpandCollapseState {
ExpandCollapseState_LeafNode = 3
};
-enum NotificationKind {
- NotificationKind_ItemAdded = 0,
- NotificationKind_ItemRemoved = 1,
- NotificationKind_ActionCompleted = 2,
- NotificationKind_ActionAborted = 3,
- NotificationKind_Other = 4
-};
-
-enum NotificationProcessing {
- NotificationProcessing_ImportantAll = 0,
- NotificationProcessing_ImportantMostRecent = 1,
- NotificationProcessing_All = 2,
- NotificationProcessing_MostRecent = 3,
- NotificationProcessing_CurrentThenMostRecent = 4
-};
-
struct UiaRect {
double left;
double top;
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
index 6ee4c9082a..05b886d2da 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -141,27 +141,11 @@ void QWindowsUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *eve
}
if (event->value().typeId() == QMetaType::QString) {
if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
-
- // Tries to notify the change using UiaRaiseNotificationEvent(), which is only available on
- // Windows 10 version 1709 or newer. Otherwise uses UiaRaiseAutomationPropertyChangedEvent().
-
- BSTR displayString = bStrFromQString(event->value().toString());
- BSTR activityId = bStrFromQString(QString());
-
- HRESULT hr = QWindowsUiaWrapper::instance()->raiseNotificationEvent(provider, NotificationKind_Other,
- NotificationProcessing_ImportantMostRecent,
- displayString, activityId);
-
- ::SysFreeString(displayString);
- ::SysFreeString(activityId);
-
- if (hr == static_cast<HRESULT>(UIA_E_NOTSUPPORTED)) {
- VARIANT oldVal, newVal;
- clearVariant(&oldVal);
- setVariantString(event->value().toString(), &newVal);
- QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_ValueValuePropertyId, oldVal, newVal);
- ::SysFreeString(newVal.bstrVal);
- }
+ // Notifies changes in string values.
+ VARIANT oldVal, newVal;
+ clearVariant(&oldVal);
+ setVariantString(event->value().toString(), &newVal);
+ QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_ValueValuePropertyId, oldVal, newVal);
}
} else if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) {
if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {