summaryrefslogtreecommitdiff
path: root/capplets/windows/mate-window-properties.c
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-05-30 10:39:01 +0200
committerGitHub <[email protected]>2023-05-30 10:39:01 +0200
commite99f157740660e6ef28f1bba7560cb9d52d5d1ad (patch)
tree744096b363c73bfd14f0b799e82f2583c3f916af /capplets/windows/mate-window-properties.c
parent8da51f3e690cbc3e9ce8dd5b0dc700f1097d78da (diff)
downloadmate-control-center-e99f157740660e6ef28f1bba7560cb9d52d5d1ad.tar.bz2
mate-control-center-e99f157740660e6ef28f1bba7560cb9d52d5d1ad.tar.xz
windows: Fix UI accessibility (#704)
Use real frames for a semantic UI so GTK and screen readers can set up and figure out accessibility relationships between the frame label and the content automatically. Also properly add relationships between the movement keys descriptive label and the key radio items so a screen reader can pick it up. As a bonus, it also prevents Orca from erroneously announcing the label when the window comes up because it thinks this long orphaned label is probably a general description for the window. Fixes #703.
Diffstat (limited to 'capplets/windows/mate-window-properties.c')
-rw-r--r--capplets/windows/mate-window-properties.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/capplets/windows/mate-window-properties.c b/capplets/windows/mate-window-properties.c
index 9757c42c..ccccb03c 100644
--- a/capplets/windows/mate-window-properties.c
+++ b/capplets/windows/mate-window-properties.c
@@ -113,6 +113,7 @@ static GtkWidget *focus_mode_mouse_checkbutton;
static GtkWidget *autoraise_checkbutton;
static GtkWidget *autoraise_delay_spinbutton;
static GtkWidget *autoraise_delay_hbox;
+static GtkWidget *movement_description_label;
static GtkWidget *alt_click_vbox;
/* Placement */
@@ -402,6 +403,7 @@ main (int argc, char **argv)
autoraise_delay_hbox = GET_WIDGET ("autoraise_delay_hbox");
autoraise_checkbutton = GET_WIDGET ("autoraise_checkbutton");
autoraise_delay_spinbutton = GET_WIDGET ("autoraise_delay_spinbutton");
+ movement_description_label = GET_WIDGET ("movement_description_label");
alt_click_vbox = GET_WIDGET ("alt_click_vbox");
/* Placement */
@@ -543,6 +545,7 @@ reload_mouse_modifiers (void)
gboolean have_super;
int min_keycode, max_keycode;
int mod_meta, mod_super, mod_hyper;
+ AtkObject *label_accessible;
XDisplayKeycodes (gdk_x11_display_get_xdisplay(gdk_display_get_default()),
&min_keycode,
@@ -655,4 +658,23 @@ reload_mouse_modifiers (void)
fill_radio (i == 0 ? NULL : GTK_RADIO_BUTTON (mouse_modifiers[i-1].radio), &mouse_modifiers[i]);
++i;
}
+
+ /* set up accessibility relationships between the main label and each
+ * radio button, because GTK doesn't do it for us (usually, it expects the
+ * label of the radio button to be enough, but our case is better served
+ * with associating the main label as well). */
+ label_accessible = gtk_widget_get_accessible (movement_description_label);
+ if (ATK_IS_OBJECT (label_accessible)) {
+ for (i = 0; i < n_mouse_modifiers; i++) {
+ AtkObject *radio_accessible = gtk_widget_get_accessible (mouse_modifiers[i].radio);
+ if (ATK_IS_OBJECT (radio_accessible)) {
+ atk_object_add_relationship (label_accessible,
+ ATK_RELATION_LABEL_FOR,
+ radio_accessible);
+ atk_object_add_relationship (radio_accessible,
+ ATK_RELATION_LABELLED_BY,
+ label_accessible);
+ }
+ }
+ }
}