a11y: add runtime checking for xcb only calls

This amends d23562da1c .

Pick-to: 6.6 6.5
Task-number: QTBUG-117535
Change-Id: I33f97f3c26409a33c8a069f9dcdfe61bbd88e2ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Liang Qi 2023-10-04 17:21:17 +02:00
parent 2ad3da8fce
commit 7e14e6c2d3
1 changed files with 7 additions and 5 deletions

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);
}
}
}