Patch by Matthias Ettrich:

Changing the focus policy does not reset all client styles.

svn path=/trunk/kdebase/kwin/; revision=83927
This commit is contained in:
Matthias Elter 2001-02-21 18:29:24 +00:00
parent 6b9f88256e
commit c48346551b
3 changed files with 37 additions and 48 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
};