This patch adds a checkbox to enable/disable effects on startup

REVIEW: 114046
master
Mathieu Tarral 11 years ago committed by Martin Gräßlin
parent 5f1e8ec2bd
commit be506dee30

@ -44,6 +44,7 @@ Compositing::Compositing(QObject *parent)
, m_glSwapStrategy(0)
, m_glColorCorrection(false)
, m_compositingType(0)
, m_compositingEnabled(true)
, m_changed(false)
{
reset();
@ -55,6 +56,7 @@ Compositing::Compositing(QObject *parent)
connect(this, &Compositing::glSwapStrategyChanged, this, &Compositing::changed);
connect(this, &Compositing::glColorCorrectionChanged, this, &Compositing::changed);
connect(this, &Compositing::compositingTypeChanged, this, &Compositing::changed);
connect(this, &Compositing::compositingEnabledChanged, this, &Compositing::changed);
connect(this, &Compositing::changed, [this]{
m_changed = true;
@ -69,6 +71,7 @@ void Compositing::reset()
setGlScaleFilter(kwinConfig.readEntry("GLTextureFilter", 2));
setXrScaleFilter(kwinConfig.readEntry("XRenderSmoothScale", false));
setUnredirectFullscreen(kwinConfig.readEntry("UnredirectFullscreen", false));
setCompositingEnabled(kwinConfig.readEntry("Enabled", true));
auto swapStrategy = [&kwinConfig]() {
const QString glSwapStrategyValue = kwinConfig.readEntry("GLPreferBufferSwap", "a");
@ -189,6 +192,11 @@ int Compositing::compositingType() const
return m_compositingType;
}
bool Compositing::compositingEnabled() const
{
return m_compositingEnabled;
}
void Compositing::setAnimationSpeed(int speed)
{
if (speed == m_animationSpeed) {
@ -261,6 +269,16 @@ void Compositing::setCompositingType(int index)
emit compositingTypeChanged();
}
void Compositing::setCompositingEnabled(bool enabled)
{
if (enabled == m_compositingEnabled) {
return;
}
m_compositingEnabled = enabled;
emit compositingEnabledChanged();
}
void Compositing::save()
{
KConfigGroup kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc")), "Compositing");
@ -269,6 +287,7 @@ void Compositing::save()
kwinConfig.writeEntry("GLTextureFilter", glScaleFilter());
kwinConfig.writeEntry("XRenderSmoothScale", xrScaleFilter());
kwinConfig.writeEntry("UnredirectFullscreen", unredirectFullscreen());
kwinConfig.writeEntry("Enabled", compositingEnabled());
auto swapStrategy = [this] {
switch (glSwapStrategy()) {
case 0:

@ -40,6 +40,7 @@ class Compositing : public QObject
Q_PROPERTY(int glSwapStrategy READ glSwapStrategy WRITE setGlSwapStrategy NOTIFY glSwapStrategyChanged)
Q_PROPERTY(bool glColorCorrection READ glColorCorrection WRITE setGlColorCorrection NOTIFY glColorCorrectionChanged)
Q_PROPERTY(int compositingType READ compositingType WRITE setCompositingType NOTIFY compositingTypeChanged)
Q_PROPERTY(bool compositingEnabled READ compositingEnabled WRITE setCompositingEnabled NOTIFY compositingEnabledChanged);
public:
explicit Compositing(QObject *parent = 0);
@ -53,6 +54,7 @@ public:
int glSwapStrategy() const;
bool glColorCorrection() const;
int compositingType() const;
bool compositingEnabled() const;
void setAnimationSpeed(int speed);
void setWindowThumbnail(int index);
@ -62,6 +64,7 @@ public:
void setGlSwapStrategy(int strategy);
void setGlColorCorrection(bool correction);
void setCompositingType(int index);
void setCompositingEnabled(bool enalbed);
void save();
@ -79,6 +82,7 @@ Q_SIGNALS:
void glSwapStrategyChanged();
void glColorCorrectionChanged();
void compositingTypeChanged();
void compositingEnabledChanged();
private:
int m_animationSpeed;
@ -89,7 +93,7 @@ private:
int m_glSwapStrategy;
bool m_glColorCorrection;
int m_compositingType;
bool m_compositingEnabled;
bool m_changed;
};

@ -34,6 +34,7 @@ Item {
property alias glSwapStrategyIndex: glSwapStrategy.currentIndex
property alias glColorCorrectionChecked: glColorCorrection.checked
property alias compositingTypeIndex: openGLType.type
property bool compositingEnabledChecked: useCompositing.checked
Component {
id: sectionHeading
@ -59,13 +60,31 @@ Item {
id: row
width: parent.width
height: parent.height
CheckBox {
id: useCompositing
text: i18n("Enable desktop effects on startup")
checked: compositing.compositingEnabled
anchors {
top: parent.top
left: col.right
topMargin: col.height/8
}
Connections {
target: compositing
onCompositingEnabledChanged: {
useCompositing.checked = compositing.compositingEnabled
}
}
}
CheckBox {
id: windowManagement
text: i18n("Improved Window Management")
checked: false
anchors.left: col.right
anchors.top: parent.top
anchors.topMargin: col.height/4
anchors.top: useCompositing.bottom
//anchors.topMargin: col.height/8
onClicked: searchModel.enableWidnowManagement(windowManagement.checked)
}

@ -78,6 +78,7 @@ Rectangle {
glSwapStrategy: view.glSwapStrategyIndex
glColorCorrection: view.glColorCorrectionChecked
compositingType: view.compositingTypeIndex
compositingEnabled: view.compositingEnabledChecked
}
Connections {
target: compositing

Loading…
Cancel
Save