summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible/linux/dbusconnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/accessible/linux/dbusconnection.cpp')
-rw-r--r--src/gui/accessible/linux/dbusconnection.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/accessible/linux/dbusconnection.cpp b/src/gui/accessible/linux/dbusconnection.cpp
index b4a8643474..620575cc98 100644
--- a/src/gui/accessible/linux/dbusconnection.cpp
+++ b/src/gui/accessible/linux/dbusconnection.cpp
@@ -26,13 +26,13 @@ using namespace Qt::StringLiterals;
#define A11Y_PATH "/org/a11y/bus"_L1
/*!
- \class DBusConnection
+ \class QAtSpiDBusConnection
\internal
\brief Connects to the accessibility dbus.
This is usually a different bus from the session bus.
*/
-DBusConnection::DBusConnection(QObject *parent)
+QAtSpiDBusConnection::QAtSpiDBusConnection(QObject *parent)
: QObject(parent), m_a11yConnection(QString()), m_enabled(false)
{
// If the bus is explicitly set via env var it overrides everything else.
@@ -56,15 +56,17 @@ 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);
+ }
}
}
-QString DBusConnection::getAddressFromXCB()
+QString QAtSpiDBusConnection::getAddressFromXCB()
{
QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
if (!app)
@@ -83,7 +85,7 @@ QString DBusConnection::getAddressFromXCB()
// We have the a11y registry on the session bus.
// Subscribe to updates about a11y enabled state.
// Find out the bus address
-void DBusConnection::serviceRegistered()
+void QAtSpiDBusConnection::serviceRegistered()
{
// listen to enabled changes
QDBusConnection c = QDBusConnection::sessionBus();
@@ -111,12 +113,12 @@ void DBusConnection::serviceRegistered()
// connect(a11yStatus, ); QtDbus doesn't support notifications for property changes yet
}
-void DBusConnection::serviceUnregistered()
+void QAtSpiDBusConnection::serviceUnregistered()
{
emit enabledChanged(false);
}
-void DBusConnection::connectA11yBus(const QString &address)
+void QAtSpiDBusConnection::connectA11yBus(const QString &address)
{
if (address.isEmpty()) {
qWarning("Could not find Accessibility DBus address.");
@@ -128,7 +130,7 @@ void DBusConnection::connectA11yBus(const QString &address)
emit enabledChanged(true);
}
-void DBusConnection::dbusError(const QDBusError &error)
+void QAtSpiDBusConnection::dbusError(const QDBusError &error)
{
qWarning() << "Accessibility encountered a DBus error:" << error;
}
@@ -137,7 +139,7 @@ void DBusConnection::dbusError(const QDBusError &error)
Returns the DBus connection that got established.
Or an invalid connection if not yet connected.
*/
-QDBusConnection DBusConnection::connection() const
+QDBusConnection QAtSpiDBusConnection::connection() const
{
return m_a11yConnection;
}