a11y: Remove special handling of accessible names for static text widgets

By doing this, we gain the capability to send notifications when their
accessible names change. Also, it simplifies the accessible name
generation logic.
This commit is contained in:
Lukáš Tyrychtr 2024-01-17 12:49:38 +01:00
parent d16d2135e6
commit d5b34aecdd
3 changed files with 10 additions and 16 deletions

View File

@ -1355,22 +1355,6 @@ gtk_at_context_get_text_accumulate (GtkATContext *self,
}
}
/* Step 2.G */
if (GTK_IS_LABEL (self->accessible))
{
const char *text = gtk_label_get_text (GTK_LABEL (self->accessible));
if (text && not_just_space (text))
append_with_space (res, text);
return;
}
else if (GTK_IS_INSCRIPTION (self->accessible))
{
const char *text = gtk_inscription_get_text (GTK_INSCRIPTION (self->accessible));
if (text && not_just_space (text))
append_with_space (res, text);
return;
}
/* Step 2.I */
if (GTK_IS_WIDGET (self->accessible))
{

View File

@ -805,6 +805,11 @@ gtk_inscription_set_text (GtkInscription *self,
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL,
text,
-1);
}
/**

View File

@ -3086,6 +3086,11 @@ gtk_label_set_label_internal (GtkLabel *self,
g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_LABEL]);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL,
self->label,
-1);
return TRUE;
}