1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-27 14:50:21 +03:00

fix compatibility with frameworks 5.38

--FrameSvgItem::mask() was introduced after
frameworks 5.58. Restore a bit the old
implementation

FIXED-IN:0.9.11
BUG:419678
This commit is contained in:
Michail Vourlakos 2020-04-05 18:48:42 +03:00
parent c6a83937fa
commit e38d5bc5a3
6 changed files with 49 additions and 41 deletions

View File

@ -82,6 +82,9 @@ PrimaryConfigView::PrimaryConfigView(Plasma::Containment *containment, Latte::Vi
m_screenSyncTimer.setSingleShot(true);
m_screenSyncTimer.setInterval(100);
connect(this, &QQuickView::widthChanged, this, &PrimaryConfigView::updateEffects);
connect(this, &QQuickView::heightChanged, this, &PrimaryConfigView::updateEffects);
connect(this, &PrimaryConfigView::availableScreenGeometryChanged, this, &PrimaryConfigView::syncGeometry);
connect(this, &PrimaryConfigView::complexityChanged, this, &PrimaryConfigView::saveConfig);
connect(this, &PrimaryConfigView::complexityChanged, this, &PrimaryConfigView::updateShowInlineProperties);
@ -714,27 +717,30 @@ void PrimaryConfigView::updateEffects()
return;
}
QRegion mask;
QQuickItem *rootObject = this->rootObject();
if (rootObject) {
const QVariant maskProperty = rootObject->property("backgroundMask");
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
qDebug() << "found 2...";
mask = maskProperty.value<QRegion>();
}
if (!m_background) {
m_background = new Plasma::FrameSvg(this);
}
if (!mask.isEmpty()) {
if (KWindowSystem::compositingActive()) {
setMask(QRegion());
} else {
setMask(mask);
}
if (m_background->imagePath() != "widgets/panel-background") {
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
}
KWindowEffects::enableBlurBehind(winId(), true, mask);
m_background->setEnabledBorders(m_enabledBorders);
m_background->resizeFrame(size());
QRegion mask = m_background->mask();
QRegion fixedMask = mask.isNull() ? QRegion(QRect(0,0,width(),height())) : mask;
if (!fixedMask.isEmpty()) {
setMask(fixedMask);
} else {
setMask(QRegion());
}
if (KWindowSystem::compositingActive()) {
KWindowEffects::enableBlurBehind(winId(), true, fixedMask);
} else {
KWindowEffects::enableBlurBehind(winId(), false);
}
}

View File

@ -163,6 +163,9 @@ private:
Plasma::FrameSvg::EnabledBorders m_enabledBorders{Plasma::FrameSvg::AllBorders};
//only for the mask on disabled compositing, not to actually paint
Plasma::FrameSvg *m_background{nullptr};
Latte::Corona *m_corona{nullptr};
Latte::WindowSystem::WindowId m_waylandWindowId;
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};

View File

@ -77,6 +77,9 @@ SecondaryConfigView::SecondaryConfigView(Latte::View *view, QWindow *parent)
m_screenSyncTimer.setSingleShot(true);
m_screenSyncTimer.setInterval(100);
connect(this, &QQuickView::widthChanged, this, &SecondaryConfigView::updateEffects);
connect(this, &QQuickView::heightChanged, this, &SecondaryConfigView::updateEffects);
connect(this, &QQuickView::statusChanged, [&](QQuickView::Status status) {
if (status == QQuickView::Ready) {
updateEffects();
@ -415,26 +418,30 @@ void SecondaryConfigView::updateEffects()
return;
}
QRegion mask;
QQuickItem *rootObject = this->rootObject();
if (rootObject) {
const QVariant maskProperty = rootObject->property("backgroundMask");
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
mask = maskProperty.value<QRegion>();
}
if (!m_background) {
m_background = new Plasma::FrameSvg(this);
}
if (!mask.isEmpty()) {
if (KWindowSystem::compositingActive()) {
setMask(QRegion());
} else {
setMask(mask);
}
if (m_background->imagePath() != "widgets/panel-background") {
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
}
KWindowEffects::enableBlurBehind(winId(), true, mask);
m_background->setEnabledBorders(m_enabledBorders);
m_background->resizeFrame(size());
QRegion mask = m_background->mask();
QRegion fixedMask = mask.isNull() ? QRegion(QRect(0,0,width(),height())) : mask;
if (!fixedMask.isEmpty()) {
setMask(fixedMask);
} else {
setMask(QRegion());
}
if (KWindowSystem::compositingActive()) {
KWindowEffects::enableBlurBehind(winId(), true, fixedMask);
} else {
KWindowEffects::enableBlurBehind(winId(), false);
}
}

View File

@ -110,6 +110,8 @@ private:
QList<QMetaObject::Connection> connections;
Plasma::FrameSvg::EnabledBorders m_enabledBorders{Plasma::FrameSvg::AllBorders};
//only for the mask on disabled compositing, not to actually paint
Plasma::FrameSvg *m_background{nullptr};
Latte::Corona *m_corona{nullptr};
Latte::WindowSystem::WindowId m_waylandWindowId;

View File

@ -43,8 +43,6 @@ import "../controls" as LatteExtraControls
FocusScope {
id: dialog
property alias backgroundMask: backgroundFrameSvgItem.mask
readonly property bool basicLevel: viewConfig.complexity === Latte.Types.BasicSettings
readonly property bool advancedLevel: viewConfig.complexity === Latte.Types.AdvancedSettings
readonly property bool expertLevel: viewConfig.complexity === Latte.Types.ExpertSettings
@ -132,9 +130,6 @@ FocusScope {
enabledBorders: viewConfig.enabledBorders
onEnabledBordersChanged: viewConfig.updateEffects()
onWidthChanged: viewConfig.updateEffects()
onHeightChanged: viewConfig.updateEffects()
Component.onCompleted: viewConfig.updateEffects()
}

View File

@ -40,8 +40,6 @@ import "../controls" as LatteExtraControls
FocusScope {
id: dialog
property alias backgroundMask: backgroundFrameSvgItem.mask
width: typeSettings.width + units.smallSpacing * 4
height: typeSettings.height + units.smallSpacing * 4
Layout.minimumWidth: width
@ -58,9 +56,6 @@ FocusScope {
enabledBorders: viewConfig.enabledBorders
onEnabledBordersChanged: viewConfig.updateEffects()
onWidthChanged: viewConfig.updateEffects()
onHeightChanged: viewConfig.updateEffects()
Component.onCompleted: viewConfig.updateEffects()
}