Commit Graph

93 Commits

Author SHA1 Message Date
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Emmanuele Bassi
8f9145109b a11y: Pair window:activate with window:deactivate signal
Orca needs both events in order to decide whether or not to subscribe to
other event/state changes in a window.
2021-04-21 10:22:20 +01:00
Emmanuele Bassi
639932ad8a a11y: Emit window:activate event
Orca uses the window:activate event type to track top levels, and avoid
being spammed by events coming from non-focused windows.
2021-04-20 17:24:13 +01:00
Matthias Clasen
ae83b79984 a11y: Emit focus events
Orca relies on these to keep track of the focus location,
ignoring the focused state. With this change, orca can
once again speak text in entries as I type.
2021-04-19 21:29:17 -04:00
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
aa09737d4d atspicontext: Remove an unused field
We don't make any use of the cache field, so drop it.
2021-04-19 19:22:20 +01:00
Matthias Clasen
a804e4bd8c a11y: Add more debug spew
This is in an attempt to figure out why orca won't speak.
2021-04-17 12:00:17 -04:00
Matthias Clasen
367dfee36e Fix unused variable warnings
These happen for variables which are only used
in assertions, when assertions are disabled.
2021-04-12 21:22:46 -04:00
Emmanuele Bassi
f6c53ced0d a11y: Plug a leak in the AT-SPI context
Fixes: #3450
2020-12-05 20:25:30 +00:00
Emmanuele Bassi
ef86e46238 a11y: Cache the accessibility bus address
Just check for it once; doing it every time we failed to create an
ATContext is just going to fill up the logs.
2020-11-23 14:34:46 +00:00
Emmanuele Bassi
0a46baeb56 a11y: Turn critical warnings into debug messages
The accessibility bus might not be available, and if it isn't the case,
it means something has failed at a level where the user can't do much
about it. There's no need to emit a critical warning.
2020-11-23 14:34:46 +00:00
Emmanuele Bassi
9de2b4b0e1 a11y: Implement atspi.Cache
The AT-SPI cache interface is used to quickly populate the accessible
objects tree.

The tricky bit is ensuring that we emit change notifications on the
cache only when the cache is available, which means waiting until the
root is asynchronously registered.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
bc4f71a107 a11y: Add getters for GtkAtSpiContext
We are going to use them in order to implement atspi.Cache.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
eec92b40ea a11y: Compute the base path in the root object
The root path is shared by all AtSpiContext instances, so we should
compute it once, instead of every time we instantiate a new context.

This allows us to defer the path creation at realization time and ensure
that we have a registered application.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
2285382074 a11y: Create AtSpiRoot on realization
There's no need to do a lot of work on construction, if we're delaying
all remote work after the GtkATContext is realized.

The GtkAtSpiContext should also keep a reference on the root, and drop
it at unrealize time.
2020-11-11 18:46:44 +00:00
Emmanuele Bassi
65d29e00c7 a11y: Realize parent ATContext for the stack page
Just like for popovers, the stack page is not directly connected on the
widget's DOM, so we need to realize the parent ATContext ourselves.
2020-11-11 18:33:15 +00:00
Matthias Clasen
5379a4bf34 a11y: Clean up properly in unregister_object
Things that are set up in register_object should
be cleaned up in unregister_object.
2020-11-09 18:48:10 -05:00
Emmanuele Bassi
ba63aa76ca a11y: Move parent context ref getter to its own function
Keeps the body of handle_accessible_get_property() readable.
2020-11-04 17:16:24 +00:00
Emmanuele Bassi
30210c7087 a11y: Move ATContext to an explicit realization model
We are doing too much work during the construction phase of the
AT-SPI backend for GtkATContext. Instead of having the AtSpiContext
register itself at construction time, let's add explicit realize
and unrealize operations, and connect the ATContext realization to the
rooting operation of a GtkWidget.
2020-11-04 15:02:44 +00:00
Matthias Clasen
d5b9489408 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #3282

See merge request GNOME/gtk!2755
2020-10-27 22:38:58 +00:00
Matthias Clasen
8ffb398517 a11y: Handle all cases for state change
Make state_change handle state changes for non-widgets,
and handle the cases for HIDDEN involving stack pages.
2020-10-24 22:05:17 -04:00
Matthias Clasen
2546b88661 a11y: Redo child-added/-removed for toplevels
Instead of monitoring the list of toplevels, rely
on GtkWindow updating the HIDDEN state before windows
get removed. This is better, since we still have the
object available when it happens, so we can pass it
to the ATs.
2020-10-24 15:26:12 -04:00
Matthias Clasen
274f9ad919 a11y: Emit child notification when toplevels get hidden
When a toplevel window gets hidden (and not destroyed),
the frontend code set the HIDDEN state, and we need to
emit child notification when that happens.
2020-10-24 13:17:20 -04:00
Matthias Clasen
89a8c89663 a11y: Improve child index helpers
We need to use gtk_accessible_should_present() whenever we
calculate accessible tree positions, to avoid inconsistencies.

While we are at it, make these helpers usable for finding
the position of accesibles that are now ignored, by not
looking at should_present for the object itself. This will
be relevant when we calculate the position of objects whose
HIDDEN state changes.
2020-10-24 13:14:44 -04:00
Matthias Clasen
46e754a17d a11y: Skip non-presented children when required
Whenever we determine the index of a child, we need
to skip its non-presented siblings.
2020-10-24 11:22:09 -04:00
Matthias Clasen
b12992c1cb a11y: Handle HIDDEN state changes
Hidden elements are not presented in the accessible
tree, so when then HIDDEN state changes, we should
emit child-added or -removed signals.

This commit does not yet handle all cases (HIDDEN
toplevels or hidden stack pages are not handled),
but it should cover the common case.
2020-10-24 11:17:56 -04:00
Timm Bäder
41ef1d87ef atspicontext: Add a few missing break statements 2020-10-22 17:46:34 +02:00
Matthias Clasen
a11ab6c995 a11y: Handle stack case for addition/removal
Since we interpose stack pages as non-widget accessibles,
we need to tweak the signals we emit when their corresponding
widgets get added or removed.
2020-10-22 10:06:06 -04:00
Emmanuele Bassi
698cbee1fb a11y: Move ChildrenChanged emitter to ATSPI utilities
We are going to use it from GtkAtSpiRoot, which is not a
GtkAtSpiContext.
2020-10-21 15:18:23 +01:00
Emmanuele Bassi
f1e14c4858 a11y: Implement ChildrenChanged atspi.Event 2020-10-21 14:33:20 +01:00
Matthias Clasen
e20a3339bf atsi: Fix emission of text selection changes
We were not emitting text-selection-changed and
text-caret-moved as expected.
2020-10-20 21:31:23 -04:00
Matthias Clasen
eeae1b1ea7 a11y: Fix accessible tree inconsistency
The stack page objects were not properly integrated
in the accessible tree - they were appearing as parent
of the pages when navigating up, but not as children
of the stack when navigating down.
2020-10-19 21:15:44 -04:00
Emmanuele Bassi
51f5690ae3 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2720
2020-10-19 20:26:57 +00:00
Matthias Clasen
77d1026c5a atspi: Use name and description as provided
GtkATContext already does fallbacks to derive values
for these, so no need for the atspi implementation to
do its own fallback on top of that.
2020-10-19 14:57:43 -04:00
Emmanuele Bassi
7c7dabae8c a11y: Rework accessible name/description computation
The ARIA spec determines the name and description of accessible elements
in a more complex way that simply mapping to a single property; instead,
it will chain up multiple definitions (if it finds them). For instance,
let's assume we have a button that saves a file selected from a file
selection widget; the widgets have the following attributes:

 - the file selection widget has a "label" attribute set to the
   selected file, e.g. "Final paper.pdf"
 - the "download" button has a "label" attribute set to the
   "Download" string
 - the "download" button has a "labelled-by" attribute set to
   reference the file selection widget

The ARIA spec says that the accessible name of the "Download" button
should be computed as "Download Final paper.pdf".

The algorithm defined in section 4.3 of the WAI-ARIA specification
applies to both accessible names (using the "label" and "labelled-by"
attributes), and to accessible descriptions (using the "description" and
"described-by" attributes).
2020-10-19 17:54:14 +01:00
Matthias Clasen
04a51837f7 atspi: Emit bounds-changed
This is using the new bounds_change vfunc in GtkATContext.
2020-10-19 12:19:55 -04:00
Matthias Clasen
8e4f8a45a9 atspi: Implement Component
Implement the non-questionable parts of the Component interface
for accessibles which are widgets.

This does not include:
 - global coordinates
 - setters
 - scrolling
 - alpha, layers, zorder, and the like
2020-10-19 12:19:55 -04: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
dfe00c4ac4 atspi: Be more careful
We have non-widget accessibles now, so guard against
change notification being emitted on them.
2020-10-19 12:09:08 -04:00
Matthias Clasen
5bb656af4c Cosmetics
Add some more fold markers.
2020-10-19 12:08:47 -04:00
Emmanuele Bassi
374bd21340 Initial ATSPI Action implementation for widget
Use the actions from the GtkActionMuxer of each widget to populate the
list of actions available.
2020-10-16 00:34:01 +01:00
Matthias Clasen
8a14f019d0 atspi: Add fold markers
This makes it much easier to navigate in these
multi-implementation files.
2020-10-15 13:14:56 -04:00
Matthias Clasen
f4f732694a atspi: Add some docs
Add a comment that explains a few of the more subtle
points of the Atspi context tree contstruction.
2020-10-14 21:04:25 -04:00
Matthias Clasen
bf04beb711 atspi: Implement Selection for notebook tabs
This is a bit different from the way things were done
in GTK 3 - we follow what was done for GtkStackSwitcher,
and make the tab bar carry the GTK_ACCESSIBLE_TAB_LIST
role, and implement Selection there.
2020-10-14 21:04:25 -04:00
Matthias Clasen
41d4c37563 atspi: Don't crash on unnamed stack pages
GtkNotebook creates unnamed stack pages, and we should
not crash when that happens.
2020-10-14 21:04:25 -04:00
Matthias Clasen
7c6c718e19 stack: Turn pages into accessibles
This requires some cleanup to remove assumptions
about accessibles being widgets in the backend,
and some code to navigate the tree with these
extra objects in between widgets.

The accessibles for stack pages have the role
GTK_ACCESSIBLE_ROLE_TAB_PANEL. This is the first
step towards implementing the tabs patterns
as described in the aria authoring guidelines
for GtkStack.
2020-10-14 21:04:17 -04:00
Matthias Clasen
32d8db103a Cosmetics
Avoid typo-prone repetition of the full interface names.
We have them in the introspection data already.
2020-10-13 18:58:25 -04:00
Matthias Clasen
caeea0e368 Remove excessively spammy debug messages
Non need to announce the same things for every context
we create, and the path is not really that interesting.
without knowing what it belongs to. I would suggest to
make it visible in the inspector instead, so you can
look it up for the widgets you are interested in.
2020-10-13 17:24:06 -04:00
Matthias Clasen
d0753f645e Fix compiler warnings 2020-10-13 17:24:06 -04:00
Matthias Clasen
81e107885c Remove some unused code 2020-10-13 17:24:06 -04:00