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
icc-effect-5.14.5
Martin Gräßlin 2013-03-12 18:36:21 +01:00
parent 5891133111
commit 25fa3aac8c
3 changed files with 20 additions and 1 deletions

View File

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeItem>
#include <QtGui/QGraphicsView>
#include <QPaintEngine>
#include <KConfig>
#include <KConfigGroup>
@ -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"

View File

@ -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:

View File

@ -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