Resolves: RHEL-123944 (Carousel does not respect the "enable-animations" a11y setting)

This commit is contained in:
Milan Crha 2025-11-03 12:31:24 +01:00
parent 0d653eb68f
commit 2893c092a6
2 changed files with 148 additions and 1 deletions

View File

@ -0,0 +1,143 @@
From 4a357593a4979b422044794185c1e3bd4291c719 Mon Sep 17 00:00:00 2001
Date: Tue, 2 Sep 2025 18:41:29 +0200
Subject: [PATCH 1/2] gs-featured-carousel: Don't rotate banner when animations
are disabled
There are accessibility issues related to moving, blinking, and
auto-scrolling information on the screen.
The WCAG 2.0 guidelines have a success criterion for having a way, such
as a setting, to Pause, Stop, or Hide, moving information.
See https://www.w3.org/TR/UNDERSTANDING-WCAG20/time-limits-pause.html
---
src/gs-featured-carousel.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/gs-featured-carousel.c b/src/gs-featured-carousel.c
index 151005e79..6e8c4fbd7 100644
--- a/src/gs-featured-carousel.c
+++ b/src/gs-featured-carousel.c
@@ -112,14 +112,6 @@ start_rotation_timer (GsFeaturedCarousel *self)
}
}
-static void
-maybe_start_rotation_timer (GsFeaturedCarousel *self)
-{
- if (self->apps != NULL && gs_app_list_length (self->apps) > 0 &&
- gtk_widget_get_mapped (GTK_WIDGET (self)))
- start_rotation_timer (self);
-}
-
static void
stop_rotation_timer (GsFeaturedCarousel *self)
{
@@ -129,12 +121,25 @@ stop_rotation_timer (GsFeaturedCarousel *self)
}
}
+static void
+maybe_start_rotation_timer (GsFeaturedCarousel *self)
+{
+ if (!adw_get_enable_animations (GTK_WIDGET (self))) {
+ stop_rotation_timer (self);
+ return;
+ }
+
+ if (self->apps != NULL && gs_app_list_length (self->apps) > 0 &&
+ gtk_widget_get_mapped (GTK_WIDGET (self)))
+ start_rotation_timer (self);
+}
+
static void
carousel_notify_position_cb (GsFeaturedCarousel *self)
{
/* Reset the rotation timer in case its about to fire. */
stop_rotation_timer (self);
- start_rotation_timer (self);
+ maybe_start_rotation_timer (self);
}
static void
--
GitLab
From 0ae3a506fc97f3919be4251678009b73ff5801f1 Mon Sep 17 00:00:00 2001
Date: Fri, 5 Sep 2025 14:40:37 +0100
Subject: [PATCH 2/2] gs-featured-carousel: Update animations when GTK settings
change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Further to the previous commit, lets update whether animations are
enabled/disabled when the GTK settings change, so gnome-software doesnt
have to be restarted to see the difference.
---
src/gs-featured-carousel.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/gs-featured-carousel.c b/src/gs-featured-carousel.c
index 6e8c4fbd7..3e3eaae95 100644
--- a/src/gs-featured-carousel.c
+++ b/src/gs-featured-carousel.c
@@ -43,6 +43,7 @@ struct _GsFeaturedCarousel
GsAppList *apps; /* (nullable) (owned) */
guint rotation_timer_id;
+ unsigned long settings_notify_id;
AdwCarousel *carousel;
GtkButton *next_button;
@@ -142,6 +143,17 @@ carousel_notify_position_cb (GsFeaturedCarousel *self)
maybe_start_rotation_timer (self);
}
+static void
+carousel_notify_settings_cb (GObject *object,
+ GParamSpec *pspec,
+ void *user_data)
+{
+ GsFeaturedCarousel *self = GS_FEATURED_CAROUSEL (user_data);
+
+ /* this will also stop the timer if animations are disabled */
+ maybe_start_rotation_timer (self);
+}
+
static void
next_button_clicked_cb (GtkButton *button,
gpointer user_data)
@@ -174,11 +186,19 @@ tile_clicked_cb (GsFeatureTile *tile,
static void
gs_featured_carousel_init (GsFeaturedCarousel *self)
{
+ GtkSettings *settings;
+
gtk_widget_init_template (GTK_WIDGET (self));
/* Disable scrolling through the carousel, as its typically used
* in app pages which are themselves scrollable. */
adw_carousel_set_allow_scroll_wheel (self->carousel, FALSE);
+
+ /* Connect to settings notifications so we can enable/disable animations */
+ settings = gtk_widget_get_settings (GTK_WIDGET (self));
+ self->settings_notify_id = g_signal_connect (settings, "notify::gtk-enable-animations",
+ G_CALLBACK (carousel_notify_settings_cb),
+ self);
}
static void
@@ -223,6 +243,7 @@ gs_featured_carousel_dispose (GObject *object)
GsFeaturedCarousel *self = GS_FEATURED_CAROUSEL (object);
stop_rotation_timer (self);
+ g_clear_signal_handler (&self->settings_notify_id, gtk_widget_get_settings (GTK_WIDGET (self)));
g_clear_object (&self->apps);
G_OBJECT_CLASS (gs_featured_carousel_parent_class)->dispose (object);
--
GitLab

View File

@ -26,7 +26,7 @@
Name: gnome-software
Version: 47.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A software center for GNOME
License: GPL-2.0-or-later
@ -36,6 +36,7 @@ Source1: org.gnome.App-list-1.0.xml
Patch: 0001-Disable-build-and-use-of-help-files.patch
Patch: 0001-crash-under-gs_appstream_gather_merge_data.patch
Patch: 0003-carousel-animation.patch
# ostree and flatpak not on i686 for Fedora and RHEL 10
# https://github.com/containers/composefs/pull/229#issuecomment-1838735764
@ -302,6 +303,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_datadir}/gtk-doc/html/gnome-software/
%changelog
* Mon Nov 03 2025 Milan Crha <mcrha@redhat.com> - 47.5-2
- Resolves: RHEL-123944 (Carousel does not respect the "enable-animations" a11y setting)
* Mon Mar 24 2025 Milan Crha <mcrha@redhat.com> - 47.5-1
- Resolves: RHEL-84652 (Update to 47.5)