diff --git a/main.cpp b/main.cpp index 6055d49a30..36e5786bfb 100644 --- a/main.cpp +++ b/main.cpp @@ -302,10 +302,9 @@ Application::Application() // Reset crashes count if we stay up for more that 15 seconds QTimer::singleShot(15 * 1000, this, SLOT(resetCrashesCount())); - // If KWin was already running it saved its configuration after loosing the selection -> Reread - config->reparseConfiguration(); - initting = true; // Startup... + // first load options - done internally by a different thread + options = new Options; // Install X11 error handler XSetErrorHandler(x11ErrorHandler); @@ -321,7 +320,6 @@ Application::Application() // This tries to detect compositing options and can use GLX. GLX problems // (X errors) shouldn't cause kwin to abort, so this is out of the // critical startup section where x errors cause kwin to abort. - options = new Options; // create workspace. (void) new Workspace(isSessionRestored()); diff --git a/options.cpp b/options.cpp index 6eabc7896b..7bb35d0dad 100644 --- a/options.cpp +++ b/options.cpp @@ -191,7 +191,6 @@ Options::Options(QObject *parent) , show_geometry_tip(Options::defaultShowGeometryTip()) , animationSpeed(Options::defaultAnimationSpeed()) { - updateSettings(); } Options::~Options() @@ -781,7 +780,33 @@ void Options::setElectricBorders(int borders) emit electricBordersChanged(); } +void Options::reparseConfiguration() +{ + KGlobal::config()->reparseConfiguration(); +} + unsigned long Options::updateSettings() +{ + unsigned long changed = loadConfig(); + // Read button tooltip animation effect from kdeglobals + // Since we want to allow users to enable window decoration tooltips + // and not kstyle tooltips and vise-versa, we don't read the + // "EffectNoTooltip" setting from kdeglobals. + + +// QToolTip::setGloballyEnabled( d->show_tooltips ); +// KDE4 this probably needs to be done manually in clients + + // Driver-specific config detection + setCompositingInitialized(false); + reloadCompositingSettings(); + + emit configChanged(); + + return changed; +} + +unsigned long Options::loadConfig() { KSharedConfig::Ptr _config = KGlobal::config(); unsigned long changed = 0; @@ -895,25 +920,10 @@ unsigned long Options::updateSettings() setMaxFpsInterval(qRound(1000.0 / config.readEntry("MaxFPS", Options::defaultMaxFps()))); setRefreshRate(config.readEntry("RefreshRate", Options::defaultRefreshRate())); - // Read button tooltip animation effect from kdeglobals - // Since we want to allow users to enable window decoration tooltips - // and not kstyle tooltips and vise-versa, we don't read the - // "EffectNoTooltip" setting from kdeglobals. - - -// QToolTip::setGloballyEnabled( d->show_tooltips ); -// KDE4 this probably needs to be done manually in clients - - // Driver-specific config detection - setCompositingInitialized(false); - reloadCompositingSettings(); - - emit configChanged(); - return changed; } -void Options::reloadCompositingSettings(bool force) +bool Options::loadCompositingConfig (bool force) { KSharedConfig::Ptr _config = KGlobal::config(); KConfigGroup config(_config, "Compositing"); @@ -954,15 +964,22 @@ void Options::reloadCompositingSettings(bool force) if (m_compositingMode == NoCompositing) { setUseCompositing(false); - return; // do not even detect compositing preferences if explicitly disabled + return false; // do not even detect compositing preferences if explicitly disabled } // it's either enforced by env or by initial resume from "suspend" or we check the settings setUseCompositing(useCompositing || force || config.readEntry("Enabled", Options::defaultUseCompositing())); if (!m_useCompositing) - return; // not enforced or necessary and not "enabled" by setting + return false; // not enforced or necessary and not "enabled" by settings + return true; +} +void Options::reloadCompositingSettings(bool force) +{ + if (!loadCompositingConfig(force)) { + return; + } // from now on we've an initial setup and don't have to reload settings on compositing activation // see Workspace::setupCompositing(), composite.cpp setCompositingInitialized(true); @@ -971,7 +988,9 @@ void Options::reloadCompositingSettings(bool force) CompositingPrefs prefs; prefs.detect(); - setUseCompositing(config.readEntry("Enabled" , prefs.recommendCompositing())); + KSharedConfig::Ptr _config = KGlobal::config(); + KConfigGroup config(_config, "Compositing"); + setGlDirect(prefs.enableDirectRendering()); setGlVSync(config.readEntry("GLVSync", prefs.enableVSync())); setGlSmoothScale(qBound(-1, config.readEntry("GLTextureFilter", Options::defaultGlSmoothScale()), 2)); diff --git a/options.h b/options.h index 4d37d8bc42..cd4282f380 100644 --- a/options.h +++ b/options.h @@ -871,6 +871,17 @@ public: static int defaultAnimationSpeed() { return 3; } + + /** + * Performs loading all settings except compositing related. + **/ + unsigned long loadConfig(); + /** + * Performs loading of compositing settings which do not depend on OpenGL. + **/ + bool loadCompositingConfig(bool force); + void reparseConfiguration(); + //---------------------- Q_SIGNALS: void configChanged(); diff --git a/workspace.cpp b/workspace.cpp index b5fb7bb20c..ca82319971 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -157,6 +157,9 @@ Workspace::Workspace(bool restore) , m_finishingCompositing(false) , m_scripting(NULL) { + // If KWin was already running it saved its configuration after loosing the selection -> Reread + QFuture reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration); + (void) new KWinAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); @@ -171,6 +174,10 @@ Workspace::Workspace(bool restore) desktopGrid_[1] = 0; _self = this; + // PluginMgr needs access to the config file, so we need to wait for it for finishing + reparseConfigFuture.waitForFinished(); + options->loadConfig(); + options->loadCompositingConfig(false); mgr = new PluginMgr; QX11Info info; default_colormap = DefaultColormap(display(), info.screen());