[gtk/matthiasc/for-master: 55/55] modelbutton: Update a11y states
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 55/55] modelbutton: Update a11y states
- Date: Fri, 31 Jan 2020 18:17:02 +0000 (UTC)
commit 747956497262f9ed8fc2944456160f4fa41b8dac
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 31 19:14:05 2020 +0100
modelbutton: Update a11y states
We took care to set the proper role on our accessible object,
but we forgot to update the state for check and radio button
roles.
gtk/gtkmodelbutton.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index 58f3dd7644..3680fc15f4 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -411,13 +411,23 @@ update_start_indicator (GtkModelButton *self)
static void
gtk_model_button_update_state (GtkModelButton *self)
{
+ GtkStateFlags indicator_state;
+
update_start_indicator (self);
update_end_indicator (self);
+ indicator_state = get_start_indicator_state (self);
if (self->iconic)
- gtk_widget_set_state_flags (GTK_WIDGET (self),
- get_start_indicator_state (self),
- TRUE);
+ gtk_widget_set_state_flags (GTK_WIDGET (self), indicator_state, TRUE);
+
+ if (self->role == GTK_BUTTON_ROLE_CHECK ||
+ self->role == GTK_BUTTON_ROLE_RADIO)
+ {
+ AtkObject *object = _gtk_widget_peek_accessible (GTK_WIDGET (self));
+ if (object)
+ atk_object_notify_state_change (object, ATK_STATE_CHECKED,
+ (indicator_state & GTK_STATE_FLAG_CHECKED));
+ }
}
static void
@@ -1071,6 +1081,18 @@ gtk_model_button_focus (GtkWidget *widget,
return FALSE;
}
+static AtkObject *
+gtk_model_button_get_accessible (GtkWidget *widget)
+{
+ AtkObject *object;
+
+ object = GTK_WIDGET_CLASS (gtk_model_button_parent_class)->get_accessible (widget);
+
+ gtk_model_button_update_state (GTK_MODEL_BUTTON (widget));
+
+ return object;
+}
+
static void
gtk_model_button_class_init (GtkModelButtonClass *class)
{
@@ -1086,6 +1108,7 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
widget_class->direction_changed = gtk_model_button_direction_changed;
widget_class->focus = gtk_model_button_focus;
widget_class->root = gtk_model_button_root;
+ widget_class->get_accessible = gtk_model_button_get_accessible;
/**
* GtkModelButton:role:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]