[gtk/a11y/atspi] flowbox: Update accessible state for children



commit 2664c294547b85686c720ef2231980adf49e97f0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 13 17:22:50 2020 -0400

    flowbox: Update accessible state for children
    
    Set the SELECTED state to reflect whether the selected
    is selected, unselected, or unselectable. This is
    enough to make selection changes appear in Accerciser.
    
    While we are at it, also set the multi-selectable
    property for the flowbox itself.

 gtk/gtkflowbox.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 7a306a8dc3..f7f60c9bcb 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -75,6 +75,7 @@
 
 #include "gtkflowboxprivate.h"
 
+#include "gtkaccessible.h"
 #include "gtkadjustment.h"
 #include "gtkbinlayout.h"
 #include "gtkbuildable.h"
@@ -483,6 +484,18 @@ gtk_flow_box_child_compute_expand (GtkWidget *widget,
     }
 }
 
+static void
+gtk_flow_box_child_root (GtkWidget *widget)
+{
+  GtkFlowBoxChild *child = GTK_FLOW_BOX_CHILD (widget);
+
+  GTK_WIDGET_CLASS (gtk_flow_box_child_parent_class)->root (widget);
+
+  gtk_accessible_update_state (GTK_ACCESSIBLE (child),
+                               GTK_ACCESSIBLE_STATE_SELECTED, CHILD_PRIV (child)->selected,
+                               -1);
+}
+
 /* GObject implementation {{{2 */
 
 static void
@@ -495,6 +508,7 @@ gtk_flow_box_child_class_init (GtkFlowBoxChildClass *class)
   object_class->get_property = gtk_flow_box_child_get_property;
   object_class->set_property = gtk_flow_box_child_set_property;
 
+  widget_class->root = gtk_flow_box_child_root;
   widget_class->get_request_mode = gtk_flow_box_child_get_request_mode;
   widget_class->compute_expand = gtk_flow_box_child_compute_expand;
   widget_class->focus = gtk_flow_box_child_focus;
@@ -905,6 +919,9 @@ gtk_flow_box_child_set_selected (GtkFlowBoxChild *child,
         gtk_widget_unset_state_flags (GTK_WIDGET (child),
                                       GTK_STATE_FLAG_SELECTED);
 
+      gtk_accessible_update_state (GTK_ACCESSIBLE (child),
+                                   GTK_ACCESSIBLE_STATE_SELECTED, selected,
+                                   -1);
       return TRUE;
     }
 
@@ -4724,6 +4741,10 @@ gtk_flow_box_set_selection_mode (GtkFlowBox       *box,
 
   BOX_PRIV (box)->selection_mode = mode;
 
+  gtk_accessible_update_property (GTK_ACCESSIBLE (box),
+                                  GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE, mode == GTK_SELECTION_MULTIPLE,
+                                  -1);
+
   g_object_notify_by_pspec (G_OBJECT (box), props[PROP_SELECTION_MODE]);
 
   if (dirty)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]