mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
plasmatheme:for defaults settings use real mask
--follow the new panel background way to access its mask and use it also for both the blur area and mask area when they are really needed. Such a case in only when the user has requested for plasma theme default settings BUG:455567
This commit is contained in:
parent
cbf9088f60
commit
bdf92099bb
@ -91,17 +91,6 @@ void Effects::init()
|
||||
connect(m_view, &Latte::View::layoutChanged, this, &Effects::onPopUpMarginChanged);
|
||||
|
||||
connect(&m_theme, &Plasma::Theme::themeChanged, this, [&]() {
|
||||
auto background = m_background;
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
|
||||
if (background) {
|
||||
background->deleteLater();
|
||||
}
|
||||
|
||||
if (m_background->imagePath() != "widgets/panel-background") {
|
||||
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
|
||||
}
|
||||
|
||||
updateBackgroundContrastValues();
|
||||
updateEffects();
|
||||
});
|
||||
@ -353,6 +342,21 @@ void Effects::setAppletsLayoutGeometry(const QRect &geom)
|
||||
emit appletsLayoutGeometryChanged();
|
||||
}
|
||||
|
||||
QQuickItem *Effects::panelBackgroundSvg() const
|
||||
{
|
||||
return m_panelBackgroundSvg;
|
||||
}
|
||||
|
||||
void Effects::setPanelBackgroundSvg(QQuickItem *quickitem)
|
||||
{
|
||||
if (m_panelBackgroundSvg == quickitem) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_panelBackgroundSvg = quickitem;
|
||||
emit panelBackgroundSvgChanged();
|
||||
}
|
||||
|
||||
void Effects::onPopUpMarginChanged()
|
||||
{
|
||||
m_view->setProperty("_applets_popup_margin", QVariant(popUpMargin()));
|
||||
@ -360,14 +364,6 @@ void Effects::onPopUpMarginChanged()
|
||||
|
||||
void Effects::forceMaskRedraw()
|
||||
{
|
||||
if (m_background) {
|
||||
delete m_background;
|
||||
}
|
||||
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
|
||||
m_background->setEnabledBorders(m_enabledBorders);
|
||||
|
||||
updateMask();
|
||||
}
|
||||
|
||||
@ -499,21 +495,14 @@ void Effects::updateMask()
|
||||
//! rounded corners to be shown correctly
|
||||
//! the enabledBorders check was added because there was cases
|
||||
//! that the mask region wasn't calculated correctly after location changes
|
||||
if (!m_background) {
|
||||
if (m_background && m_background->enabledBorders() != m_enabledBorders) {
|
||||
delete m_background;
|
||||
}
|
||||
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
if (!m_panelBackgroundSvg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_background->imagePath() != "widgets/panel-background") {
|
||||
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
|
||||
const QVariant maskProperty = m_panelBackgroundSvg->property("mask");
|
||||
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
|
||||
fixedMask = maskProperty.value<QRegion>();
|
||||
}
|
||||
|
||||
m_background->setEnabledBorders(m_enabledBorders);
|
||||
m_background->resizeFrame(maskRect.size());
|
||||
fixedMask = m_background->mask();
|
||||
}
|
||||
|
||||
fixedMask.translate(maskRect.x(), maskRect.y());
|
||||
@ -564,18 +553,18 @@ void Effects::updateEffects()
|
||||
//! this is used when compositing is disabled and provides
|
||||
//! the correct way for the mask to be painted in order for
|
||||
//! rounded corners to be shown correctly
|
||||
if (!m_background) {
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
if (!m_panelBackgroundSvg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_background->imagePath() != "widgets/panel-background") {
|
||||
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
|
||||
if (m_rect == VisibilityManager::ISHIDDENMASK) {
|
||||
clearEffects = true;
|
||||
} else {
|
||||
const QVariant maskProperty = m_panelBackgroundSvg->property("mask");
|
||||
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
|
||||
backMask = maskProperty.value<QRegion>();
|
||||
}
|
||||
}
|
||||
|
||||
m_background->setEnabledBorders(m_enabledBorders);
|
||||
m_background->resizeFrame(m_rect.size());
|
||||
|
||||
backMask = m_background->mask();
|
||||
}
|
||||
|
||||
//! adjust mask coordinates based on local coordinates
|
||||
|
@ -52,6 +52,8 @@ class Effects: public QObject
|
||||
|
||||
Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders NOTIFY enabledBordersChanged)
|
||||
|
||||
Q_PROPERTY(QQuickItem *panelBackgroundSvg READ panelBackgroundSvg WRITE setPanelBackgroundSvg NOTIFY panelBackgroundSvgChanged)
|
||||
|
||||
public:
|
||||
Effects(Latte::View *parent);
|
||||
virtual ~Effects();
|
||||
@ -102,6 +104,9 @@ public:
|
||||
|
||||
Plasma::FrameSvg::EnabledBorders enabledBorders() const;
|
||||
|
||||
QQuickItem *panelBackgroundSvg() const;
|
||||
void setPanelBackgroundSvg(QQuickItem *quickitem);
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void forceMaskRedraw();
|
||||
Q_INVOKABLE void setSubtractedMaskRegion(const QString ®ionid, const QRegion ®ion);
|
||||
@ -130,6 +135,7 @@ signals:
|
||||
void maskChanged();
|
||||
void innerShadowChanged();
|
||||
void inputMaskChanged();
|
||||
void panelBackgroundSvgChanged();
|
||||
void popUpMarginChanged();
|
||||
void rectChanged();
|
||||
|
||||
@ -185,12 +191,13 @@ private:
|
||||
PlasmaExtended::CornerRegions m_cornersMaskRegion;
|
||||
|
||||
Plasma::Theme m_theme;
|
||||
//only for the mask on disabled compositing, not to actually paint
|
||||
Plasma::FrameSvg *m_background{nullptr};
|
||||
|
||||
//only for the mask, not to actually paint
|
||||
Plasma::FrameSvg::EnabledBorders m_enabledBorders{Plasma::FrameSvg::AllBorders};
|
||||
|
||||
//assigned from qml side in order to access the official panel background svg
|
||||
QQuickItem *m_panelBackgroundSvg{nullptr};
|
||||
|
||||
//! Subtracted and United Mask regions
|
||||
QHash<QString, QRegion> m_subtractedMaskRegions;
|
||||
QHash<QString, QRegion> m_unitedMaskRegions;
|
||||
|
@ -224,6 +224,13 @@ Item {
|
||||
value: background.shadows.headThickness
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: latteView && latteView.effects ? latteView.effects : null
|
||||
property: "panelBackgroundSvg"
|
||||
when: latteView && latteView.effects
|
||||
value: background.panelBackgroundSvg
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: latteView && latteView.effects ? latteView.effects : null
|
||||
property:"appletsLayoutGeometry"
|
||||
|
@ -22,6 +22,8 @@ import "../colorizer" as Colorizer
|
||||
BackgroundProperties{
|
||||
id:barLine
|
||||
|
||||
readonly property alias panelBackgroundSvg: solidBackground
|
||||
|
||||
//! Layer 0: Multi-Layer container in order to provide a consistent final element that acts
|
||||
//! as a single entity/background
|
||||
width: root.isHorizontal ? totals.visualLength : 16
|
||||
@ -312,6 +314,7 @@ BackgroundProperties{
|
||||
|
||||
onXChanged: solidBackground.updateEffectsArea();
|
||||
onYChanged: solidBackground.updateEffectsArea();
|
||||
onScreenEdgeMarginChanged: solidBackground.updateEffectsArea();
|
||||
|
||||
//! Layer 1: Shadows that are drawn around the background but always inside the View window (these are internal drawn shadows).
|
||||
//! When the container has chosen external shadows (these are shadows that are drawn out of the View window from the compositor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user