DecorationPlugin becomes a QObject

This allows to move the slot to reset the decoration when compositing
got toggled from Workspace to DecorationPlugin and the custom cleanup
is no longer needed.

REVIEW: 109909
This commit is contained in:
Martin Gräßlin 2013-04-09 08:32:49 +02:00
parent 15546e11c2
commit a442bd6416
4 changed files with 17 additions and 15 deletions

View file

@ -33,8 +33,9 @@ namespace KWin
KWIN_SINGLETON_FACTORY(DecorationPlugin)
DecorationPlugin::DecorationPlugin(QObject *)
: KDecorationPlugins(KGlobal::config())
DecorationPlugin::DecorationPlugin(QObject *parent)
: QObject(parent)
, KDecorationPlugins(KGlobal::config())
, m_disabled(false)
{
defaultPlugin = "kwin3_oxygen";
@ -145,4 +146,12 @@ QList< int > DecorationPlugin::supportedColors() const
return ret;
}
void DecorationPlugin::resetCompositing()
{
if (m_disabled) {
return;
}
factory()->reset(SettingCompositing);
}
} // namespace

View file

@ -29,8 +29,9 @@ namespace KWin
{
class DecorationPlugin
: public KDecorationPlugins
: public QObject, public KDecorationPlugins
{
Q_OBJECT
public:
virtual ~DecorationPlugin();
virtual bool provides(Requirement);
@ -53,6 +54,9 @@ public:
* @todo: remove KDE5
**/
QList<int> supportedColors() const;
public Q_SLOTS:
void resetCompositing();
protected:
virtual void error(const QString& error_msg);
private:

View file

@ -208,7 +208,7 @@ Workspace::Workspace(bool restore)
m_compositor = Compositor::create(this);
connect(this, SIGNAL(currentDesktopChanged(int,KWin::Client*)), m_compositor, SLOT(addRepaintFull()));
connect(m_compositor, SIGNAL(compositingToggled(bool)), SLOT(slotCompositingToggled()));
connect(m_compositor, SIGNAL(compositingToggled(bool)), decorationPlugin(), SLOT(resetCompositing()));
new DBusInterface(this);
@ -537,7 +537,6 @@ Workspace::~Workspace()
delete rootInfo;
delete supportWindow;
delete decorationPlugin();
delete startup;
delete Placement::self();
delete client_keys_dialog;
@ -1811,15 +1810,6 @@ QString Workspace::supportInformation() const
return support;
}
void Workspace::slotCompositingToggled()
{
// notify decorations that composition state has changed
DecorationPlugin *deco = DecorationPlugin::self();
if (!deco->isDisabled()) {
deco->factory()->reset(SettingCompositing);
}
}
void Workspace::slotToggleCompositing()
{
if (m_compositor) {

View file

@ -402,7 +402,6 @@ public slots:
void reconfigure();
void slotReconfigure();
void slotCompositingToggled();
void slotKillWindow();