From 19fceb5216173ed1f89703ec1859e2f7d9d45036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 16 Dec 2011 17:35:50 +0100 Subject: [PATCH] add GUI config for graphicssystem REVIEW: 103431 --- kcmkwin/kwincompositing/main.cpp | 28 ++++++++++++++++++- kcmkwin/kwincompositing/main.h | 2 ++ kcmkwin/kwincompositing/main.ui | 48 ++++++++++++++++++++++++++------ 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 434a2a1a4e..a2651368ac 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -38,6 +38,8 @@ along with this program. If not, see . #include #include +#include +#include #include #include #include @@ -99,6 +101,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList connect(ui.rearmGlSupportButton, SIGNAL(clicked()), this, SLOT(rearmGlSupport())); connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(ui.useCompositing, SIGNAL(clicked(bool)), this, SLOT(suggestGraphicsSystem())); connect(ui.effectWinManagement, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.effectAnimations, SIGNAL(toggled(bool)), this, SLOT(changed())); @@ -111,6 +114,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(toogleSmoothScaleUi(int))); + connect(ui.compositingType, SIGNAL(activated(int)), this, SLOT(suggestGraphicsSystem())); + connect(ui.graphicsSystem, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed())); connect(ui.unredirectFullscreen , SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.glScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); @@ -303,6 +308,12 @@ void KWinCompositingConfig::rearmGlSupport() load(); } +void KWinCompositingConfig::suggestGraphicsSystem() +{ + if (!ui.useCompositing->isChecked() || ui.compositingType->currentIndex() == XRENDER_INDEX) + ui.graphicsSystem->setCurrentIndex(0); +} + void KWinCompositingConfig::toogleSmoothScaleUi(int compositingType) { @@ -339,6 +350,16 @@ void KWinCompositingConfig::loadAdvancedTab() KConfigGroup config(mKWinConfig, "Compositing"); QString backend = config.readEntry("Backend", "OpenGL"); ui.compositingType->setCurrentIndex((backend == "XRender") ? XRENDER_INDEX : 0); + + originalGraphicsSystem = config.readEntry("GraphicsSystem", QString()); + if (originalGraphicsSystem.isEmpty()) { // detect system default + QPixmap pix(1,1); + QPainter p(&pix); + originalGraphicsSystem = (p.paintEngine()->type() == QPaintEngine::X11) ? "native" : "raster"; + p.end(); + } + ui.graphicsSystem->setCurrentIndex((originalGraphicsSystem == "native") ? 0 : 1); + // 4 - off, 5 - shown, 6 - always, other are old values int hps = config.readEntry("HiddenPreviews", 5); if (hps == 6) // always @@ -461,6 +482,7 @@ bool KWinCompositingConfig::saveAdvancedTab() static const int hps[] = { 6 /*always*/, 5 /*shown*/, 4 /*never*/ }; KConfigGroup config(mKWinConfig, "Compositing"); + QString graphicsSystem = (ui.graphicsSystem->currentIndex() == 0) ? "native" : "raster"; if (config.readEntry("Backend", "OpenGL") != ((ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender") @@ -470,10 +492,14 @@ bool KWinCompositingConfig::saveAdvancedTab() advancedChanged = true; } else if (config.readEntry("HiddenPreviews", 5) != hps[ ui.windowThumbnails->currentIndex()] || (int)config.readEntry("XRenderSmoothScale", false) != ui.xrScaleFilter->currentIndex() - || config.readEntry("GLTextureFilter", 2) != ui.glScaleFilter->currentIndex()) + || config.readEntry("GLTextureFilter", 2) != ui.glScaleFilter->currentIndex()) { advancedChanged = true; + } else if (originalGraphicsSystem != graphicsSystem) { + advancedChanged = true; + } config.writeEntry("Backend", (ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender"); + config.writeEntry("GraphicsSystem", graphicsSystem); config.writeEntry("HiddenPreviews", hps[ ui.windowThumbnails->currentIndex()]); config.writeEntry("UnredirectFullscreen", ui.unredirectFullscreen->isChecked()); diff --git a/kcmkwin/kwincompositing/main.h b/kcmkwin/kwincompositing/main.h index d9937759cc..8e2f3bb65a 100644 --- a/kcmkwin/kwincompositing/main.h +++ b/kcmkwin/kwincompositing/main.h @@ -77,6 +77,7 @@ public slots: private slots: void rearmGlSupport(); + void suggestGraphicsSystem(); void toogleSmoothScaleUi(int compositingType); void toggleEffectShortcutChanged(const QKeySequence &seq); @@ -93,6 +94,7 @@ private: KSharedConfigPtr mTmpConfig; bool m_showConfirmDialog; KActionCollection* m_actionCollection; + QString originalGraphicsSystem; }; } // namespace diff --git a/kcmkwin/kwincompositing/main.ui b/kcmkwin/kwincompositing/main.ui index 0a63e9fbaf..8e8f7f01f5 100644 --- a/kcmkwin/kwincompositing/main.ui +++ b/kcmkwin/kwincompositing/main.ui @@ -7,14 +7,14 @@ 0 0 552 - 523 + 483 - 0 + 2 @@ -517,6 +517,39 @@ + + + + Qt graphics system: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">It is <span style=" font-weight:600;">strongly recommended</span> to use the <span style=" font-weight:600;">native</span> system when using the the <span style=" font-weight:600;">XRender</span> backend.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">On the other hand, many decorations perform better with the <span style=" font-weight:600;">raster</span> system on the <span style=" font-weight:600;">default and generally preferred OpenGL</span> backend (though some don't - also the impact here can be anything between &quot;slight&quot; and &quot;incredible&quot; depending on the GPU and driver)</p></body></html> + + + + Native + + + + + Raster + + + + @@ -810,16 +843,16 @@ On legacy hardware disabling Shaders can improve the performance. QWidget
kkeysequencewidget.h
- - KTitleWidget - QWidget -
ktitlewidget.h
-
KComboBox QComboBox
kcombobox.h
+ + KTitleWidget + QWidget +
ktitlewidget.h
+
KPluginSelector QWidget @@ -832,7 +865,6 @@ On legacy hardware disabling Shaders can improve the performance. useCompositing effectWinManagement effectAnimations - windowSwitchingCombo desktopSwitchingCombo animationSpeedCombo