diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-07-25 11:40:42 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-07-25 14:48:20 +0200 |
commit | e320460f9793608ef79aab402b3a03dc28ba7dd5 (patch) | |
tree | 97724eb908c47158aaf9999edf9ee6e2d73d0601 /vcl | |
parent | bbdb62ca2f5545588b2e6d11421c6038425cebab (diff) |
tdf#155414 gtk3 a11y: Honor gtk setting to reduce animation
Use the "gtk-enable-animations" setting [1] to determine whether
animations should be disabled, as is documented in MDN docs
for Firefox using for the "prefers-reduced-motion" CSS media
feature [2].
Note that KDE Plasma's system settings also set this Gtk preference
when taking the steps that [2] describes for reducing motion on KDE
Plasma (s. implementation in [3]):
> In Plasma/KDE: System Settings > Workspace Behavior -> General Behavior >
> "Animation speed" is set all the way to right to "Instant".
On top of
commit 9d68c794d67259a38de1465090f6f1e7fb588d62
Author: Patrick Luby <plubius@neooffice.org>
Date: Fri Jul 21 19:55:02 2023 -0400
tdf#155414 include system "reduce animation" preferences
, this implements the Gtk equivalent of what that change does for macOS.
[1] https://docs.gtk.org/gtk4/property.Settings.gtk-enable-animations.html
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
[3] https://invent.kde.org/plasma/kde-gtk-config/-/blob/881ae01ad361a03396f7f327365f225ef87688e8/kded/gtkconfig.cpp#L205
Change-Id: Ie229f0d58d53f4629721dd6db465e5b029d9699e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154887
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkframe.cxx | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 890bcdb8a6ea..62878279d577 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -618,6 +618,7 @@ public: virtual weld::Window* GetFrameWeld() const override; virtual void UpdateDarkMode() override; virtual bool GetUseDarkMode() const override; + virtual bool GetUseReducedAnimation() const override; static GtkSalFrame *getFromWindow( GtkWidget *pWindow ); diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index d8d5760a16bb..ad9b6586080f 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -1399,6 +1399,16 @@ bool GtkSalFrame::GetUseDarkMode() const return bDarkIconTheme; } +bool GtkSalFrame::GetUseReducedAnimation() const +{ + if (!m_pWindow) + return false; + GtkSettings* pSettings = gtk_widget_get_settings(m_pWindow); + gboolean bAnimations; + g_object_get(pSettings, "gtk-enable-animations", &bAnimations, nullptr); + return !bAnimations; +} + static void settings_portal_changed_cb(GDBusProxy*, const char*, const char* signal_name, GVariant* parameters, gpointer frame) { |