Add glScaleFilter and xrFilterScale support

This commit is contained in:
Antonis Tsiapaliokas 2013-09-11 15:20:12 +03:00 committed by Martin Gräßlin
parent e1308f8b40
commit c79894945c
3 changed files with 61 additions and 5 deletions

View file

@ -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<QString, CompositingType::CompositingTypeIndex> 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();
}

View file

@ -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();

View file

@ -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);
}
}