Source Code (Use browser search to find items of interest.)
Class Index
kwin'PluginMgr (./kdebase/kwin/plugins.h:19)
class PluginMgr : public QObject
{
Q_OBJECT
public:
PluginMgr();
~PluginMgr();
Client *allocateClient(Workspace *ws, WId w);
void loadPlugin(QString name);
signals:
void resetAllClients();
protected:
Client* (*alloc_ptr)(Workspace *ws, WId w);
lt_dlhandle handle;
};
kwin'PluginMgr::PluginMgr() (./kdebase/kwin/plugins.cpp:94)
PluginMgr::PluginMgr()
: QObject()
{
alloc_ptr = NULL;
handle = 0;
QString pluginStr;
KConfig *config = KGlobal::config();
config->setGroup("Style");
pluginStr = config->readEntry("PluginLib", "standard");
if(pluginStr.isEmpty() || pluginStr == "standard")
return;
else
loadPlugin(pluginStr);
}
kwin'PluginMgr::~PluginMgr() (./kdebase/kwin/plugins.cpp:110)
PluginMgr::~PluginMgr()
{
if(handle)
lt_dlclose(handle);
}
kwin'PluginMgr::allocateClient() (./kdebase/kwin/plugins.cpp:116)
Client* PluginMgr::allocateClient(Workspace *ws, WId w)
{
if(alloc_ptr)
return(alloc_ptr(ws, w));
else
return(new StdClient(ws, w));
}
kwin'PluginMgr::loadPlugin() (./kdebase/kwin/plugins.cpp:124)
void PluginMgr::loadPlugin(QString nameStr)
{
static bool dlregistered = false;
static lt_dlhandle oldHandle = 0;
KConfig *config = KGlobal::config();
config->setGroup("Style");
config->writeEntry("PluginLib", nameStr);
oldHandle = handle;
if(nameStr.isNull()){
handle = 0;
alloc_ptr = NULL;
config->writeEntry("PluginLib", "standard");
}
else{
if(!dlregistered){
dlregistered = true;
lt_dlinit();
}
nameStr += ".la";
nameStr = KGlobal::dirs()->findResource("lib", nameStr);
if(!nameStr){
warning("KWin: cannot find client plugin.");
handle = 0;
alloc_ptr = NULL;
config->writeEntry("PluginLib", "standard");
}
else{
handle = lt_dlopen(nameStr.latin1());
if(!handle){
warning("KWin: cannot load client plugin %s.", nameStr.latin1());
handle = 0;
alloc_ptr = NULL;
config->writeEntry("PluginLib", "standard");
}
else{
lt_ptr_t alloc_func = lt_dlsym(handle, "allocate");
if(alloc_func)
alloc_ptr = (Client* (*)(Workspace *ws, WId w))alloc_func;
else{
warning("KWin: %s is not a KWin plugin.", nameStr.latin1());
lt_dlclose(handle);
handle = 0;
alloc_ptr = NULL;
config->writeEntry("PluginLib", "standard");
}
}
}
}
config->sync();
emit resetAllClients();
if(oldHandle)
lt_dlclose(oldHandle);
}