Skip to content

Commit

Permalink
Rename AT-SPI specific DBusConnection type to fix clang warnings
Browse files Browse the repository at this point in the history
DBusConnection is forward declared as a class, and after
c9e62c2 we include a header that
forward declares it as a struct. This triggers a warning, and also
indicates that we have an ODR violation.

Rename the offending type in Qt.

Fixes: QTBUG-125623
Change-Id: I13ffdceec82b86910a60083aebc2afc47f9f3a4e
Reviewed-by: Tim Blechmann <[email protected]>
Reviewed-by: Michael Weghorn <[email protected]>
Reviewed-by: Robert Löhning <[email protected]>
  • Loading branch information
vohi committed May 31, 2024
1 parent f09f70f commit fc96d9d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/gui/accessible/linux/atspiadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcAccessibilityAtspi, "qt.accessibility.atspi")
Q_LOGGING_CATEGORY(lcAccessibilityAtspiCreation, "qt.accessibility.atspi.creation")

AtSpiAdaptor::AtSpiAdaptor(DBusConnection *connection, QObject *parent)
AtSpiAdaptor::AtSpiAdaptor(QAtSpiDBusConnection *connection, QObject *parent)
: QDBusVirtualObject(parent), m_dbus(connection)
, sendFocus(0)
, sendObject(0)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/accessible/linux/atspiadaptor_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AtSpiAdaptor :public QDBusVirtualObject
Q_OBJECT

public:
explicit AtSpiAdaptor(DBusConnection *connection, QObject *parent = nullptr);
explicit AtSpiAdaptor(QAtSpiDBusConnection *connection, QObject *parent = nullptr);
~AtSpiAdaptor();

void registerApplication();
Expand Down Expand Up @@ -114,7 +114,7 @@ public Q_SLOTS:

// private vars
QSpiObjectReference accessibilityRegistry;
DBusConnection *m_dbus;
QAtSpiDBusConnection *m_dbus;
QSpiApplicationAdaptor *m_applicationAdaptor;

/// Assigned from the accessibility registry.
Expand Down
16 changes: 8 additions & 8 deletions src/gui/accessible/linux/dbusconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -66,7 +66,7 @@ DBusConnection::DBusConnection(QObject *parent)
}
}

QString DBusConnection::getAddressFromXCB()
QString QAtSpiDBusConnection::getAddressFromXCB()
{
QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
if (!app)
Expand All @@ -85,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();
Expand Down Expand Up @@ -113,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.");
Expand All @@ -130,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;
}
Expand All @@ -139,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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/accessible/linux/dbusconnection_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ QT_BEGIN_NAMESPACE

class QDBusServiceWatcher;

class DBusConnection : public QObject
class QAtSpiDBusConnection : public QObject
{
Q_OBJECT

public:
DBusConnection(QObject *parent = nullptr);
QAtSpiDBusConnection(QObject *parent = nullptr);
QDBusConnection connection() const;
bool isEnabled() const { return m_enabled; }

Expand Down
2 changes: 1 addition & 1 deletion src/gui/accessible/linux/qspiaccessiblebridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace Qt::StringLiterals;
QSpiAccessibleBridge::QSpiAccessibleBridge()
: cache(nullptr), dec(nullptr), dbusAdaptor(nullptr)
{
dbusConnection = new DBusConnection();
dbusConnection = new QAtSpiDBusConnection();
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.
Expand Down
4 changes: 2 additions & 2 deletions src/gui/accessible/linux/qspiaccessiblebridge_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ QT_REQUIRE_CONFIG(accessibility);

QT_BEGIN_NAMESPACE

class DBusConnection;
class QAtSpiDBusConnection;
class QSpiDBusCache;
class AtSpiAdaptor;
struct RoleNames;
Expand Down Expand Up @@ -60,7 +60,7 @@ public Q_SLOTS:
QSpiDBusCache *cache;
DeviceEventControllerAdaptor *dec;
AtSpiAdaptor *dbusAdaptor;
DBusConnection* dbusConnection;
QAtSpiDBusConnection* dbusConnection;
SpiRoleMapping m_spiRoleMapping;
};

Expand Down

0 comments on commit fc96d9d

Please sign in to comment.