update !compositing panelbackground used until now

--following plasma approach and use always
even for !compositing mode the widgets/panel-background
svg file. This way when Latte and Plasma panels are
combined there is uniformity between them.

BUG: 406597
pull/5/head
Michail Vourlakos 6 years ago
parent 7a11670e33
commit 499c4eb1d1

@ -111,22 +111,22 @@ bool Theme::isDarkTheme() const
int Theme::bottomEdgeRoundness() const int Theme::bottomEdgeRoundness() const
{ {
return m_compositing ? m_bottomEdgeRoundness : m_solidBottomEdgeRoundness; return m_bottomEdgeRoundness;
} }
int Theme::leftEdgeRoundness() const int Theme::leftEdgeRoundness() const
{ {
return m_compositing ? m_leftEdgeRoundness : m_solidLeftEdgeRoundness; return m_leftEdgeRoundness;
} }
int Theme::topEdgeRoundness() const int Theme::topEdgeRoundness() const
{ {
return m_compositing ? m_topEdgeRoundness : m_solidTopEdgeRoundness; return m_topEdgeRoundness;
} }
int Theme::rightEdgeRoundness() const int Theme::rightEdgeRoundness() const
{ {
return m_compositing ? m_rightEdgeRoundness : m_solidRightEdgeRoundness; return m_rightEdgeRoundness;
} }
int Theme::outlineWidth() const int Theme::outlineWidth() const
@ -386,55 +386,9 @@ void Theme::loadCompositingRoundness()
svg->deleteLater(); svg->deleteLater();
} }
void Theme::loadNonCompositingRoundness()
{
Plasma::FrameSvg *svg = new Plasma::FrameSvg(this);
svg->setImagePath(QStringLiteral("opaque/dialogs/background"));
svg->setEnabledBorders(Plasma::FrameSvg::AllBorders);
svg->resizeFrame(QSize(100,100));
//! bottom roundness
if (svg->hasElementPrefix("south")) {
svg->setElementPrefix("south");
}
m_solidBottomEdgeRoundness = roundness(svg, Plasma::Types::BottomEdge);
//! left roundness
if (svg->hasElementPrefix("west")) {
svg->setElementPrefix("west");
} else {
svg->setElementPrefix("");
}
m_solidLeftEdgeRoundness = roundness(svg, Plasma::Types::LeftEdge);
//! top roundness
if (svg->hasElementPrefix("north")) {
svg->setElementPrefix("north");
} else {
svg->setElementPrefix("");
}
m_solidTopEdgeRoundness = roundness(svg, Plasma::Types::TopEdge);
//! right roundness
if (svg->hasElementPrefix("east")) {
svg->setElementPrefix("east");
} else {
svg->setElementPrefix("");
}
m_solidRightEdgeRoundness = roundness(svg, Plasma::Types::RightEdge);
qDebug() << " NON-COMPOSITING MASK ::: " << svg->mask();
qDebug() << " NON-COMPOSITING MASK BOUNDING RECT ::: " << svg->mask().boundingRect();
qDebug() << " NON-COMPOSITING ROUNDNESS ::: " <<
m_solidBottomEdgeRoundness << " _ " << m_solidLeftEdgeRoundness << " _ " << m_solidTopEdgeRoundness << " _ " << m_solidRightEdgeRoundness;
svg->deleteLater();
}
void Theme::loadRoundness() void Theme::loadRoundness()
{ {
loadCompositingRoundness(); loadCompositingRoundness();
loadNonCompositingRoundness();
emit roundnessChanged(); emit roundnessChanged();
} }

@ -107,7 +107,6 @@ private:
void loadThemePaths(); void loadThemePaths();
void loadRoundness(); void loadRoundness();
void loadCompositingRoundness(); void loadCompositingRoundness();
void loadNonCompositingRoundness();
void setOriginalSchemeFile(const QString &file); void setOriginalSchemeFile(const QString &file);
void parseThemeSvgFiles(); void parseThemeSvgFiles();
@ -126,11 +125,6 @@ private:
int m_topEdgeRoundness{0}; int m_topEdgeRoundness{0};
int m_rightEdgeRoundness{0}; int m_rightEdgeRoundness{0};
int m_solidBottomEdgeRoundness{0};
int m_solidLeftEdgeRoundness{0};
int m_solidTopEdgeRoundness{0};
int m_solidRightEdgeRoundness{0};
int m_outlineWidth{1}; int m_outlineWidth{1};
float m_backgroundMaxOpacity{1}; float m_backgroundMaxOpacity{1};

@ -312,6 +312,19 @@ void Effects::setMask(QRect area)
emit maskChanged(); emit maskChanged();
} }
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();
}
void Effects::updateMask() void Effects::updateMask()
{ {
if (KWindowSystem::compositingActive()) { if (KWindowSystem::compositingActive()) {
@ -326,12 +339,16 @@ void Effects::updateMask()
//! rounded corners to be shown correctly //! rounded corners to be shown correctly
//! the enabledBorders check was added because there was cases //! the enabledBorders check was added because there was cases
//! that the mask region wasn't calculated correctly after location changes //! that the mask region wasn't calculated correctly after location changes
if (!m_background || m_background->enabledBorders() != m_enabledBorders) { if (!m_background) {
if (m_background && m_background->enabledBorders() != m_enabledBorders) {
delete m_background;
}
m_background = new Plasma::FrameSvg(this); m_background = new Plasma::FrameSvg(this);
} }
if (m_background->imagePath() != "opaque/dialogs/background") { if (m_background->imagePath() != "widgets/panel-background") {
m_background->setImagePath(QStringLiteral("opaque/dialogs/background")); m_background->setImagePath(QStringLiteral("widgets/panel-background"));
} }
m_background->setEnabledBorders(m_enabledBorders); m_background->setEnabledBorders(m_enabledBorders);

@ -92,6 +92,8 @@ public:
Plasma::FrameSvg::EnabledBorders enabledBorders() const; Plasma::FrameSvg::EnabledBorders enabledBorders() const;
public slots: public slots:
Q_INVOKABLE void forceMaskRedraw();
void clearShadows(); void clearShadows();
void updateShadows(); void updateShadows();
void updateEffects(); void updateEffects();

@ -346,7 +346,7 @@ Item{
property rect efGeometry: Qt.rect(-1,-1,0,0) property rect efGeometry: Qt.rect(-1,-1,0,0)
imagePath: Latte.WindowSystem.compositingActive ? "widgets/panel-background" : "opaque/dialogs/background" imagePath: "widgets/panel-background"
onWidthChanged: updateEffectsArea(); onWidthChanged: updateEffectsArea();
onHeightChanged: updateEffectsArea(); onHeightChanged: updateEffectsArea();

@ -260,6 +260,12 @@ Item{
} }
} }
Connections{
target: themeExtended ? themeExtended : null
onRoundnessChanged: latteView.effects.forceMaskRedraw();
onThemeChanged: latteView.effects.forceMaskRedraw();
}
onNormalStateChanged: { onNormalStateChanged: {
if (normalState) { if (normalState) {
root.updateAutomaticIconSize(); root.updateAutomaticIconSize();

@ -1836,7 +1836,7 @@ DragDrop.DropArea {
VisibilityManager{ id: visibilityManager } VisibilityManager{ id: visibilityManager }
Layouts.Container { Layouts.LayoutsContainer {
id: layoutsContainer id: layoutsContainer
} }

Loading…
Cancel
Save