diff --git a/options.cpp b/options.cpp index c6e364a608..f1d1f6bd47 100644 --- a/options.cpp +++ b/options.cpp @@ -271,9 +271,6 @@ void Options::reload() globalConfig.setGroup("KDE"); d->fade_tooltips = globalConfig.readBoolEntry("EffectFadeTooltip", false); d->animate_tooltips = globalConfig.readBoolEntry("EffectAnimateTooltip", false); - - emit resetPlugin(); - emit resetClients(); } diff --git a/options.h b/options.h index ab5a0e2e34..acb5a58c84 100644 --- a/options.h +++ b/options.h @@ -323,9 +323,6 @@ public: public slots: void reload(); -signals: - void resetPlugin(); - void resetClients(); protected: QFont activeFont, inactiveFont, activeFontSmall, inactiveFontSmall; diff --git a/plugins.cpp b/plugins.cpp index 981090f63a..f1889bdd14 100644 --- a/plugins.cpp +++ b/plugins.cpp @@ -32,7 +32,9 @@ PluginMgr::PluginMgr() library = 0; pluginStr = "kwin_undefined"; - updatePlugin(); + KConfig *config = KGlobal::config(); + config->setGroup("Style"); + loadPlugin( config->readEntry("PluginLib", defaultPlugin) ); } PluginMgr::~PluginMgr() @@ -52,10 +54,11 @@ void PluginMgr::updatePlugin() KConfig *config = KGlobal::config(); config->reparseConfiguration(); config->setGroup("Style"); - QString newPlugin = config->readEntry("PluginLib", defaultPlugin); - - if (newPlugin != pluginStr) - loadPlugin(newPlugin); + if ( !loadPlugin( config->readEntry("PluginLib", defaultPlugin )) && library ) { + void *reset_func = library->symbol("reset"); + if (reset_func) + ((void (*)())reset_func)(); + } } Client* PluginMgr::allocateClient(Workspace *ws, WId w, bool tool) @@ -69,7 +72,7 @@ Client* PluginMgr::allocateClient(Workspace *ws, WId w, bool tool) } // returns true if plugin was loaded successfully -void PluginMgr::loadPlugin(QString nameStr) +bool PluginMgr::loadPlugin(QString nameStr) { KLibrary *oldLibrary = library; library = 0; @@ -88,14 +91,17 @@ void PluginMgr::loadPlugin(QString nameStr) // Check if this library is not already loaded. if(pluginStr == nameStr) - return; + return FALSE; // Try loading the requested plugin library = KLibLoader::self()->library(QFile::encodeName(path)); // If that fails, fall back to the default plugin if (!library) { + kdDebug() << " could not load library, try default plugin again" << endl; nameStr = defaultPlugin; + if ( pluginStr == nameStr ) + return FALSE; path = KLibLoader::findLibrary(QFile::encodeName(nameStr)); if (!path.isEmpty()) library = KLibLoader::self()->library(QFile::encodeName(path)); @@ -129,13 +135,7 @@ void PluginMgr::loadPlugin(QString nameStr) ((void (*)())deinit_func)(); oldLibrary->unload(); } -} - -void PluginMgr::resetPlugin() -{ - void *reset_func = library->symbol("reset"); - if (reset_func) - ((void (*)())reset_func)(); + return TRUE; } void PluginMgr::shutdownKWin(const QString &error_msg) diff --git a/plugins.h b/plugins.h index 7bb33dbe9a..08b66cd831 100644 --- a/plugins.h +++ b/plugins.h @@ -24,11 +24,10 @@ public: PluginMgr(); ~PluginMgr(); Client *allocateClient(Workspace *ws, WId w, bool tool); - void loadPlugin(QString name); + bool loadPlugin(QString name); QString currentPlugin() { return pluginStr; } public slots: void updatePlugin(); - void resetPlugin(); signals: void resetAllClients(); protected: diff --git a/workspace.cpp b/workspace.cpp index 1c31e075be..3af70679df 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2005,18 +2005,13 @@ void Workspace::reconfigure() void Workspace::slotReconfigure() { kdDebug(1212) << "Workspace::slotReconfigure()" << endl; - reconfigureTimer.stop(); KGlobal::config()->reparseConfiguration(); options->reload(); tab_box->reconfigure(); - readShortcuts(); - mgr->updatePlugin(); - // NO need whatsoever to call slotResetAllClientsDelayed here, - // updatePlugin resets all clients if necessary anyway. if (options->electricBorders() == Options::ElectricAlways) createBorderWindows();