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

View file

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

View file

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

View file

@ -1054,7 +1054,7 @@ void Workspace::slotReinitCompositing()
{ {
// Reparse config. Config options will be reloaded by setupCompositing() // Reparse config. Config options will be reloaded by setupCompositing()
KGlobal::config()->reparseConfiguration(); 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") || if ((Extensions::nonNativePixmaps() && graphicsSystem == "native") ||
(!Extensions::nonNativePixmaps() && (graphicsSystem == "raster" || graphicsSystem == "opengl")) ) { (!Extensions::nonNativePixmaps() && (graphicsSystem == "raster" || graphicsSystem == "opengl")) ) {
restartKWin("explicitly reconfigured graphicsSystem change"); restartKWin("explicitly reconfigured graphicsSystem change");