From: Debian Qt/KDE Maintainers Date: Thu, 25 May 2023 10:45:05 +0000 (+0100) Subject: fix accessibility on XCB when running as root X-Git-Tag: archive/raspbian/5.15.8+dfsg-11+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=273b497ca97144a683e93fff81cfb6982c32dc4f;p=qtbase-opensource-src.git fix accessibility on XCB when running as root Origin: https://codereview.qt-project.org/c/qt/qtbase/+/205196 Bug: https://bugs.debian.org/1033995 Last-Update: 2023-04-12 Accessibility actually works when running applications as root, but we would never properly connect, since the enabledChanged signal would be emitted from the constructor in this case. So after connecting the signal, check the value by hand to make sure not to miss the notification. Only applications running as root would be affected, because all other applications would go through the asynchronous pattern of getting the bus address from dbus instead. Gbp-Pq: Name a11y_root.diff --- diff --git a/src/platformsupport/linuxaccessibility/bridge.cpp b/src/platformsupport/linuxaccessibility/bridge.cpp index fdc8cd319..438a20c31 100644 --- a/src/platformsupport/linuxaccessibility/bridge.cpp +++ b/src/platformsupport/linuxaccessibility/bridge.cpp @@ -65,6 +65,16 @@ QSpiAccessibleBridge::QSpiAccessibleBridge() { dbusConnection = new DBusConnection(); connect(dbusConnection, SIGNAL(enabledChanged(bool)), this, SLOT(enabledChanged(bool))); + // Now that we have connected the signal, make sure we didn't miss a change, + // e.g. when running as root or when AT_SPI_BUS_ADDRESS is set by hand. + // But do that only on next loop, once dbus is really settled. + QMetaObject::invokeMethod( + this, + [this] { + if (dbusConnection->isEnabled()) + enabledChanged(true); + }, + Qt::QueuedConnection); } void QSpiAccessibleBridge::enabledChanged(bool enabled)