Merge branch 'a11y-state-changes' into 'main'

a11y: Be safe against state type changes

See merge request GNOME/gtk!5018
This commit is contained in:
Emmanuele Bassi 2022-09-10 00:04:03 +00:00
commit dca57bebb7

View File

@ -953,6 +953,8 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
{
value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_CHECKED);
if (value->value_class->type == GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE)
{
switch (gtk_tristate_accessible_value_get (value))
{
case GTK_ACCESSIBLE_TRISTATE_TRUE:
@ -971,6 +973,12 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
break;
}
}
else
{
emit_state_changed (self, "checked", FALSE);
emit_state_changed (self, "indeterminate", TRUE);
}
}
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_DISABLED)
{
@ -1011,6 +1019,9 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_PRESSED)
{
value = gtk_accessible_attribute_set_get_value (states, GTK_ACCESSIBLE_STATE_PRESSED);
if (value->value_class->type == GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE)
{
switch (gtk_tristate_accessible_value_get (value))
{
case GTK_ACCESSIBLE_TRISTATE_TRUE:
@ -1029,6 +1040,12 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
break;
}
}
else
{
emit_state_changed (self, "pressed", FALSE);
emit_state_changed (self, "indeterminate", TRUE);
}
}
if (changed_states & GTK_ACCESSIBLE_STATE_CHANGE_SELECTED)
{