From bcf78aeb39b5ae31418ab3f3b267d8e7a9d4d8e7 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 9 Nov 2023 17:13:27 +0100 Subject: [PATCH] a11y atspi: Map GTK_ACCESSIBLE_PROPERTY_LEVEL to AT-SPI attr Map GTK_ACCESSIBLE_PROPERTY_LEVEL to the corresponding AT-SPI object attribute "level", as it is specified e.g. in the Core Accessibility Mappings 1.2 for the "aria-level" attribute, for both, headings [1] and non-headings [2]. This e.g. makes reporting the header level via AT-SPI work for the gtk4-based LibreOffice variant when combined with the corresponding LibreOffice change [3] to set the GTK_ACCESSIBLE_PROPERTY_LEVEL property. For a related discussion, see issue #6196. [1] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading [2] https://www.w3.org/TR/core-aam-1.2/#ariaLevel [3] https://gerrit.libreoffice.org/c/core/+/159216 --- gtk/a11y/gtkatspicontext.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index cf64b80b56..68c26d5f1d 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -528,6 +528,15 @@ handle_accessible_method (GDBusConnection *connection, g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}")); g_variant_builder_add (&builder, "{ss}", "toolkit", "GTK"); + if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_LEVEL)) + { + GtkAccessibleValue *value = gtk_at_context_get_accessible_property (GTK_AT_CONTEXT (self), + GTK_ACCESSIBLE_PROPERTY_LEVEL); + char *level = g_strdup_printf ("%d", gtk_int_accessible_value_get (value)); + g_variant_builder_add (&builder, "{ss}", "level", level); + g_free (level); + } + if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER)) { GtkAccessibleValue *value;