From a9f8ec71a44f53e83c3ca71dde9f748b651d7e90 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 17 Jun 2023 17:54:39 -0400 Subject: [PATCH] gtk-demo: Misc a11y improvements --- demos/gtk-demo/font_features.ui | 49 +++++++++++++++++++++++++++++---- demos/gtk-demo/fontrendering.ui | 19 +++++++++++-- demos/gtk-demo/video_player.c | 16 +++++++++++ 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/demos/gtk-demo/font_features.ui b/demos/gtk-demo/font_features.ui index b498273cc8..a02fc70033 100644 --- a/demos/gtk-demo/font_features.ui +++ b/demos/gtk-demo/font_features.ui @@ -59,6 +59,9 @@ 6 + + Font + @@ -73,7 +76,7 @@ 10 10 - + Size 0 baseline @@ -89,6 +92,9 @@ 100 baseline size_adjustment + + size_label + 1 0 @@ -101,6 +107,9 @@ 4 0 baseline + + size_label + @@ -110,7 +119,7 @@ - + Letterspacing 0 baseline @@ -126,6 +135,9 @@ 100 baseline letterspacing_adjustment + + letterspacing_label + 1 1 @@ -138,6 +150,9 @@ 4 0 baseline + + letterspacing_label + @@ -147,7 +162,7 @@ - + Line Height 0 baseline @@ -163,6 +178,9 @@ 100 baseline line_height_adjustment + + line_height_label + 1 2 @@ -175,6 +193,9 @@ 4 0 baseline + + line_height_label + @@ -184,7 +205,7 @@ - + Foreground 0 baseline @@ -202,6 +223,9 @@ baseline black + + foreground_label + 1 @@ -210,7 +234,7 @@ - + Background 0 baseline @@ -228,6 +252,9 @@ baseline white + + background_label + 1 @@ -240,6 +267,9 @@ object-flip-vertical-symbolic start center + + Swap colors + @@ -341,6 +371,9 @@ 0 start 1 + + Font example + @@ -350,6 +383,9 @@ entry + + Example text + Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box. @@ -446,6 +482,9 @@ document-edit-symbolic end end + + Edit text + diff --git a/demos/gtk-demo/fontrendering.ui b/demos/gtk-demo/fontrendering.ui index 8a9d8b06b8..1f2fc85696 100644 --- a/demos/gtk-demo/fontrendering.ui +++ b/demos/gtk-demo/fontrendering.ui @@ -39,7 +39,7 @@ 10 10 - + 10 Text 1 @@ -57,10 +57,13 @@ 2 + + text_label + - + 10 Font 1 @@ -75,6 +78,9 @@ + + font_label + @@ -186,6 +192,9 @@ list-add-symbolic center center + + Zoom in + @@ -211,6 +220,9 @@ list-remove-symbolic center center + + Zoom out + @@ -251,6 +263,9 @@ 1 + + Font rendering example + center center 0 diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c index 688f097745..764a9206bd 100644 --- a/demos/gtk-demo/video_player.c +++ b/demos/gtk-demo/video_player.c @@ -150,20 +150,36 @@ do_video_player (GtkWidget *do_widget) button = gtk_button_new (); image = gtk_image_new_from_resource ("/cursors/images/gtk_logo_cursor.png"); + gtk_accessible_update_relation (GTK_ACCESSIBLE (image), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, button, NULL, + -1); gtk_image_set_pixel_size (GTK_IMAGE (image), 24); gtk_button_set_child (GTK_BUTTON (button), image); g_signal_connect (button, "clicked", G_CALLBACK (logo_clicked_cb), video); + gtk_accessible_update_property (GTK_ACCESSIBLE (button), + GTK_ACCESSIBLE_PROPERTY_LABEL, "GTK Logo", + -1); gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button); button = gtk_button_new (); image = gtk_image_new_from_resource ("/video-player/bbb.png"); + gtk_accessible_update_relation (GTK_ACCESSIBLE (image), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, button, NULL, + -1); gtk_image_set_pixel_size (GTK_IMAGE (image), 24); gtk_button_set_child (GTK_BUTTON (button), image); g_signal_connect (button, "clicked", G_CALLBACK (bbb_clicked_cb), video); + gtk_accessible_update_property (GTK_ACCESSIBLE (button), + GTK_ACCESSIBLE_PROPERTY_LABEL, "Big Buck Bunny", + -1); gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button); fullscreen_button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic"); g_signal_connect (fullscreen_button, "clicked", G_CALLBACK (fullscreen_clicked_cb), NULL); + gtk_accessible_update_property (GTK_ACCESSIBLE (fullscreen_button), + GTK_ACCESSIBLE_PROPERTY_LABEL, "Fullscreen", + -1); + gtk_header_bar_pack_end (GTK_HEADER_BAR (title), fullscreen_button); controller = gtk_shortcut_controller_new ();