diff --git a/composite.cpp b/composite.cpp
index 1a6ba4c045..319fb5ce22 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -131,6 +131,7 @@ Compositor::Compositor(QObject* workspace)
, m_composeAtSwapCompletion(false)
{
connect(options, &Options::configChanged, this, &Compositor::configChanged);
+ connect(options, &Options::animationSpeedChanged, this, &Compositor::configChanged);
m_monotonicClock.start();
diff --git a/kwin.kcfg b/kwin.kcfg
index 453e2b6e9e..861b6c9943 100644
--- a/kwin.kcfg
+++ b/kwin.kcfg
@@ -248,11 +248,6 @@
4
6
-
- 3
- 0
- 6
-
glx
@@ -301,4 +296,10 @@
thumbnails
+
+
+ 1
+ 0
+
+
diff --git a/options.cpp b/options.cpp
index 8427156271..fc727855fc 100644
--- a/options.cpp
+++ b/options.cpp
@@ -143,10 +143,16 @@ Options::Options(QObject *parent)
, borderless_maximized_windows(false)
, show_geometry_tip(false)
, condensed_title(false)
- , animationSpeed(Options::defaultAnimationSpeed())
{
m_settings->setDefaults();
syncFromKcfgc();
+
+ m_configWatcher = KConfigWatcher::create(m_settings->sharedConfig());
+ connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) {
+ if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) {
+ emit animationSpeedChanged();
+ }
+ });
}
Options::~Options()
@@ -933,9 +939,6 @@ void Options::reloadCompositingSettings(bool force)
previews = HiddenPreviewsAlways;
setHiddenPreviews(previews);
- // TOOD: add setter
- animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6);
-
auto interfaceToKey = [](OpenGLPlatformInterface interface) {
switch (interface) {
case GlxPlatformInterface:
@@ -1062,8 +1065,11 @@ Options::MouseCommand Options::wheelToMouseCommand(MouseWheelCommand com, int de
double Options::animationTimeFactor() const
{
- const double factors[] = { 0, 0.2, 0.5, 1, 2, 4, 20 };
- return factors[ animationSpeed ];
+ #ifndef KCMRULES
+ return m_settings->animationDurationFactor();
+#else
+ return 0;
+#endif
}
Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const
diff --git a/options.h b/options.h
index 8d92f09a83..ee31cfea90 100644
--- a/options.h
+++ b/options.h
@@ -26,6 +26,8 @@ along with this program. If not, see .
#include "main.h"
#include "placement.h"
+#include
+
namespace KWin
{
@@ -741,10 +743,6 @@ public:
static OpenGLPlatformInterface defaultGlPlatformInterface() {
return kwinApp()->shouldUseWaylandForCompositing() ? EglPlatformInterface : GlxPlatformInterface;
}
- static int defaultAnimationSpeed() {
- return 3;
- }
-
/**
* Performs loading all settings except compositing related.
*/
@@ -817,6 +815,7 @@ Q_SIGNALS:
void glPreferBufferSwapChanged();
void glPlatformInterfaceChanged();
void windowsBlockCompositingChanged();
+ void animationSpeedChanged();
void configChanged();
@@ -824,6 +823,8 @@ private:
void setElectricBorders(int borders);
void syncFromKcfgc();
QScopedPointer m_settings;
+ KConfigWatcher::Ptr m_configWatcher;
+
FocusPolicy m_focusPolicy;
bool m_nextFocusPrefersMouse;
bool m_clickRaise;
@@ -888,7 +889,6 @@ private:
bool borderless_maximized_windows;
bool show_geometry_tip;
bool condensed_title;
- int animationSpeed; // 0 - instant, 5 - very slow
QHash m_modifierOnlyShortcuts;