From bb5dce0e3b5b22cf04cfde385c05ddbc626f7c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 27 Apr 2012 11:37:21 +0200 Subject: [PATCH] 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 --- composite.cpp | 4 ++-- compositingprefs.cpp | 9 +++------ libkwineffects/kwineffects.cpp | 3 +-- libkwineffects/kwinglutils.cpp | 3 +-- workspace.cpp | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/composite.cpp b/composite.cpp index 28e00b5278..f5f7038695 100644 --- a/composite.cpp +++ b/composite.cpp @@ -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(); diff --git a/compositingprefs.cpp b/compositingprefs.cpp index c3cf13bd9e..ea6cb2b507 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -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("OpenGL compositing (the default) has crashed KWin in the past.
" diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 135c9ae165..1737ceb554 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -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; diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 3a7692f84e..016603bc7f 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -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("GLLegacy", false); glVersion = MAKE_GL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(), glversioninfo[2].toInt()); #endif diff --git a/workspace.cpp b/workspace.cpp index 5e1609ac2b..bc264d970d 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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");