Commit Graph

925 Commits

Author SHA1 Message Date
Matthias Clasen
4c1bc93f6f a11y: Be safe against state type changes
For some of the a11y states, calling gtk_accessible_reset_state
can change the type of the state value from boolean or tristate
to undefined.

Handle that, instead of throwing criticals.

Related: !4910
2022-09-09 16:07:24 -04:00
Mat
df40efd50d gtkatspiselection: Retrieve the correct GtkNotebook tab widget
A typo resulted in the tab container widget being retrieved instead of
the tab widget. If an adjacent action widget was present, an infinite
loop occurred when switching tabs while a screen reader was enabled.
2022-08-28 17:02:01 +03:00
Matthias Clasen
e81db46578 a11y: Fix a memory leak
We need to free the queued context list in dispose
if we didn't get to register the contexts, and we also
need to free the list properly when we do get to
register them.

This showed up in valgrind as leaked GList structs.
2022-08-12 12:01:42 -04:00
Emmanuele Bassi
d030c92d63 Move private function out of the AT-SPI a11y backend
The textbuffer test is calling into a function defined by the AT-SPI
accessibility backend. As of commit 4ddf1b70 we only build and run the
test on Linux, but the function in question isn't really
accessibility-related: it's just a serialization function.
2022-08-04 23:34:41 +01:00
Benjamin Otte
e437a9c348 inscription: Add a11y support for text interface
This is entirely untested.
2022-06-11 02:15:08 +02:00
Matthias Clasen
0e6a3ab397 Merge branch 'ebassi/a11y-text-extents' into 'main'
a11y: Implement atspi.Text.GetCharacterExtents for GtkTextView

See merge request GNOME/gtk!4754
2022-06-02 17:13:53 +00:00
Carlos Garnacho
e895f7dd70 a11y: Transform GetCharacterExtents coords to native surface ones
These coordinates are "window"-relative, so transform textview coordinates
to the coordinate system of the GtkNative containing it.
2022-06-02 14:35:53 +02:00
Sebastian Keller
6e3dbc42a8 a11y: Realize GtkStackPage parent context before trying to get a ref
If a context is not realized, calling gtk_at_spi_context_to_ref() will
return a null ref, because its path has not been initialized yet. This
was already done for all other cases in get_parent_context_ref(), but
was missing for the GtkStackPage case.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4944
2022-05-25 14:56:05 +02:00
Emmanuele Bassi
7750a2c423 a11y: Implement atspi.Text.GetCharacterExtents for GtkTextView
Retrieve the location of a given offset in window-relative coordinate
space.
2022-05-23 15:54:13 +01:00
Federico Mena Quintero
737854aa0d Don't cast GtkWrapMode to the incompatible enum PangoWrapMode
The enum values are not compatible, and moreover, there is an extra
GTK_WRAP_NONE that PangoWrapMode doesn't have - thus,
pango_wrap_mode_to_string() will assert.

As far as I can tell, Orca does not read the wrap-mode key in the
dictionary for text attributes, anyway.

Fixes: #4869
2022-04-26 13:43:19 -05:00
Emmanuele Bassi
17262d1572 a11y: Defer object registration after root registration
The root accessible object is registered asynchronously, as it needs to
call a method on the AT-SPI registry daemon. This means we need to defer
registering the GtkAtSpiContext on the accessibility bus and in the
cache until after the registration is complete.

Fixes: #4825
2022-04-19 16:35:27 +01:00
Matthias Clasen
feac1e5fba Use pango api better
Avoid direct access to PangoLayoutLine members,
use pango api for it where we can.
2022-01-22 23:10:53 -05:00
Christian Hergert
2fa9f934b6 a11y: return -1 if parent is NULL 2021-12-14 21:18:13 +01:00
Samuel Thibault
c5786916f7 Revert "a11y: return -1 if parent is NULL"
This reverts commit 22847563ce.
2021-11-20 10:59:00 +01:00
Christian Hergert
22847563ce a11y: return -1 if parent is NULL 2021-11-19 11:59:29 -08:00
Matthias Clasen
7bee4fa44b Handle new pango api
The PangoVariant enumeration has gained new values
to match css. Handle those in switches.
2021-11-08 14:17:42 -05:00
Matthias Clasen
01abd1565e a11y: Simplify atspi context a bit
We don't really need a bus-address property
that gets copied for every single object.
We keep the address in object data on the
display anyway. Just use it from there.

This gets rid of a nice amount of strdups
at startup.
2021-09-29 10:58:23 -04:00
Mike Gorse
5d7ecb7a6e a11y: Remove unneeded check 2021-07-30 08:58:27 -05:00
Mike Gorse
7fc90aed26 a11y: Send correct object reference for the root accessible 2021-07-29 15:55:58 -05:00
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Matthias Clasen
3ab97fac1f Cosmetics: Eradicate gdouble
Remove 3 errant uses of gdouble.
2021-06-03 17:41:28 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Matthias Clasen
6863528df1 a11y: Static analysis fixes 2021-05-03 07:44:38 -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
Matthias Clasen
b97d0a3940 a11y: Avoid spurious selection changed events
Only send selection-changed events when we either
had a non-empty selection before, or have one now.

This should help orca speak the right things, and
not the wrong things.

Related: #3549
2021-04-20 13:23:56 -04: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
9fbd11e1be a11y: Add the root object to the cache
Not 100% sure this is necessary, but maybe it helps
to get orca up to speed.
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
Matthias Clasen
aa5bd38137 a11y: Avoid out-of-bounds access
Don't use the index before we've checked its good.

Pointed out in https://www.viva64.com/en/b/0793/
2021-02-04 00:34:05 -05:00
Emmanuele Bassi
0bde58ffd7 a11y: Avoid signal emission during cache population
If we're responding to a request to get all the cached items, there's no
need to emit signals when adding an ATContext to the cache.
2021-01-21 16:40:57 +00:00
Emmanuele Bassi
a56b2900dd a11y: Fix leak
Introduced by me in commit 03b60a2d5e.
2021-01-12 12:01:29 +00:00
Emmanuele Bassi
03b60a2d5e a11y: Sanitize the AT-SPI object path further
When falling back to g_get_prgname(), we need to take into account that
the program name may be the full argv[0] path, which will end up messing
the DBus object path.
2021-01-12 11:15:28 +00: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
16b5a88097 a11y: Check before disconnecting Text signals
Use the same initial check for the accessible object type that we use
when connecting the signal, in case we try to disconnect signals on
different widgets. Additionally, check before accessing data that might
have already been removed.

Fixes: #3403
2020-11-25 18:15:04 +00:00
Emmanuele Bassi
fdf2e046c3 a11y: Check before disconnecting selection signals
If the selection data has already been cleared we should just bail out.

Fixes: #3404
2020-11-25 18:13:54 +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
e600a07237 a11y: Skip atspi.Cache signals for hidden elements
If the accessible object is hidden, we can skip the emission of the
AddAccessible and RemoveAccessible signals on the cache, as those
objects won't be visible in the accessibility tree.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
d436c2e839 a11y: Remove weak ref from atspi.Cache
The GtkAtSpiContext is responsible for removing itself from the root,
which will remove itself from the cache. Any code path that leads to the
GtkAtSpiContext instance being collected passes through the
unrealization phase, which will also unregister the context from the
accessibility bus and from the cache.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
b37634dcd5 a11y: Add a fallback for the root base path
In case g_get_prgname() returns NULL, which seems to be the case for the
GTK tests.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
2d636fdda0 a11y: Reuse the generated AT-SPI interface name
We already have the name available.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
28095641c5 a11y: Use the appropriate GVariant for cache signals
We need to wrap the argument for AddAccessible and RemoveAccessible into
a tuple, as that's what GDBus expects.
2020-11-19 12:14:55 +00:00
Emmanuele Bassi
bb1463871c a11y: Ensure valid object paths in the fallback code
When falling back to using the program name to create a unique base path
for the objects on the accessibility bus we need to ensure that the name
is a valid DBus object path.
2020-11-16 17:47:15 +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
ee056fd8bd a11y: Update the Cache interface introspection
The type for cached items is, unsurprisingly, wrong when compared to the
implementation inside atk-spi2-atk.
2020-11-16 16:44:56 +00:00