office-gobmx/vcl/unx/kf5/KFSalInstance.hxx
Michael Weghorn f3a4b6e1d7 tdf#155414 kf a11y: Honor KDE Plasma setting to reduce animation
When using the kf5/kf6 VCL plugin on KDE Plasma, use the animation speed
setting to determine whether animations should be disabled, in line with
what is documented in MDN docs for Firefox using for the
"prefers-reduced-motion" CSS media feature [1] and how
kde-gtk-config maps that to the "gtk-enable-animations" setting [2].

The setting can be set as described in [2]:

> In Plasma/KDE: System Settings > Workspace Behavior -> General Behavior >
> "Animation speed" is set all the way to right to "Instant".

On top of

    commit 9d68c794d6
    Author: Patrick Luby <plubius@neooffice.org>
    Date:   Fri Jul 21 19:55:02 2023 -0400

        tdf#155414 include system "reduce animation" preferences

, this basically implements the KF5/KDE Plasma equivalent of what that change does
for macOS.

Other than Gtk, Qt does not seem to have a general way to specify
that animations should be reduced/disabled, so evaluate
that based on the desktop environment instead, and implement
for KDE Plasma for the kf5/kf6 VCL plugin only for now, which is
probably the most common use case.

Logically, this would better fit in the qt5/qt6 VCL plugin
than the kf5/kf6 one, but do it in the KF-specific code to avoid
a dependency on KF5/KF6 libraries in qt5/qt6. (And other than
qt5/qt6, kf5/kf6 are auto-selected in Qt-based desktop environments,
so it shouldn't make much of a difference in practice.)
Another alternative - should the need aries - might be to move this
from the VCL plugin to the desktop backend (`shell/source/backends/kf5be/`
for the case of KDE Plasma 5.) and introduce a new property for that.

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
[2] https://docs.gtk.org/gtk4/property.Settings.gtk-enable-animations.html
[3] 881ae01ad3/kded/gtkconfig.cpp (L205)

Change-Id: I35cd6c2568a3716491581e51dfaeaf32cad454aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154888
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-25 14:48:26 +02:00

37 lines
1.4 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <QtInstance.hxx>
class KFSalInstance final : public QtInstance
{
bool hasNativeFileSelection() const override;
rtl::Reference<QtFilePicker>
createPicker(css::uno::Reference<css::uno::XComponentContext> const& context,
QFileDialog::FileMode) override;
virtual bool GetUseReducedAnimation() override;
public:
explicit KFSalInstance(std::unique_ptr<QApplication>& pQApp);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */