Commit Graph

66488 Commits

Author SHA1 Message Date
Matthias Clasen
4b212f9e04 Simplify GetInterfaces handling
It is error prone to keep the same conditions in sync
in two places. Instead, just assemble the list of interfaces
as we register objects, and use when GetInterfaces is called.
2020-10-11 11:47:13 -04:00
Matthias Clasen
464ec29e27 atspi: Implement Value for more widgets
Apply the Value implementation to the widgets where
we had one in GTK 3: GtkLevelBar, GtkRange, GtkScaleButton,
GtkSpinButton, GtkPaned, GtkProgressBar. To make these
work, the widgets need to set the accessible value properties.
2020-10-11 11:47:13 -04:00
Matthias Clasen
2648f34b1b atspi: Implement Value interface for ranges 2020-10-11 00:27:55 -04:00
Matthias Clasen
8fdd4285f9 atspi: Implement Text interface for text views
With this, all relevant widgets support the
Text interface.
2020-10-10 23:51:23 -04:00
Matthias Clasen
7478ff1a4b atspi: Add textview utilities
These are very similar to the pango utilities,
and are copying code from the textview accessible
implementation in GTK 3.
2020-10-10 23:51:23 -04:00
Matthias Clasen
7969287148 atspi: Export more pango utils
We are going to reuse some of the code that does
the pango -> atspi attribute conversion for text
tags.
2020-10-10 23:50:39 -04:00
Matthias Clasen
9d3c28e4db atspi: Implement text for GtkText widgets too
There is some open question here whether the interface
should be implemented on the outer or the inner widget
of the entry-text pairs. For now, our hand is forced,
since only GtkText provides access to the layout that
we need for implementing many of the interface methods.
2020-10-10 20:38:24 -04:00
Matthias Clasen
021e8e4e3a atspi: Implement Text interface for labels
This is a not-quite-complete implementation of the
Text interface for GtkLabel. The missing parts are
anything around extents and positions, as well as
the ScrollSubstring apis.
2020-10-10 19:43:42 -04:00
Matthias Clasen
5382717616 atspi: Add pango utilities
This code is more or less a direct copy of what
we had in gtkpango.c in 3.x.
2020-10-10 19:43:42 -04:00
Matthias Clasen
b027d773ca atspicontext: Fix GetIndexInParent for toplevels
For toplevels, we need to return the index in the
list of toplevels, since that is what GtkAtspiRoot
is using.
2020-10-10 13:45:18 -04:00
Matthias Clasen
77935f73cc atcontext: labelled-by has a reference list
This is unclear - our docs state that all the
relations have value type reference, but in fact
they all have value type reference list.
2020-10-10 13:45:18 -04:00
Matthias Clasen
450e51fd4b atspicontext: Implement GetRelationSet
This translates relations as far as the match.

I'm not sure yet what we can do about the fact that
atspi expects relations to be bidirectional (ie have
label-for *and* labelled-by) while aria has only one
direction.
2020-10-10 13:45:18 -04:00
Matthias Clasen
b13d3666f9 atspiroot: Stub out GetRelationSet
This needs to be fully implemented, for now sending
an empty relation set back prevents accerciser from
getting hung up.
2020-10-10 13:45:18 -04:00
Matthias Clasen
5152bea86f atspi: Add the AtspiRelationType enum
This is what we need to map the aria relation
types to.
2020-10-10 13:45:18 -04:00
Matthias Clasen
1f01546232 Move atspi enums to gtkatspiprivate.h 2020-10-10 13:45:18 -04:00
Matthias Clasen
8173fb7a08 Add a GetInterfaces method
It turns out that accerciser depends on this undocumented
method that is not in the xml at all, otherwise interface
sections in the accerciser ui never get enabled.
2020-10-10 13:45:18 -04:00
Matthias Clasen
2f33ef6f02 Don't pass NULL to g_variant_new_string
That does not work.
2020-10-10 13:45:18 -04:00
Matthias Clasen
2c812d5437 atspi utils: Fix an oversight
gtk_accessible_role_to_atspi_role must always return
an atspi role. The fallback was returning an aria
role.
2020-10-10 13:45:18 -04:00
Matthias Clasen
c5d9694573 Fixup: Add a forgotten #pragma once 2020-10-10 13:45:18 -04:00
Emmanuele Bassi
3b92caba7d a11y: Convenience API for referencing ATSPI root node
We turn the root node into a reference fairly often, so it's worth it to
have a utility function that does this for us.
2020-10-10 13:23:21 +01:00
Emmanuele Bassi
d7e4e8bfeb a11y: Add utility function for null refs
ATSPI was written for CORBA, which allows passing around "nil"
as valid object references.
2020-10-10 13:16:15 +01:00
Matthias Clasen
ab48a745dd atspicontext: Implement GetState
Translate the aria states to at-spi's interpretation
of atk states.
2020-10-10 13:10:36 +01:00
Matthias Clasen
e823218ee7 atspiroot: Fix GetState implementation
When the GetState signature says 'au', it actually
means a bitset that is sent as a pair of 32bit integers.
2020-10-10 13:10:36 +01:00
Matthias Clasen
9ab449e0af atspiroot: Implement GetIndexInParent
Just for good measure
2020-10-10 13:10:36 +01:00
Matthias Clasen
049a06b6a6 atspicontext: Implement GetIndexInParent
This is needed for ATs to take our tree seriously.
2020-10-10 13:10:36 +01:00
Matthias Clasen
b39f2b6465 atspicontext: Implement more accessible api
Implement GetChildAtIndex, GetChildren and ChildCount.
2020-10-10 13:10:36 +01:00
Matthias Clasen
c78019852e atspiroot: Implement GetChildren
No surprises here.
2020-10-10 13:10:36 +01:00
Matthias Clasen
948845b28b atspiroot: Don't leak references
The reffing getter trap, lurking behind g_list_model_get_item().
2020-10-10 13:10:36 +01:00
Matthias Clasen
416d7de267 atspiroot: Implement GetLocale 2020-10-10 13:10:36 +01:00
Matthias Clasen
af99e4ca4b atspicontext: Print out the a11y bus address
Make our debug spew useful: Having the bus address
makes it easy to jump on the a11y bus to look around
with dbus tools.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
5a733854b6 a11y: Localise the role name of the root node 2020-10-10 13:10:36 +01:00
Emmanuele Bassi
19eb3019fe ci: Use test AT context with installed tests
Otherwise we're going to need an AT-SPI service on the session, and the
accessibility bus.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
ad5277145e a11y: Register the Accessible interface on all AtSpiContext instances
This is not a complement implementation.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
32ab032cfa a11y: Implement more ATSPI methods on the root node 2020-10-10 13:10:36 +01:00
Emmanuele Bassi
7661759acd a11y: Add method to extract desktop data
We are going to need the desktop name and path to populate the parent
property of AtSpiContexts associated to top level widgets.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
468317fef2 a11y: Validate the DBus context path
UUIDs use dashes to separate the various blocks; unfortunately, this
results in an invalid DBus object path. Replace the dashes with an
underscore.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
343c9ca4fc a11y: Turn accessible roles to string
Add a simple utility function to turn GtkAccessibleRole values into the
appropriate string, including localization.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
edd05cd69b a11y: Convert GTK roles to ATSPI ones
There's not a precise, 1:1 mapping between the newer ARIA roles and the
older ATSPI ones. We make do with what we have.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
47e537678d a11y: Compute the label for a GtkATContext
The ARIA spec defines the mechanism for determining the name of an
accessible element—see §4.3 of the WAI-ARIA spec.

We follow the specification as much as it makes sense for GTK to do
so:

 1. if the element is hidden, return an empty string
 1. if the element has a labelled-by relation set, retrieve the
    label of the related element
 2. if the element has a label property set, use the value of
    the property
 3. if neither labelled-by nor label attributes are set, we use
    the role to compute the name:
   - for a `range` role, we return the contents of the value of
     the `value-text` or `value-now` properties
   - for any other role, we return a textual representation of
     the GtkAccessibleRole enumeration value
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
fb552ba10a tests: Use the test ATContext for every test
Otherwise we're going to need a full desktop session in order to run the
test suite.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
33d9f46574 a11y: Return the ATSPI role for the root element 2020-10-10 13:10:36 +01:00
Emmanuele Bassi
ae7429a7d0 a11y: Add AT-SPI cache object
Right now, the cache is unused, and we still need to implement the
serialisation method and emit the signals.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
d6554e37b6 a11y: Ignore widgets during destruction
There's no point in creating a GtkATContext when a widget is getting
destroyed.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
67c91bad5f a11y: Register the accessible root object
When we create the first AT-SPI context we also need to register the
accessible root on the accessibility bus. The accessible root object is
the main entry point of an accessible application, and it holds the
global state to present to the ATs that connect to the bus.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
65e6e9854e a11y: Add a display to GtkATContext
Since we need to check at run time what kind of AT context to use, we
need a hook into the whole GDK backend machinery. The display connection
seems to be the best choice, in this case, as it allows us to determine
whether we're running on an X11 or Wayland system, and thus whether we
should create a GtkAtSpiContext.

This requires some surgery to fix the GtkATContext creation function, in
order to include a GdkDisplay instance.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
a9a5453a4b a11y: Add dummy AT-SPI context
Does not do anything, at the moment, but it's going to get filled out
soon.

The backend is selected depending on the platform being compiled in;
since we're using AT-SPI on X11 and Wayland, and we don't have other
accessibility implementations, we currently don't care about run time
selection, but we're going to have to deal with that.
2020-10-10 13:10:36 +01:00
Emmanuele Bassi
5b4ae36c64 a11y: Add the AT-SPI DBus descriptions
And generate the code for the DBus interfaces.

We don't want the full object manager experience, here, because we're
going to have a single object responding to various interfaces and
remote method calls. For this reason, we're not using the gnome module
in Meson to call gdbus-codegen for us: we need to use the interface info
command line arguments, and those are not available from Meson.
2020-10-10 13:10:36 +01:00
Piotr Drąg
91ba0a31e7 Update Polish translation 2020-10-10 12:45:37 +02:00
Marek Černocký
72ea3a1655 Updated Czech translation 2020-10-10 12:17:27 +02:00
Matthias Clasen
758675f44e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3242 and #3240

See merge request GNOME/gtk!2679
2020-10-09 13:35:57 +00:00