diff options
author | Colomban Wendling <[email protected]> | 2023-05-30 10:39:01 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-30 10:39:01 +0200 |
commit | e99f157740660e6ef28f1bba7560cb9d52d5d1ad (patch) | |
tree | 744096b363c73bfd14f0b799e82f2583c3f916af /capplets/windows | |
parent | 8da51f3e690cbc3e9ce8dd5b0dc700f1097d78da (diff) | |
download | mate-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')
-rw-r--r-- | capplets/windows/mate-window-properties.c | 22 | ||||
-rw-r--r-- | capplets/windows/window-properties.ui | 306 |
2 files changed, 135 insertions, 193 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); + } + } + } } diff --git a/capplets/windows/window-properties.ui b/capplets/windows/window-properties.ui index b4035d36..140ab21b 100644 --- a/capplets/windows/window-properties.ui +++ b/capplets/windows/window-properties.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.38.2 +<!-- Generated with glade 3.40.0 window-properties.ui - MATE window properties dialog Copyright (C) MATE Developers @@ -115,27 +115,11 @@ Author: Robert Buj <property name="orientation">vertical</property> <property name="spacing">18</property> <child> - <object class="GtkBox" id="window_selection_main_vbox"> + <object class="GtkFrame" id="window_selection_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="window_selection_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Window Selection</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="window_selection_vbox"> <property name="visible">True</property> @@ -236,11 +220,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="window_selection_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Window Selection</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -250,27 +240,11 @@ Author: Robert Buj </packing> </child> <child> - <object class="GtkBox" id="titlebar_action_main_vbox"> + <object class="GtkFrame" id="titlebar_action_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="titlebar_action_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Titlebar Action</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="titlebar_action_vbox"> <property name="visible">True</property> @@ -325,11 +299,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="titlebar_action_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Titlebar Action</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -339,27 +319,11 @@ Author: Robert Buj </packing> </child> <child> - <object class="GtkBox" id="alt_tab_main_vbox"> + <object class="GtkFrame" id="alt_tab_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="alt_tab_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Alt-Tab</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="alt_tab_vbox"> <property name="visible">True</property> @@ -397,11 +361,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="alt_tab_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Alt-Tab</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -411,27 +381,11 @@ Author: Robert Buj </packing> </child> <child> - <object class="GtkBox" id="movement_key_main_vbox"> + <object class="GtkFrame" id="movement_key_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="movement_key_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Movement Key</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="movement_key_vbox"> <property name="visible">True</property> @@ -468,11 +422,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="movement_key_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Movement Key</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -502,27 +462,11 @@ Author: Robert Buj <property name="orientation">vertical</property> <property name="spacing">18</property> <child> - <object class="GtkBox" id="new_windows_main_vbox"> + <object class="GtkFrame" id="new_windows_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="new_windows_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">New Windows</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="center_new_windows_vbox"> <property name="visible">True</property> @@ -546,11 +490,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="new_windows_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">New Windows</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -560,27 +510,11 @@ Author: Robert Buj </packing> </child> <child> - <object class="GtkBox" id="window_snapping_main_vbox"> + <object class="GtkFrame" id="window_snapping_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="window_snapping_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Window Snapping</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="window_snapping_vbox"> <property name="visible">True</property> @@ -620,11 +554,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="window_snapping_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Window Snapping</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -634,27 +574,11 @@ Author: Robert Buj </packing> </child> <child> - <object class="GtkBox" id="titlebar_buttons_main_vbox"> + <object class="GtkFrame" id="titlebar_buttons_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="titlebar_buttons_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Titlebar Buttons</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="titlebar_buttons_vbox"> <property name="visible">True</property> @@ -707,11 +631,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="titlebar_buttons_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Titlebar Buttons</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> @@ -744,27 +674,11 @@ Author: Robert Buj <property name="orientation">vertical</property> <property name="spacing">18</property> <child> - <object class="GtkBox" id="software_compositing_main_vbox"> + <object class="GtkFrame" id="software_compositing_main_frame"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="software_compositing_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Software Compositing</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkBox" id="software_compositing_vbox"> <property name="visible">True</property> @@ -788,11 +702,17 @@ Author: Robert Buj </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel" id="software_compositing_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Software Compositing</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> </child> </object> <packing> |