a11y: add runtime checking for xcb only calls

This amends d23562da1c4cb525d4012bee55bd665c6cafef04 .

Pick-to: 6.5
Task-number: QTBUG-117535
Change-Id: I33f97f3c26409a33c8a069f9dcdfe61bbd88e2ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7e14e6c2d3bb5297eefa273d5a23836c931c7517)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Liang Qi 2023-10-04 17:21:17 +02:00 committed by Qt Cherry-pick Bot
parent b3cd75fde7
commit efbcd59795

View File

@ -56,11 +56,13 @@ DBusConnection::DBusConnection(QObject *parent)
if (c.interface()->isServiceRegistered(A11Y_SERVICE))
serviceRegistered();
// In addition try if there is an xatom exposing the bus address, this allows applications run as root to work
QString address = getAddressFromXCB();
if (!address.isEmpty()) {
m_enabled = true;
connectA11yBus(address);
if (QGuiApplication::platformName().startsWith("xcb"_L1)) {
// In addition try if there is an xatom exposing the bus address, this allows applications run as root to work
QString address = getAddressFromXCB();
if (!address.isEmpty()) {
m_enabled = true;
connectA11yBus(address);
}
}
}