diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-04-17 19:02:53 -0400 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2021-04-19 19:22:20 +0100 |
commit | a455db01a0e00bb14c63a554ad85bae59a39e83b (patch) | |
tree | 57337b2c6e0526046d30d3d007bc67e0a9e453c8 | |
parent | 9e8187bdc4ce5a50113a448a0f0bc70bdabbea26 (diff) | |
download | gtk+-a455db01a0e00bb14c63a554ad85bae59a39e83b.tar.gz |
a11y: Actually set accessible roles
With most context realization happening inside
GtkAtspiContext in response to D-Bus calls, the
code in gtk_widget_realize_at_context that sets
the role is not executed for most accessibles,
causing them to be stuck with the 'filler' role
that makes orca ignore them.
To fix this, split gtk_widget_realize_at_context
into the actual context realization (getting on
the bus) and the setting of widget-specific
properties, and do the latter part when the
widget is rooted.
This makes accerciser report proper roles for
entries and buttons. Orca still has an issue
with getting the hierarchy populated.
-rw-r--r-- | gtk/gtkwidget.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index b9088cd3ef..b141179450 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -74,6 +74,7 @@ #include "gtkwidgetpaintableprivate.h" #include "gtkwindowgroup.h" #include "gtkwindowprivate.h" +#include "gtktestatcontextprivate.h" #include "inspector/window.h" @@ -2449,13 +2450,13 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class) priv->at_context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (widget)); } -void -gtk_widget_realize_at_context (GtkWidget *self) +static void +gtk_widget_root_at_context (GtkWidget *self) { GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self); GtkAccessibleRole role = priv->accessible_role; - if (priv->at_context == NULL || gtk_at_context_is_realized (priv->at_context)) + if (priv->at_context == NULL) return; /* Reset the accessible role to its current value */ @@ -2468,6 +2469,17 @@ gtk_widget_realize_at_context (GtkWidget *self) gtk_at_context_set_accessible_role (priv->at_context, role); gtk_at_context_set_display (priv->at_context, gtk_root_get_display (priv->root)); +} + +void +gtk_widget_realize_at_context (GtkWidget *self) +{ + GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self); + + if (priv->at_context == NULL || gtk_at_context_is_realized (priv->at_context)) + return; + + gtk_widget_root_at_context (self); gtk_at_context_realize (priv->at_context); } @@ -2511,6 +2523,8 @@ gtk_widget_root (GtkWidget *widget) if (priv->layout_manager) gtk_layout_manager_set_root (priv->layout_manager, priv->root); + gtk_widget_root_at_context (widget); + GTK_WIDGET_GET_CLASS (widget)->root (widget); if (!GTK_IS_ROOT (widget)) |