From c3fe2cb93111d10b5da9199a711a7b50ef0337a1 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Sun, 19 Nov 2023 14:28:07 -0500 Subject: [PATCH] Windows QPA: Always process system sound events 1b96c75661f678632485513d1323166bc6d74e5c reduced event noise by dropping accessibility events if Windows UI automation has not been activated; however, this did not take into account that some widgets (e.g. QMessageBox) rely on accessibility event processing to emit certain system sounds. Change notifyAccessibilityUpdate() so that system sound related events are processed regardless of accessibility activation. Pick-to: 6.5 Change-Id: I22f1516e8fbb3727b065ecc2c30b272b2d6fd1c0 Reviewed-by: Oliver Wolff (cherry picked from commit ce5aaf1e434b6e2e482347b40524edeccecb1665) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 6de0a610153fc0c9403ec0d7518ccf3d7b855bb7) --- .../windows/uiautomation/qwindowsuiaaccessibility.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp index 001cb8505bb..8a0a8e2f24d 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp @@ -97,11 +97,7 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event if (!event) return; - // Ignore events sent before the first UI Automation - // request or while QAccessible is being activated. - if (!m_accessibleActive) - return; - + // Always handle system sound events switch (event->type()) { case QAccessible::PopupMenuStart: playSystemSound(QStringLiteral("MenuPopup")); @@ -116,6 +112,11 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event break; } + // Ignore events sent before the first UI Automation + // request or while QAccessible is being activated. + if (!m_accessibleActive) + return; + QAccessibleInterface *accessible = event->accessibleInterface(); if (!isActive() || !accessible || !accessible->isValid()) return;