From 363f069b0bb8f94b16d0431169a00adcbd2a17ff Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 19 Nov 2024 10:29:10 +0100 Subject: [PATCH] a11y atspi: Don't redefine libatspi constants Instead of redefining ATSPI_DBUS_* constants that are already defined in libatspi, just use those from libatspi's atspi/atspi-constants.h header directly. They are available in that public header since this libatspi 2.1.5 commit [1]: commit 1caa8f4613c87fec43406285a6597fd6f6408457 Author: Mike Gorse Date: Wed Jul 27 16:54:19 2011 -0500 Move DBus interface name constants into atspi-constants.h Move DBus interface name constants into a public header, so that they can be used by application-side AT-SPI code (ie, at-spi2-atk). Also, replace QSPI_REGISTRY_NAME and QSPI_OBJECT_PATH_ROOT with the corresponding libatspi constants ATSPI_DBUS_NAME_REGISTRY and ATSPI_DBUS_PATH_ROOT. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/1caa8f4613c87fec43406285a6597fd6f6408457 Change-Id: Idc7384fa70f36973260cb89dd1cf0fe9b5d16c73 Reviewed-by: Volker Hilsheimer --- src/gui/accessible/linux/atspiadaptor.cpp | 14 ++++---- .../linux/qspi_constant_mappings_p.h | 34 ------------------- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index 2bb8f205763..194e3e61448 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -667,7 +667,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const xml.append(tableCellIntrospection); if (interfaces.contains(ATSPI_DBUS_INTERFACE_VALUE ""_L1)) xml.append(valueIntrospection); - if (path == QSPI_OBJECT_PATH_ROOT ""_L1) + if (path == ATSPI_DBUS_PATH_ROOT ""_L1) xml.append(applicationIntrospection); return xml; @@ -913,7 +913,7 @@ bool AtSpiAdaptor::sendDBusSignal(const QString &path, const QString &interface, QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) const { - if (dbusPath == QSPI_OBJECT_PATH_ROOT ""_L1) + if (dbusPath == ATSPI_DBUS_PATH_ROOT ""_L1) return QAccessible::queryAccessibleInterface(qApp); QStringList parts = dbusPath.split(u'/'); @@ -1537,11 +1537,11 @@ bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const Q void AtSpiAdaptor::registerApplication() { OrgA11yAtspiSocketInterface *registry; - registry = new OrgA11yAtspiSocketInterface(QSPI_REGISTRY_NAME ""_L1, - QSPI_OBJECT_PATH_ROOT ""_L1, m_dbus->connection()); + registry = new OrgA11yAtspiSocketInterface(ATSPI_DBUS_NAME_REGISTRY ""_L1, + ATSPI_DBUS_PATH_ROOT ""_L1, m_dbus->connection()); QDBusPendingReply reply; - QSpiObjectReference ref = QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)); + QSpiObjectReference ref = QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(ATSPI_DBUS_PATH_ROOT)); reply = registry->Embed(ref); reply.waitForFinished(); // TODO: make this async if (reply.isValid ()) { @@ -1632,7 +1632,7 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS sendReply(connection, message, QVariant::fromValue(relationSet(interface, connection))); } else if (function == "GetApplication"_L1) { sendReply(connection, message, QVariant::fromValue( - QSpiObjectReference(connection, QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)))); + QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_ROOT)))); } else if (function == "GetChildren"_L1) { QSpiObjectReferenceArray children; const int numChildren = interface->childCount(); @@ -1749,7 +1749,7 @@ QString AtSpiAdaptor::pathForInterface(QAccessibleInterface *interface) const if (!interface || !interface->isValid()) return u"" ATSPI_DBUS_PATH_NULL ""_s; if (interface->role() == QAccessible::Application) - return u"" QSPI_OBJECT_PATH_ROOT ""_s; + return u"" ATSPI_DBUS_PATH_ROOT ""_s; QAccessible::Id id = QAccessible::uniqueId(interface); Q_ASSERT((int)id < 0); diff --git a/src/gui/accessible/linux/qspi_constant_mappings_p.h b/src/gui/accessible/linux/qspi_constant_mappings_p.h index ea571181e6f..d58e1445a22 100644 --- a/src/gui/accessible/linux/qspi_constant_mappings_p.h +++ b/src/gui/accessible/linux/qspi_constant_mappings_p.h @@ -28,46 +28,12 @@ QT_REQUIRE_CONFIG(accessibility); -// interface names from at-spi2-core/atspi/atspi-misc-private.h -#define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry" -#define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry" -#define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry" - -#define ATSPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root" - -#define ATSPI_DBUS_PATH_DEC "/org/a11y/atspi/registry/deviceeventcontroller" -#define ATSPI_DBUS_INTERFACE_DEC "org.a11y.atspi.DeviceEventController" -#define ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.a11y.atspi.DeviceEventListener" - -#define ATSPI_DBUS_INTERFACE_CACHE "org.a11y.atspi.Cache" -#define ATSPI_DBUS_INTERFACE_ACCESSIBLE "org.a11y.atspi.Accessible" -#define ATSPI_DBUS_INTERFACE_ACTION "org.a11y.atspi.Action" -#define ATSPI_DBUS_INTERFACE_APPLICATION "org.a11y.atspi.Application" -#define ATSPI_DBUS_INTERFACE_COLLECTION "org.a11y.atspi.Collection" -#define ATSPI_DBUS_INTERFACE_COMPONENT "org.a11y.atspi.Component" -#define ATSPI_DBUS_INTERFACE_DOCUMENT "org.a11y.atspi.Document" -#define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT "org.a11y.atspi.EditableText" -#define ATSPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.a11y.atspi.Event.Keyboard" -#define ATSPI_DBUS_INTERFACE_EVENT_MOUSE "org.a11y.atspi.Event.Mouse" -#define ATSPI_DBUS_INTERFACE_EVENT_OBJECT "org.a11y.atspi.Event.Object" -#define ATSPI_DBUS_INTERFACE_HYPERLINK "org.a11y.atspi.Hyperlink" -#define ATSPI_DBUS_INTERFACE_HYPERTEXT "org.a11y.atspi.Hypertext" -#define ATSPI_DBUS_INTERFACE_IMAGE "org.a11y.atspi.Image" -#define ATSPI_DBUS_INTERFACE_SELECTION "org.a11y.atspi.Selection" -#define ATSPI_DBUS_INTERFACE_TABLE "org.a11y.atspi.Table" -#define ATSPI_DBUS_INTERFACE_TEXT "org.a11y.atspi.Text" -#define ATSPI_DBUS_INTERFACE_VALUE "org.a11y.atspi.Value" -#define ATSPI_DBUS_INTERFACE_SOCKET "org.a11y.atspi.Socket" - // missing from at-spi2-core: #define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window" #define ATSPI_DBUS_INTERFACE_EVENT_FOCUS "org.a11y.atspi.Event.Focus" #define QSPI_OBJECT_PATH_ACCESSIBLE "/org/a11y/atspi/accessible" #define QSPI_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/" -#define QSPI_OBJECT_PATH_ROOT QSPI_OBJECT_PATH_PREFIX "root" - -#define QSPI_REGISTRY_NAME "org.a11y.atspi.Registry" QT_BEGIN_NAMESPACE