diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-13 16:16:55 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-14 08:09:38 +0100 |
commit | 42f839a5371ffc25e7181606b53d339ba0c8c9ee (patch) | |
tree | 92655ce406ec93ac603a4f884f75e8129efcd069 | |
parent | 4ae31181cdd857b896c9fb6ab1fa57a41d76025f (diff) |
gtk4 a11y: Set accessible name and description
Set the accessible name and accessible description
via the corresponding properties in the gtk4 a11y API,
`GTK_ACCESSIBLE_PROPERTY_LABEL` (accessible name) and
`GTK_ACCESSIBLE_PROPERTY_DESCRIPTION` (accessible description).
Drop the initial proof of concept that was setting the
text returned by the Text interface as accessible name instead.
This also makes it much easier to find a specific item in
the LO a11y tree in Accerciser.
Change-Id: I9dac4c33185b589a63dda03fa7dd342a6ed460ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159385
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | vcl/unx/gtk4/a11y.cxx | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx index 2dad6615e1e3..43835956581a 100644 --- a/vcl/unx/gtk4/a11y.cxx +++ b/vcl/unx/gtk4/a11y.cxx @@ -464,21 +464,6 @@ static void lo_accessible_get_property(GObject* object, guint property_id, GValu { GtkAccessibleRole eRole(map_accessible_role(accessible->uno_accessible)); g_value_set_enum(value, eRole); - - // for now set GTK_ACCESSIBLE_PROPERTY_LABEL as a proof of concept - if (accessible->uno_accessible) - { - css::uno::Reference<css::accessibility::XAccessibleContext> xContext( - accessible->uno_accessible->getAccessibleContext()); - css::uno::Reference<css::accessibility::XAccessibleText> xAccessibleText( - xContext, css::uno::UNO_QUERY); - if (xAccessibleText) - { - gtk_accessible_update_property( - GTK_ACCESSIBLE(accessible), GTK_ACCESSIBLE_PROPERTY_LABEL, - xAccessibleText->getText().toUtf8().getStr(), -1); - } - } break; } default: @@ -589,6 +574,12 @@ lo_accessible_new(GdkDisplay* pDisplay, GtkAccessible* pParent, GtkAccessible* pGtkAccessible = GTK_ACCESSIBLE(ret); + // set accessible name and description + gtk_accessible_update_property(pGtkAccessible, GTK_ACCESSIBLE_PROPERTY_LABEL, + xContext->getAccessibleName().toUtf8().getStr(), + GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, + xContext->getAccessibleDescription().toUtf8().getStr(), -1); + applyStates(pGtkAccessible, xContext); applyObjectAttributes(GTK_ACCESSIBLE(ret), xContext); |