From c48346551bd826e08a1891c4453efafa590849e3 Mon Sep 17 00:00:00 2001 From: Matthias Elter Date: Wed, 21 Feb 2001 18:29:24 +0000 Subject: [PATCH] Patch by Matthias Ettrich: Changing the focus policy does not reset all client styles. svn path=/trunk/kdebase/kwin/; revision=83927 --- plugins.cpp | 71 +++++++++++++++++++++------------------------------ workspace.cpp | 10 +++++--- workspace.h | 4 +-- 3 files changed, 37 insertions(+), 48 deletions(-) diff --git a/plugins.cpp b/plugins.cpp index e99614269c..2b544243d1 100644 --- a/plugins.cpp +++ b/plugins.cpp @@ -104,7 +104,7 @@ void PluginMenu::slotActivated(int id) config->setGroup("Style"); config->writeEntry("PluginLib", newPlugin); config->sync(); - // We can't do this directly because we might destruct a client + // We can't do this directly because we might destruct a client // underneath our own feet while doing so. QTimer::singleShot(0, mgr, SLOT(updatePlugin())); } @@ -129,8 +129,9 @@ bool PluginMgr::updatePlugin() { KConfig *config = KGlobal::config(); + config->reparseConfiguration(); config->setGroup("Style"); - QString newPlugin = config->readEntry("PluginLib", "default"); + QString newPlugin = config->readEntry("PluginLib", "standard" ); if (newPlugin != pluginStr) { loadPlugin(newPlugin); return true; @@ -149,50 +150,36 @@ Client* PluginMgr::allocateClient(Workspace *ws, WId w, bool tool) void PluginMgr::loadPlugin(QString nameStr) { static bool dlregistered = false; - static lt_dlhandle oldHandle = 0; + lt_dlhandle oldHandle = handle; + pluginStr = "standard"; + handle = 0; + alloc_ptr = 0; - pluginStr = nameStr; + if ( !nameStr.isEmpty() && nameStr != "standard" ) { + if(!dlregistered){ + dlregistered = true; + lt_dlinit(); + } + QString path = KLibLoader::findLibrary(nameStr.latin1()); - oldHandle = handle; - - // Rikkus: temporary change in semantics. - - if (nameStr.isEmpty()) - nameStr = "default"; - - if(!dlregistered){ - dlregistered = true; - lt_dlinit(); + if( !path.isEmpty() ) { + if ( (handle = lt_dlopen(path.latin1() ) ) ) { + lt_ptr_t alloc_func = lt_dlsym(handle, "allocate"); + if(alloc_func) { + alloc_ptr = (Client* (*)(Workspace *ws, WId w, int tool))alloc_func; + } else{ + qWarning("KWin: %s is not a KWin plugin.", path.latin1()); + lt_dlclose(handle); + handle = 0; + } + } else { + qWarning("KWin: cannot load client plugin %s.", path.latin1()); + } + } } - nameStr = KLibLoader::findLibrary(nameStr.latin1()); + if ( alloc_ptr ) + pluginStr = nameStr; - if(nameStr.isNull()){ - qWarning("KWin: cannot find client plugin."); - handle = 0; - alloc_ptr = NULL; - pluginStr = "standard"; - } - else{ - handle = lt_dlopen(nameStr.latin1()); - if(!handle){ - qWarning("KWin: cannot load client plugin %s.", nameStr.latin1()); - handle = 0; - alloc_ptr = NULL; - pluginStr = "standard"; - } - else{ - lt_ptr_t alloc_func = lt_dlsym(handle, "allocate"); - if(alloc_func) - alloc_ptr = (Client* (*)(Workspace *ws, WId w, int tool))alloc_func; - else{ - qWarning("KWin: %s is not a KWin plugin.", nameStr.latin1()); - lt_dlclose(handle); - handle = 0; - alloc_ptr = NULL; - pluginStr = "standard"; - } - } - } emit resetAllClients(); if(oldHandle) lt_dlclose(oldHandle); diff --git a/workspace.cpp b/workspace.cpp index 2de5af3b7a..8b6c1fe131 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -227,7 +227,6 @@ Workspace::Workspace( bool restore ) installed_colormap = default_colormap; session.setAutoDelete( TRUE ); - area = QRect( 0, 0, 0, 0 ); // bogus value so that updateClientArea does the right thing if ( restore ) loadSessionInfo(); @@ -1630,11 +1629,12 @@ void Workspace::unclutterDesktop() void Workspace::reconfigure() { KGlobal::config()->reparseConfiguration(); - if ( mgr->updatePlugin() ) - slotResetAllClientsDelayed(); options->reload(); keys->readSettings(); grabControlTab(options->useControlTab); + mgr->updatePlugin(); + // NO need whatsoever to call slotResetAllClientsDelayed here, + // updatePlugin resets all clients if necessary anyway. } /*! @@ -3099,7 +3099,9 @@ void Workspace::updateClientArea() */ QRect Workspace::clientArea() { - return area; + if (area.isNull()) + return QApplication::desktop()->geometry(); + return area; } diff --git a/workspace.h b/workspace.h index 72352581e7..6bc5b1bb8f 100644 --- a/workspace.h +++ b/workspace.h @@ -248,7 +248,7 @@ private slots: void sendToDesktop( int ); void clientPopupActivated( int ); void focusEnsurance(); - + protected: bool keyPress( XKeyEvent key ); bool keyRelease( XKeyEvent key ); @@ -358,7 +358,7 @@ private: // Timer to collect requests for 'ResetAllClients' QTimer resetTimer; - + QTimer focusEnsuranceTimer; };