Commit Graph

20 Commits

Author SHA1 Message Date
Matthias Clasen
9e8187bdc4 a11y: Track window states more closely
Orca ignores events unless the object is inside an object
with role window and states ACTIVE and SHOWING. To arrange
for this, introduce a new ACTIVE platform state, and set it
for windows when they are active.

This gets orca to be a lot more talkative.
2021-04-19 19:22:20 +01:00
Matthias Clasen
a04ce41799 testatcontext: Print out platform changes
This helps debugging what changes orca sees.
2021-04-17 12:00:11 -04:00
Emmanuele Bassi
73dda96711 docs: Add missing stanzas for gtk_test_accessible API 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
292576f312 a11y: Defer to the GtkAccessible's implementation
Since GtkATContexts are now lazily realized, we need to go through the
GtkAccessible's implementation to access the :accessible-role property,
in case there are fallbacks.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
c264254d4b a11y: Parse reference lists using varargs
Using GList is a bit lame, and makes the API more complicated to use
than necessary in the common case.

The only real use case for a GList is gtk_widget_add_mnemonic_label(),
and for that we can use the GValue-based API instead.

Fixes: #3343
2020-11-10 14:31:56 +00:00
Emmanuele Bassi
0af6630521 a11y: Consolidate accessibility environment variables
Use a single environment variable for everything:

 - select the ATContext implementation
 - select the test ATContext
 - disable ATContext entirely

We use the same pattern as GSK_RENDERER, GTK_DEBUG, etc.

The documentation needs to be updated to include the environment
variable.
2020-11-09 16:21:49 +00:00
Matthias Clasen
3ad03b1706 a11y: Add a separate vfunc for platform changes
The state_change vfunc is becoming unwieldy. Lets move
the platform changes to their own vfunc, as a start.
2020-10-19 12:09:08 -04:00
Matthias Clasen
b5ee73d299 a11y: Pass on platform changes
Add an enum for 'platform changes' to the at context
change notification mechanism. This will let us pass
along things that ARIA considers 'platform state' such
as focus or editability. The difference between the
platform state and other ARIA states is that we don't
keep the platform state separately in the at context
- backends are expected to just query the widgets.

This is just about avoiding notify listeners for
change notification.
2020-10-12 15:10:40 -04:00
Matthias Clasen
f7eb5f8897 a11y: Don't do unnecessary work
Only serialize all the attributes if we are actually
going to print them.
2020-08-04 11:02:00 -04:00
Emmanuele Bassi
bf06cad5d9 a11y: Add proper error reporting to value collection
We're currently overloading NULL to mean both "this value is undefined,
and should be reset to its default" and "the value collection failed".
Let's do error reporting right, by using GError to mean "the collection
failed, for this specific reason"; then, we can use a NULL return value
to signal that the accessible attribute should be reset to its default
value.

This is only relevant for pointer-sized attribute values: strings,
references, and reference lists; numeric, boolean, tristate, and token
values either cannot be undefined, or have a specific "undefined" value.
2020-07-28 16:49:13 +01:00
Emmanuele Bassi
3d642460e7 a11y: Simplify the test API
We don't need as many functions to print out the property, relation, and
state of an accessible. Additionally, we should allow comparing the
accessible attributes with an expected value, and print out the real
accessible value if they do not match.
2020-07-26 21:27:03 +01:00
Emmanuele Bassi
dc1c1e8af9 a11y: Add more test API 2020-07-26 20:49:08 +01:00
Emmanuele Bassi
296f0844df Fix build with debugging notes disabled 2020-07-26 20:31:15 +01:00
Matthias Clasen
609383f93c testatcontext: Print role nicks
This makes for easier reading.
2020-07-26 20:31:15 +01:00
Matthias Clasen
0b6df9efe7 testatcontext: Use the new debug flag
Only dump a11y state if GTK_DEBUG=accessibility is set.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
0d87f8cd62 a11y: Add testing API
We want to test the accessibility API, as well as the implementation
inside each widget. For that, we should expose an API that lets us
verify that a GtkAccessible has a given role, as well as a given
property.

The API follows the pattern of other GTest API:

 - a macro to assert that a condition is respected
 - a function that prints out the error message in case of failure
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
732578eb53 a11y: Consolidate the attributes container
While we have split the various attributes for convenience, there's no
reason why we should have specialised data types for the attributes
container object.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
1124f2507d a11y: Add relations API
Since we split relation attributes from the generic properties, we need
to add API for setting and retrieving their values.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
da1ce01a6f Add accessible properties to GtkAccessible
We propagate the accessible state and properties to each ATContext in
the same virtual function, since they are functionally similar.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
a382dfd3bd Add GtkATContext
The ATContext type is meant to be used as the base class for
implementations of the assistive technology API—the actual mechanism
needed to communicate to components like the screen reader, or any other
AT.

Every time the widget state changes, the ATContext is meant to broadcast
the state change; and every time the AT queries the state of a UI
element, the ATContext is meant to provide that information.

We also have a "test" ATContext implementation, which is meant to be
used to write tests to verify that changes are propagated without
requiring a whole desktop session.
2020-07-26 20:31:14 +01:00