int main(int argc, char* argv[])
{
-#ifdef Q_WS_X11
- // krunner only works properly with Qt's native X11 backend; override any compile-time
- // or command line settings to raster or OpenGL.
- QApplication::setGraphicsSystem(QLatin1String( "native" ));
-#endif
-
KAboutData aboutData( "krunner", 0, ki18n( "Run Command Interface" ),
KDE_VERSION_STRING, ki18n(description), KAboutData::License_GPL,
ki18n("(c) 2006, Aaron Seigo") );
if (effects) // setupCompositing() may fail
effects->reconfigure();
addRepaintFull();
- } else
+ } else {
finish();
+ }
}
void Compositor::slotReinitialize()
{
// Reparse config. Config options will be reloaded by setup()
KGlobal::config()->reparseConfiguration();
- const QString graphicsSystem = KConfigGroup(KGlobal::config(), "Compositing").readEntry("GraphicsSystem", "");
- if ((Extensions::nonNativePixmaps() && graphicsSystem == "native") ||
- (!Extensions::nonNativePixmaps() && (graphicsSystem == "raster" || graphicsSystem == "opengl")) ) {
- restartKWin("explicitly reconfigured graphicsSystem change");
- return;
- }
// Restart compositing
finish();
}
}
-void Compositor::restartKWin(const QString &reason)
-{
- kDebug(1212) << "restarting kwin for:" << reason;
- char cmd[1024]; // copied from crashhandler - maybe not the best way to do?
- sprintf(cmd, "%s --replace &", QFile::encodeName(QCoreApplication::applicationFilePath()).constData());
- system(cmd);
-}
-
bool Compositor::isCompositingPossible() const
{
return CompositingPrefs::compositingPossible();
bool windowRepaintsPending() const;
/**
- * Restarts the Window Manager in case that the Qt's GraphicsSystem need to be changed
- * for the chosen Compositing backend.
- * @param reason The reason why the Window Manager is being restarted, this is logged
- **/
- void restartKWin(const QString &reason);
-
- /**
* Whether the Compositor is currently suspended, 8 bits encoding the reason
**/
SuspendReasons m_suspended;
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
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()));
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(alignGuiToCompositingType(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.xrScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
ui.desktopSwitchingCombo->setCurrentIndex(1);
}
-void KWinCompositingConfig::suggestGraphicsSystem()
-{
- if (!ui.useCompositing->isChecked() || ui.compositingType->currentIndex() == XRENDER_INDEX)
- ui.graphicsSystem->setCurrentIndex(0);
-}
-
void KWinCompositingConfig::alignGuiToCompositingType(int compositingType)
{
+ ui.scaleMethodLabel->setVisible(compositingType == XRENDER_INDEX);
ui.xrScaleFilter->setVisible(compositingType == XRENDER_INDEX);
if (compositingType == XRENDER_INDEX)
ui.scaleMethodLabel->setBuddy(ui.xrScaleFilter);
ui.compositingType->setCurrentIndex(XRENDER_INDEX);
}
- 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
static const int hps[] = { 6 /*always*/, 5 /*shown*/, 4 /*never*/ };
KConfigGroup config(mKWinConfig, "Compositing");
- QString graphicsSystem = (ui.graphicsSystem->currentIndex() == 0) ? "native" : "raster";
QString backend;
}
if (config.readEntry("HiddenPreviews", 5) != hps[ ui.windowThumbnails->currentIndex()]
- || (int)config.readEntry("XRenderSmoothScale", false) != ui.xrScaleFilter->currentIndex()) {
- advancedChanged = true;
- } else if (originalGraphicsSystem != graphicsSystem) {
+ || (int)config.readEntry("XRenderSmoothScale", false) != ui.xrScaleFilter->currentIndex()
+ || config.readEntry("Backend") != ui.compositingType->currentText()) {
advancedChanged = true;
}
- config.writeEntry("Backend", backend);
+ config.writeEntry("Backend", backend);
- config.writeEntry("GraphicsSystem", graphicsSystem);
config.writeEntry("HiddenPreviews", hps[ ui.windowThumbnails->currentIndex()]);
config.writeEntry("UnredirectFullscreen", ui.unredirectFullscreen->isChecked());
#define __MAIN_H__
#include <kcmodule.h>
-
#include <ksharedconfig.h>
#include <ktemporaryfile.h>
+#include <QLabel>
+
#include "kwin_interface.h"
#include "ui_main.h"
class KPluginSelector;
class KActionCollection;
-#include <QLabel>
namespace KWin
{
private slots:
void confirmReInit() { showConfirmDialog(true); }
- void suggestGraphicsSystem();
void alignGuiToCompositingType(int compositingType);
void toggleEffectShortcutChanged(const QKeySequence &seq);
void updateStatusUI(bool compositingIsPossible);
KSharedConfigPtr mTmpConfig;
bool m_showConfirmDialog;
KActionCollection* m_actionCollection;
- QString originalGraphicsSystem;
QAction *m_showDetailedErrors;
QAction *m_dontShowAgain;
QString m_externErrorDetails;
<x>0</x>
<y>0</y>
<width>583</width>
- <height>389</height>
+ <height>367</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
</item>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Qt graphics system:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="graphicsSystem">
- <property name="toolTip">
- <string><!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:'Sans Serif'; font-size:9pt; 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;"><span style=" font-family:'Segoe'; font-size:8pt;">It is </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">strongly recommended</span><span style=" font-family:'Segoe'; font-size:8pt;"> to use the </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">native</span><span style=" font-family:'Segoe'; font-size:8pt;"> system when using the </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">XRender</span><span style=" font-family:'Segoe'; font-size:8pt;"> backend.</span></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; font-family:'Segoe'; font-size:8pt;"><br /></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Segoe'; font-size:8pt;">On the other hand, many decorations perform better with the </span><span style=" font-family:'Segoe'; font-size:8pt; font-weight:600;">raster</span><span style=" font-family:'Segoe'; font-size:8pt;"> system (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)</span></p></body></html></string>
- </property>
- <item>
- <property name="text">
- <string>Native</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Raster</string>
- </property>
- </item>
- </widget>
- </item>
</layout>
</item>
<item row="1" column="1">
<tabstop>animationSpeedCombo</tabstop>
<tabstop>effectSelector</tabstop>
<tabstop>compositingType</tabstop>
- <tabstop>graphicsSystem</tabstop>
<tabstop>windowThumbnails</tabstop>
<tabstop>xrScaleFilter</tabstop>
<tabstop>unredirectFullscreen</tabstop>
mallopt(M_TRIM_THRESHOLD, 5*pagesize);
#endif // M_TRIM_THRESHOLD
- // the raster graphicssystem has a quite terrible performance on the XRender backend or when not
- // compositing at all while some to many decorations suffer from bad performance of the native
- // graphicssystem (lack of implementation, QGradient internally uses the raster system and
- // XPutImage's the result because some graphics drivers have insufficient or bad performing
- // implementations of XRenderCreate*Gradient)
- //
- // Therefore we allow configurationa and do some automagic selection to discourage
- // ""known to be stupid" ideas ;-P
- // The invalid system parameter "" will use the systems default graphicssystem
- // "!= XRender" is intended since eg. pot. SW backends likely would profit from raster as well
- KConfigGroup config(KSharedConfig::openConfig("kwinrc"), "Compositing");
- QString preferredSystem("native");
- if (config.readEntry("Enabled", true) && config.readEntry("Backend", "XRender") != "XRender")
- preferredSystem = "";
- QApplication::setGraphicsSystem(config.readEntry("GraphicsSystem", preferredSystem));
-
Display* dpy = XOpenDisplay(NULL);
if (!dpy) {
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",