From 25fa3aac8ca0c6abf171ee54e65501a04d385d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 12 Mar 2013 18:36:21 +0100 Subject: [PATCH] Disable animations in Plastik for native or non-compositing Adding a new property on whether we want animations based on whether we are on raster or with Compositing. The property is constant as the deco gets recreated on compositing change state anyway. REVIEW: 109456 BUG: 314532 FIXED-IN: 4.10.2 --- clients/aurorae/src/aurorae.cpp | 13 +++++++++++++ clients/aurorae/src/aurorae.h | 3 +++ .../themes/plastik/package/contents/ui/main.qml | 5 ++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index b6c219b72f..ccbb1cb6eb 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -25,6 +25,7 @@ along with this program. If not, see . #include #include #include +#include #include #include @@ -576,6 +577,18 @@ void AuroraeClient::slotAlphaChanged() } } +bool AuroraeClient::animationsSupported() const +{ + if (!compositingActive()) { + return false; + } + QPixmap pix(1,1); + QPainter p(&pix); + const bool raster = p.paintEngine()->type() == QPaintEngine::Raster; + p.end(); + return raster; +} + } // namespace Aurorae extern "C" diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 6e187eaeb9..207a400ccb 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -110,6 +110,7 @@ class AuroraeClient : public KDecorationUnstable Q_PROPERTY(int width READ width) Q_PROPERTY(qulonglong windowId READ windowId CONSTANT) Q_PROPERTY(int doubleClickInterval READ doubleClickInterval) + Q_PROPERTY(bool animationsSupported READ animationsSupported CONSTANT) // TODO: window tabs - they suck for dynamic features public: AuroraeClient(KDecorationBridge* bridge, KDecorationFactory* factory); @@ -132,6 +133,8 @@ public: bool isMaximized() const; int doubleClickInterval() const; + bool animationsSupported() const; + Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant()); Q_SIGNALS: diff --git a/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/clients/aurorae/themes/plastik/package/contents/ui/main.qml index d18d7a78e7..fe91a6a524 100644 --- a/clients/aurorae/themes/plastik/package/contents/ui/main.qml +++ b/clients/aurorae/themes/plastik/package/contents/ui/main.qml @@ -59,7 +59,10 @@ Decoration { } root.animateButtons = decoration.readConfig("animateButtons", true); root.titleShadow = decoration.readConfig("titleShadow", true); - root.animationDuration = 150; + if (decoration.animationsSupported) { + root.animationDuration = 150; + root.animateButtons = false; + } } ColorHelper { id: colorHelper