[kdecoration] Adjust to change that DecorationBridge is no longer a singleton

* Aurorae needs to pass QVariantList args to parent Decoration
* DecorationBridge implementation needs to be a KWIN_SINGLETON
* DecorationBridge needs to be passed with args to created Decoration
This commit is contained in:
Martin Gräßlin 2014-10-30 09:01:06 +01:00
parent 69c3233ead
commit fcec334b3c
4 changed files with 17 additions and 16 deletions

View file

@ -212,7 +212,7 @@ void Helper::init()
Decoration::Decoration(QObject *parent, const QVariantList &args)
: KDecoration2::Decoration(parent)
: KDecoration2::Decoration(parent, args)
, m_item(nullptr)
, m_borders(nullptr)
, m_maximizedBorders(nullptr)

View file

@ -47,20 +47,19 @@ namespace Decoration
static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2");
KWIN_SINGLETON_FACTORY(DecorationBridge)
DecorationBridge::DecorationBridge(QObject *parent)
: QObject(parent)
, KDecoration2::DecorationBridge()
: KDecoration2::DecorationBridge(parent)
, m_factory(nullptr)
, m_blur(false)
, m_settings()
{
}
DecorationBridge::~DecorationBridge() = default;
DecorationBridge *DecorationBridge::self()
DecorationBridge::~DecorationBridge()
{
return static_cast<KWin::Decoration::DecorationBridge*>(KDecoration2::DecorationBridge::self());
s_self = nullptr;
}
static QString readPlugin()
@ -192,11 +191,12 @@ KDecoration2::Decoration *DecorationBridge::createDecoration(Client *client)
if (!m_factory) {
return nullptr;
}
QVariantList args;
QVariantMap args({ {QStringLiteral("bridge"), QVariant::fromValue(this)} });
if (!m_theme.isEmpty()) {
args << QVariantMap({ {QStringLiteral("theme"), m_theme} });
args.insert(QStringLiteral("theme"), m_theme);
}
auto deco = m_factory->create<KDecoration2::Decoration>(client, args);
auto deco = m_factory->create<KDecoration2::Decoration>(client, QVariantList({args}));
deco->setSettings(m_settings);
deco->init();
return deco;

View file

@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_DECORATION_BRIDGE_H
#define KWIN_DECORATION_BRIDGE_H
#include <kwinglobals.h>
#include <KDecoration2/Private/DecorationBridge>
#include <QObject>
@ -40,11 +42,10 @@ class Client;
namespace Decoration
{
class DecorationBridge : public QObject, public KDecoration2::DecorationBridge
class DecorationBridge : public KDecoration2::DecorationBridge
{
Q_OBJECT
public:
explicit DecorationBridge(QObject *parent);
virtual ~DecorationBridge();
void init();
@ -64,7 +65,6 @@ public:
return m_settings;
}
static DecorationBridge *self();
private:
void loadMetaData(const QJsonObject &object);
void findTheme(const QVariantMap &map);
@ -76,6 +76,7 @@ private:
QString m_defaultTheme;
QString m_theme;
QSharedPointer<KDecoration2::DecorationSettings> m_settings;
KWIN_SINGLETON(DecorationBridge)
};
} // Decoration
} // KWin

View file

@ -214,9 +214,9 @@ Workspace::Workspace(bool restore)
m_compositor = Compositor::create(this);
connect(this, SIGNAL(currentDesktopChanged(int,KWin::Client*)), m_compositor, SLOT(addRepaintFull()));
new Decoration::DecorationBridge(this);
Decoration::DecorationBridge::self()->init();
connect(this, &Workspace::configChanged, Decoration::DecorationBridge::self(), &Decoration::DecorationBridge::reconfigure);
auto decorationBridge = Decoration::DecorationBridge::create(this);
decorationBridge->init();
connect(this, &Workspace::configChanged, decorationBridge, &Decoration::DecorationBridge::reconfigure);
new DBusInterface(this);