Merge branch 'Plasma/5.17'

This commit is contained in:
David Edmundson 2019-10-15 12:41:39 +01:00
commit 96701c6702
3 changed files with 14 additions and 10 deletions

View file

@ -266,17 +266,19 @@ Decoration::Decoration(QObject *parent, const QVariantList &args)
Decoration::~Decoration()
{
Helper::instance().unref();
if (m_context) {
m_context->makeCurrent(m_offscreenSurface.data());
delete m_renderControl;
delete m_view.data();
m_fbo.reset();
delete m_item;
m_context->doneCurrent();
}
// deleted explicitly before our own qobject destructor as "this" is a context property of m_qmlContext,
// and changing contextProperties is a bad idea
delete m_qmlContext;
Helper::instance().unref();
}
void Decoration::init()
@ -285,9 +287,9 @@ void Decoration::init()
auto s = settings();
connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::configChanged);
QQmlContext *context = new QQmlContext(Helper::instance().rootContext(), this);
context->setContextProperty(QStringLiteral("decoration"), this);
context->setContextProperty(QStringLiteral("decorationSettings"), s.data());
m_qmlContext = new QQmlContext(Helper::instance().rootContext(), this);
m_qmlContext->setContextProperty(QStringLiteral("decoration"), this);
m_qmlContext->setContextProperty(QStringLiteral("decorationSettings"), s.data());
auto component = Helper::instance().component(m_themeName);
if (!component) {
return;
@ -310,9 +312,9 @@ void Decoration::init()
connect(this, &Decoration::configChanged, theme, readButtonSize);
readButtonSize();
// m_theme->setTabDragMimeType(tabDragMimeType());
context->setContextProperty(QStringLiteral("auroraeTheme"), theme);
m_qmlContext->setContextProperty(QStringLiteral("auroraeTheme"), theme);
}
m_item = qobject_cast< QQuickItem* >(component->create(context));
m_item = qobject_cast< QQuickItem* >(component->create(m_qmlContext));
if (!m_item) {
if (component->isError()) {
const auto errors = component->errors();
@ -322,7 +324,7 @@ void Decoration::init()
}
return;
}
m_item->setParent(this);
m_item->setParent(m_qmlContext);
QVariant visualParent = property("visualParent");
if (visualParent.isValid()) {

View file

@ -27,6 +27,7 @@ class QOffscreenSurface;
class QOpenGLContext;
class QOpenGLFramebufferObject;
class QQmlComponent;
class QQmlContext;
class QQmlEngine;
class QQuickItem;
class QQuickRenderControl;
@ -82,7 +83,8 @@ private:
QImage m_buffer;
QRect m_contentRect; //the geometry of the part of the buffer that is not a shadow when buffer was created.
QPointer<QQuickWindow> m_view;
QQuickItem *m_item;
QQuickItem *m_item = nullptr;
QQmlContext *m_qmlContext = nullptr;
KWin::Borders *m_borders;
KWin::Borders *m_maximizedBorders;
KWin::Borders *m_extendedBorders;

View file

@ -532,7 +532,7 @@ void TabBox::key(const char *actionName, Slot slot, const QKeySequence &shortcut
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
a->setObjectName(QString::fromUtf8(actionName));
a->setText(i18n(actionName));
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << shortcut);
KGlobalAccel::self()->setGlobalShortcut(a, QList<QKeySequence>() << shortcut);
input()->registerShortcut(shortcut, a, TabBox::self(), slot);
auto cuts = KGlobalAccel::self()->shortcut(a);
globalShortcutChanged(a, cuts.isEmpty() ? QKeySequence() : cuts.first());