From 11e95d5de157aa247f918638de077ecce47a8e6f Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 23 Nov 2017 10:34:06 +0100 Subject: [PATCH] Honor animationsSupported in minimize, slide and sliding popups effects Differential Revision: https://phabricator.kde.org/D8938 --- effects/effect_builtins.cpp | 6 +++--- effects/minimizeanimation/minimizeanimation.cpp | 4 ++++ effects/minimizeanimation/minimizeanimation.h | 2 ++ effects/slide/slide.cpp | 5 +++++ effects/slide/slide.h | 2 ++ effects/slidingpopups/slidingpopups.cpp | 5 +++++ effects/slidingpopups/slidingpopups.h | 3 +++ 7 files changed, 24 insertions(+), 3 deletions(-) diff --git a/effects/effect_builtins.cpp b/effects/effect_builtins.cpp index 2783cf586b..7198d6cf09 100644 --- a/effects/effect_builtins.cpp +++ b/effects/effect_builtins.cpp @@ -378,7 +378,7 @@ EFFECT_FALLBACK false, #ifdef EFFECT_BUILTINS &createHelper, - nullptr, + &MinimizeAnimationEffect::supported, nullptr #endif EFFECT_FALLBACK @@ -528,7 +528,7 @@ EFFECT_FALLBACK false, #ifdef EFFECT_BUILTINS &createHelper, - nullptr, + &SlideEffect::supported, nullptr #endif EFFECT_FALLBACK @@ -558,7 +558,7 @@ EFFECT_FALLBACK false, #ifdef EFFECT_BUILTINS &createHelper, - nullptr, + &SlidingPopupsEffect::supported, nullptr #endif EFFECT_FALLBACK diff --git a/effects/minimizeanimation/minimizeanimation.cpp b/effects/minimizeanimation/minimizeanimation.cpp index fdbb3da281..3d00d3235c 100644 --- a/effects/minimizeanimation/minimizeanimation.cpp +++ b/effects/minimizeanimation/minimizeanimation.cpp @@ -33,6 +33,10 @@ MinimizeAnimationEffect::MinimizeAnimationEffect() connect(effects, SIGNAL(windowUnminimized(KWin::EffectWindow*)), this, SLOT(slotWindowUnminimized(KWin::EffectWindow*))); } +bool MinimizeAnimationEffect::supported() +{ + return effects->animationsSupported(); +} void MinimizeAnimationEffect::prePaintScreen(ScreenPrePaintData& data, int time) { diff --git a/effects/minimizeanimation/minimizeanimation.h b/effects/minimizeanimation/minimizeanimation.h index f6fd13d2e8..cbdfec9622 100644 --- a/effects/minimizeanimation/minimizeanimation.h +++ b/effects/minimizeanimation/minimizeanimation.h @@ -49,6 +49,8 @@ public: return 50; } + static bool supported(); + public Q_SLOTS: void slotWindowDeleted(KWin::EffectWindow *w); void slotWindowMinimized(KWin::EffectWindow *w); diff --git a/effects/slide/slide.cpp b/effects/slide/slide.cpp index c6badc1553..ab2cbd6095 100644 --- a/effects/slide/slide.cpp +++ b/effects/slide/slide.cpp @@ -38,6 +38,11 @@ SlideEffect::SlideEffect() reconfigure(ReconfigureAll); } +bool SlideEffect::supported() +{ + return effects->animationsSupported(); +} + void SlideEffect::reconfigure(ReconfigureFlags) { mTimeLine.setDuration(animationTime(250)); diff --git a/effects/slide/slide.h b/effects/slide/slide.h index 0bfe5ab366..eb6b0147d1 100644 --- a/effects/slide/slide.h +++ b/effects/slide/slide.h @@ -47,6 +47,8 @@ public: return 50; } + static bool supported(); + private Q_SLOTS: void slotDesktopChanged(int old, int current); diff --git a/effects/slidingpopups/slidingpopups.cpp b/effects/slidingpopups/slidingpopups.cpp index 548b67457a..c8bb892972 100644 --- a/effects/slidingpopups/slidingpopups.cpp +++ b/effects/slidingpopups/slidingpopups.cpp @@ -61,6 +61,11 @@ SlidingPopupsEffect::~SlidingPopupsEffect() { } +bool SlidingPopupsEffect::supported() +{ + return effects->animationsSupported(); +} + void SlidingPopupsEffect::reconfigure(ReconfigureFlags flags) { Q_UNUSED(flags) diff --git a/effects/slidingpopups/slidingpopups.h b/effects/slidingpopups/slidingpopups.h index ffa3622539..3f6bf7f83e 100644 --- a/effects/slidingpopups/slidingpopups.h +++ b/effects/slidingpopups/slidingpopups.h @@ -48,6 +48,9 @@ public: int requestedEffectChainPosition() const override { return 40; } + + static bool supported(); + // TODO react also on virtual desktop changes // for properties