diff --git a/kcmkwin/kwincompositing/compositing.cpp b/kcmkwin/kwincompositing/compositing.cpp index 8c1e959e01..ace0eec24d 100644 --- a/kcmkwin/kwincompositing/compositing.cpp +++ b/kcmkwin/kwincompositing/compositing.cpp @@ -77,13 +77,24 @@ int Compositing::windowThumbnail() const return kwinConfig.readEntry("HiddenPreviews", 5) - 4; } +int Compositing::glSclaleFilter() const +{ + KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing"); + return kwinConfig.readEntry("GLTextureFilter", 2); +} + +bool Compositing::xrSclaleFilter() const +{ + KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing"); + return kwinConfig.readEntry("XRenderSmoothScale", false); +} + CompositingType::CompositingType(QObject *parent) : QAbstractItemModel(parent) { generateCompositing(); } - void CompositingType::generateCompositing() { QHash compositingTypes; @@ -185,7 +196,7 @@ int CompositingType::currentOpenGLType() return currentIndex; } -void CompositingType::syncConfig(int openGLType, int animationSpeed, int windowThumbnail) +void CompositingType::syncConfig(int openGLType, int animationSpeed, int windowThumbnail, int glSclaleFilter, bool xrSclaleFilter) { QString backend; bool glLegacy; @@ -221,6 +232,8 @@ void CompositingType::syncConfig(int openGLType, int animationSpeed, int windowT kwinConfig.writeEntry("GLCore", glCore); kwinConfig.writeEntry("AnimationSpeed", animationSpeed); kwinConfig.writeEntry("HiddenPreviews", windowThumbnail + 4); + kwinConfig.writeEntry("GLTextureFilter", glSclaleFilter); + kwinConfig.writeEntry("XRenderSmoothScale", xrSclaleFilter); kwinConfig.sync(); } diff --git a/kcmkwin/kwincompositing/compositing.h b/kcmkwin/kwincompositing/compositing.h index 2e4380b81a..385e0b7fd8 100644 --- a/kcmkwin/kwincompositing/compositing.h +++ b/kcmkwin/kwincompositing/compositing.h @@ -34,6 +34,8 @@ class Compositing : public QObject Q_OBJECT Q_PROPERTY(int animationSpeed READ animationSpeed CONSTANT); Q_PROPERTY(int windowThumbnail READ windowThumbnail CONSTANT); + Q_PROPERTY(int glSclaleFilter READ glSclaleFilter CONSTANT); + Q_PROPERTY(bool xrSclaleFilter READ xrSclaleFilter CONSTANT); public: explicit Compositing(QObject *parent = 0); @@ -41,6 +43,8 @@ public: Q_INVOKABLE bool OpenGLIsBroken(); int animationSpeed() const; int windowThumbnail() const; + int glSclaleFilter() const; + bool xrSclaleFilter() const; private: @@ -84,7 +88,7 @@ public: virtual QHash< int, QByteArray > roleNames() const override; Q_INVOKABLE int currentOpenGLType(); - Q_INVOKABLE void syncConfig(int openGLType, int animationSpeed, int windowThumbnail); + Q_INVOKABLE void syncConfig(int openGLType, int animationSpeed, int windowThumbnail, int glSclaleFilter, bool xrSclaleFilter); private: void generateCompositing(); diff --git a/kcmkwin/kwincompositing/qml/EffectView.qml b/kcmkwin/kwincompositing/qml/EffectView.qml index 0a6797087e..5102e8a88e 100644 --- a/kcmkwin/kwincompositing/qml/EffectView.qml +++ b/kcmkwin/kwincompositing/qml/EffectView.qml @@ -66,7 +66,11 @@ Item { currentIndex: compositingType.currentOpenGLType() anchors.top: windowManagement.bottom anchors.left: col.right - onCurrentIndexChanged: apply.enabled = true + onCurrentIndexChanged: { + apply.enabled = true; + glScaleFilter.visible = currentIndex != 3; + xrScaleFilter.visible = currentIndex == 3; + } } Label { @@ -118,6 +122,41 @@ Item { onCurrentIndexChanged: apply.enabled = true; } + Label { + id: scaleFilterText + text: i18n("Scale Method:") + anchors { + top: windowThumbnail.bottom + horizontalCenter: windowManagement.horizontalCenter + topMargin: 20 + } + } + + ComboBox { + id: glScaleFilter + model: [i18n("Crisp"), i18n("Smooth"), i18n("Accurate")] + visible: openGLType.currentIndex != 3 + currentIndex: compositing.glScaleFilter + anchors { + top: scaleFilterText.bottom + left: col.right + } + onCurrentIndexChanged: apply.enabled = true; + } + + ComboBox { + id: xrScaleFilter + model: [i18n("Crisp"), i18n("Smooth (slower)")] + visible: openGLType.currentIndex == 3 + currentIndex: compositing.xrScaleFilter ? 1 : 0 + anchors { + top: scaleFilterText.bottom + left: glScaleFilter.visible ? glScaleFilter.right : col.right + right: parent.right + } + onCurrentIndexChanged: apply.enabled = true; + } + ColumnLayout { id: col height: parent.height @@ -197,7 +236,7 @@ Item { onClicked: { searchModel.syncConfig(); apply.enabled = false; - compositingType.syncConfig(openGLType.currentIndex, animationSpeed.value, windowThumbnail.currentIndex); + compositingType.syncConfig(openGLType.currentIndex, animationSpeed.value, windowThumbnail.currentIndex, glScaleFilter.currentIndex, xrScaleFilter.currentIndex == 1); } }