Use KGlobal::config() instead of specifying kwinrc

Inside KWin we can just use the global configuration
instead of manually opening kwinrc which is just the
same.

REVIEW: 104754
icc-effect-5.14.5
Martin Gräßlin 2012-04-27 11:37:21 +02:00
parent 6919b4dc94
commit bb5dce0e3b
5 changed files with 8 additions and 13 deletions

View File

@ -124,7 +124,7 @@ void Workspace::slotCompositingOptionsInitialized()
kDebug(1212) << "Initializing OpenGL compositing";
// Some broken drivers crash on glXQuery() so to prevent constant KWin crashes:
KSharedConfigPtr unsafeConfigPtr(KSharedConfig::openConfig("kwinrc"));
KSharedConfigPtr unsafeConfigPtr = KGlobal::config();
KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing");
if (unsafeConfig.readEntry("OpenGLIsUnsafe", false))
kWarning(1212) << "KWin has detected that your OpenGL library is unsafe to use";
@ -247,7 +247,7 @@ void Workspace::finishCompositing()
void Workspace::fallbackToXRenderCompositing()
{
finishCompositing();
KConfigGroup config(KSharedConfig::openConfig("kwinrc"), "Compositing");
KConfigGroup config(KGlobal::config(), "Compositing");
config.writeEntry("Backend", "XRender");
config.writeEntry("GraphicsSystem", "native");
config.sync();

View File

@ -48,15 +48,13 @@ CompositingPrefs::~CompositingPrefs()
bool CompositingPrefs::openGlIsBroken()
{
KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc");
return KConfigGroup(config, "Compositing").readEntry("OpenGLIsUnsafe", false);
return KConfigGroup(KGlobal::config(), "Compositing").readEntry("OpenGLIsUnsafe", false);
}
bool CompositingPrefs::compositingPossible()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc");
KConfigGroup gl_workaround_group(config, "Compositing");
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
gl_workaround_group.readEntry("OpenGLIsUnsafe", false))
return false;
@ -86,8 +84,7 @@ bool CompositingPrefs::compositingPossible()
QString CompositingPrefs::compositingNotPossibleReason()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc");
KConfigGroup gl_workaround_group(config, "Compositing");
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
gl_workaround_group.readEntry("OpenGLIsUnsafe", false))
return i18n("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>"

View File

@ -271,8 +271,7 @@ void EffectsHandler::sendReloadMessage(const QString& effectname)
KConfigGroup EffectsHandler::effectConfig(const QString& effectname)
{
KSharedConfig::Ptr kwinconfig = KSharedConfig::openConfig("kwinrc", KConfig::NoGlobals);
return kwinconfig->group("Effect-" + effectname);
return KGlobal::config()->group("Effect-" + effectname);
}
EffectsHandler* effects = 0;

View File

@ -105,8 +105,7 @@ void initGL()
#ifdef KWIN_HAVE_OPENGLES
legacyGl = false;
#else
KSharedConfig::Ptr kwinconfig = KSharedConfig::openConfig("kwinrc", KConfig::NoGlobals);
KConfigGroup config(kwinconfig, "Compositing");
KConfigGroup config(KGlobal::config(), "Compositing");
legacyGl = config.readEntry<bool>("GLLegacy", false);
glVersion = MAKE_GL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(), glversioninfo[2].toInt());
#endif

View File

@ -1054,7 +1054,7 @@ void Workspace::slotReinitCompositing()
{
// Reparse config. Config options will be reloaded by setupCompositing()
KGlobal::config()->reparseConfiguration();
const QString graphicsSystem = KConfigGroup(KSharedConfig::openConfig("kwinrc"), "Compositing").readEntry("GraphicsSystem", "");
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");