summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2023-04-06 23:51:51 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-04-15 05:48:27 +0200
commitdb346e711c9af50566c234cfc21199680e6cb499 (patch)
tree5915e6b8541e932b6b45711ee962e9c1b5c2afed /src/gui/accessible
parent5564b166a3ea00e44053edbf7b8b41f5c9bf8c39 (diff)
Fix accessibility on XCB when running as root
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. [ChangeLog][QtGui][Accessibility] On XCB applications running as root are now accessible. Pick-to: 6.5 Fixes: QTBUG-43674 Change-Id: I82cdc35f00693a8366dfcdab2f2c3c6dc5f5b783 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/linux/qspiaccessiblebridge.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/accessible/linux/qspiaccessiblebridge.cpp b/src/gui/accessible/linux/qspiaccessiblebridge.cpp
index 8961055f1b..f59d8be18b 100644
--- a/src/gui/accessible/linux/qspiaccessiblebridge.cpp
+++ b/src/gui/accessible/linux/qspiaccessiblebridge.cpp
@@ -33,6 +33,14 @@ 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.
+ QTimer::singleShot(
+ 0, this, [this]{
+ if (dbusConnection->isEnabled())
+ enabledChanged(true);
+ });
}
void QSpiAccessibleBridge::enabledChanged(bool enabled)