Make DeocrationPlugin a KWin singleton
Like so many other classes there is exactly one instance hold by Workspace.
This commit is contained in:
parent
32be37bce3
commit
724bfd4548
3 changed files with 13 additions and 4 deletions
|
@ -30,7 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
DecorationPlugin::DecorationPlugin()
|
||||
KWIN_SINGLETON_FACTORY(DecorationPlugin)
|
||||
|
||||
DecorationPlugin::DecorationPlugin(QObject *)
|
||||
: KDecorationPlugins(KGlobal::config())
|
||||
, m_noDecoration(false)
|
||||
{
|
||||
|
@ -45,6 +47,11 @@ DecorationPlugin::DecorationPlugin()
|
|||
#endif
|
||||
}
|
||||
|
||||
DecorationPlugin::~DecorationPlugin()
|
||||
{
|
||||
s_self = NULL;
|
||||
}
|
||||
|
||||
void DecorationPlugin::error(const QString &error_msg)
|
||||
{
|
||||
qWarning("%s", QString(i18n("KWin: ") + error_msg).toLocal8Bit().data());
|
||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define KWIN_PLUGINS_H
|
||||
|
||||
#include <kdecoration_plugins_p.h>
|
||||
#include <kwinglobals.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ class DecorationPlugin
|
|||
: public KDecorationPlugins
|
||||
{
|
||||
public:
|
||||
DecorationPlugin();
|
||||
virtual ~DecorationPlugin();
|
||||
virtual bool provides(Requirement);
|
||||
/**
|
||||
* @returns @c true if there is no decoration plugin.
|
||||
|
@ -42,6 +43,7 @@ protected:
|
|||
private:
|
||||
void setNoDecoration(bool noDecoration);
|
||||
bool m_noDecoration;
|
||||
KWIN_SINGLETON(DecorationPlugin)
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -159,7 +159,7 @@ Workspace::Workspace(bool restore)
|
|||
reparseConfigFuture.waitForFinished();
|
||||
options->loadConfig();
|
||||
options->loadCompositingConfig(false);
|
||||
mgr = new DecorationPlugin;
|
||||
mgr = DecorationPlugin::create(this);
|
||||
default_colormap = DefaultColormap(display(), screen_number);
|
||||
installed_colormap = default_colormap;
|
||||
|
||||
|
@ -534,7 +534,7 @@ Workspace::~Workspace()
|
|||
|
||||
delete rootInfo;
|
||||
delete supportWindow;
|
||||
delete mgr;
|
||||
delete DecorationManager::self();
|
||||
delete startup;
|
||||
delete Placement::self();
|
||||
delete client_keys_dialog;
|
||||
|
|
Loading…
Reference in a new issue