Skip to content

Commit

Permalink
a11y atspi: Don't redefine libatspi constants
Browse files Browse the repository at this point in the history
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 <mgorse@linux-l2tz.site>
    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 <volker.hilsheimer@qt.io>
  • Loading branch information
michaelweghorn committed Nov 21, 2024
1 parent a8c9a56 commit 363f069
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 41 deletions.
14 changes: 7 additions & 7 deletions src/gui/accessible/linux/atspiadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'/');
Expand Down Expand Up @@ -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<QSpiObjectReference> 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 ()) {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
34 changes: 0 additions & 34 deletions src/gui/accessible/linux/qspi_constant_mappings_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 363f069

Please sign in to comment.