From: Matthias Clasen Date: Sat, 10 Jun 2023 01:03:54 +0000 (-0400) Subject: inspector: Show computed values in a11y tab X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~165^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fcb90480439fe90c3073905f0ee124a6cb6f58f9;p=gtk4.git inspector: Show computed values in a11y tab Show the name and description in the a11y tab. These are not direct property values, but computed according to ARIA rules. --- diff --git a/gtk/inspector/a11y.c b/gtk/inspector/a11y.c index 4252f09011..e06e767bea 100644 --- a/gtk/inspector/a11y.c +++ b/gtk/inspector/a11y.c @@ -201,6 +201,8 @@ struct _GtkInspectorA11y GtkWidget *box; GtkWidget *role; + GtkWidget *name; + GtkWidget *description; GtkWidget *bounds; GtkWidget *path_label; GtkWidget *path; @@ -229,6 +231,30 @@ update_role (GtkInspectorA11y *sl) g_type_class_unref (eclass); } +static void +update_name (GtkInspectorA11y *sl) +{ + GtkATContext *context; + char *name; + + context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); + + name = gtk_at_context_get_name (context); + gtk_label_set_label (GTK_LABEL (sl->name), name); +} + +static void +update_description (GtkInspectorA11y *sl) +{ + GtkATContext *context; + char *description; + + context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); + + description = gtk_at_context_get_description (context); + gtk_label_set_label (GTK_LABEL (sl->description), description); +} + static void update_path (GtkInspectorA11y *sl) { @@ -426,6 +452,8 @@ static void refresh_all (GtkInspectorA11y *sl) { update_role (sl); + update_name (sl); + update_description (sl); update_path (sl); update_attributes (sl); } @@ -518,6 +546,8 @@ gtk_inspector_a11y_class_init (GtkInspectorA11yClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/a11y.ui"); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, box); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, role); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, name); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, description); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, bounds); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, path_label); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, path); diff --git a/gtk/inspector/a11y.ui b/gtk/inspector/a11y.ui index 190040a1a4..fad8470f31 100644 --- a/gtk/inspector/a11y.ui +++ b/gtk/inspector/a11y.ui @@ -38,6 +38,58 @@ + + + Name + start + baseline + 0.0 + + 1 + 0 + + + + + + 1 + end + baseline + + 1 + 1 + + + name_label + + + + + + Description + start + baseline + 0.0 + + 2 + 0 + + + + + + 1 + end + baseline + + 2 + 1 + + + description_label + + + Bounds @@ -45,7 +97,7 @@ baseline 0.0 - 1 + 3 0 @@ -56,7 +108,7 @@ end baseline - 1 + 3 1 @@ -71,7 +123,7 @@ baseline 0.0 - 2 + 4 0 @@ -82,7 +134,7 @@ end baseline - 2 + 4 1