mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 17:33:50 +03:00
remove deprecated Effects subtracted implementatio
This commit is contained in:
parent
46760a04de
commit
54ea58c215
@ -24,7 +24,6 @@
|
||||
#include <coretypes.h>
|
||||
#include "panelshadows_p.h"
|
||||
#include "view.h"
|
||||
#include "settings/primaryconfigview.h"
|
||||
|
||||
// Qt
|
||||
#include <QRegion>
|
||||
@ -54,7 +53,6 @@ void Effects::init()
|
||||
connect(this, &Effects::drawEffectsChanged, this, &Effects::updateEffects);
|
||||
connect(this, &Effects::enabledBordersChanged, this, &Effects::updateEffects);
|
||||
connect(this, &Effects::rectChanged, this, &Effects::updateEffects);
|
||||
connect(this, &Effects::settingsMaskSubtractedChanged, this, &Effects::updateMask);
|
||||
|
||||
connect(this, &Effects::drawShadowsChanged, this, [&]() {
|
||||
if (m_view->behaveAsPlasmaPanel()) {
|
||||
@ -201,98 +199,6 @@ void Effects::setInnerShadow(int shadow)
|
||||
emit innerShadowChanged();
|
||||
}
|
||||
|
||||
bool Effects::settingsMaskSubtracted() const
|
||||
{
|
||||
return m_settingsMaskSubtracted;
|
||||
}
|
||||
|
||||
void Effects::setSettingsMaskSubtracted(bool enabled)
|
||||
{
|
||||
if (m_settingsMaskSubtracted == enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settingsMaskSubtracted = enabled;
|
||||
|
||||
emit settingsMaskSubtractedChanged();
|
||||
}
|
||||
|
||||
QRegion Effects::subtrackedMaskFromWindow(QRegion initialRegion, QQuickView *window)
|
||||
{
|
||||
QRegion subtractedMask = initialRegion;
|
||||
|
||||
int start;
|
||||
int length;
|
||||
|
||||
if (m_view->formFactor() == Plasma::Types::Horizontal) {
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
start = window->x();
|
||||
length = window->width();
|
||||
} else {
|
||||
start = m_view->x();
|
||||
length = m_view->width();
|
||||
}
|
||||
} else {
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
start = window->y();
|
||||
length = window->height();
|
||||
} else {
|
||||
start = m_view->y();
|
||||
length = m_view->height();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_settingsMaskSubtracted && window) {
|
||||
QRect windowMask;
|
||||
//! we need to subtrack the mask areas that overlap with underlying window
|
||||
switch (m_view->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y() + m_mask.height() - m_editShadow));
|
||||
windowMask.setSize(QSize(length, m_editShadow));
|
||||
break;
|
||||
|
||||
case Plasma::Types::LeftEdge:
|
||||
windowMask.setTopLeft(QPoint(m_mask.right() + 1 - m_editShadow, start - m_view->y()));
|
||||
windowMask.setSize(QSize(m_editShadow, length));
|
||||
break;
|
||||
|
||||
case Plasma::Types::RightEdge:
|
||||
windowMask.setTopLeft(QPoint(m_mask.x(), start - m_view->y()));
|
||||
windowMask.setSize(QSize(m_editShadow, length));
|
||||
break;
|
||||
|
||||
case Plasma::Types::BottomEdge:
|
||||
windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y()));
|
||||
windowMask.setSize(QSize(length, m_editShadow));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
subtractedMask = subtractedMask.subtracted(windowMask);
|
||||
}
|
||||
|
||||
return subtractedMask;
|
||||
}
|
||||
|
||||
QRegion Effects::subtractedMask()
|
||||
{
|
||||
QRegion subMask = m_mask;
|
||||
|
||||
if (m_settingsMaskSubtracted && m_view->configView()) {
|
||||
subMask = subtrackedMaskFromWindow(subMask, m_view->configView());
|
||||
|
||||
ViewPart::PrimaryConfigView *primaryConfig = qobject_cast<ViewPart::PrimaryConfigView *>(m_view->configView());
|
||||
|
||||
if (primaryConfig && m_view->formFactor() == Plasma::Types::Horizontal && primaryConfig->secondaryWindow()) {
|
||||
subMask = subtrackedMaskFromWindow(subMask, primaryConfig->secondaryWindow());
|
||||
}
|
||||
}
|
||||
|
||||
return subMask;
|
||||
}
|
||||
|
||||
QRect Effects::rect() const
|
||||
{
|
||||
return m_rect;
|
||||
@ -345,7 +251,7 @@ void Effects::updateMask()
|
||||
if (m_view->behaveAsPlasmaPanel()) {
|
||||
m_view->setMask(QRect());
|
||||
} else {
|
||||
m_view->setMask(subtractedMask());
|
||||
m_view->setMask(m_mask);
|
||||
}
|
||||
} else {
|
||||
//! this is used when compositing is disabled and provides
|
||||
|
@ -43,7 +43,6 @@ class Effects: public QObject
|
||||
Q_PROPERTY(bool animationsBlocked READ animationsBlocked NOTIFY animationsBlockedChanged)
|
||||
Q_PROPERTY(bool drawShadows READ drawShadows WRITE setDrawShadows NOTIFY drawShadowsChanged)
|
||||
Q_PROPERTY(bool drawEffects READ drawEffects WRITE setDrawEffects NOTIFY drawEffectsChanged)
|
||||
Q_PROPERTY(bool settingsMaskSubtracted READ settingsMaskSubtracted WRITE setSettingsMaskSubtracted NOTIFY settingsMaskSubtractedChanged)
|
||||
|
||||
//! thickness shadow size when is drawn inside the window from qml
|
||||
Q_PROPERTY(int editShadow READ editShadow WRITE setEditShadow NOTIFY editShadowChanged)
|
||||
@ -72,9 +71,6 @@ public:
|
||||
void setForceTopBorder(bool draw);
|
||||
void setForceBottomBorder(bool draw);
|
||||
|
||||
bool settingsMaskSubtracted() const;
|
||||
void setSettingsMaskSubtracted(bool enabled);
|
||||
|
||||
int editShadow() const;
|
||||
void setEditShadow(int shadow);
|
||||
|
||||
@ -111,7 +107,6 @@ signals:
|
||||
void maskChanged();
|
||||
void innerShadowChanged();
|
||||
void rectChanged();
|
||||
void settingsMaskSubtractedChanged();
|
||||
|
||||
private slots:
|
||||
void init();
|
||||
@ -121,16 +116,12 @@ private slots:
|
||||
private:
|
||||
qreal currentMidValue(const qreal &max, const qreal &factor, const qreal &min) const;
|
||||
|
||||
QRegion subtractedMask();
|
||||
QRegion subtrackedMaskFromWindow(QRegion initialRegion, QQuickView *window);
|
||||
|
||||
private:
|
||||
bool m_animationsBlocked{false};
|
||||
bool m_drawShadows{true};
|
||||
bool m_drawEffects{false};
|
||||
bool m_forceTopBorder{false};
|
||||
bool m_forceBottomBorder{false};
|
||||
bool m_settingsMaskSubtracted{false};
|
||||
|
||||
int m_editShadow{0};
|
||||
int m_innerShadow{0};
|
||||
|
@ -325,22 +325,6 @@ Item{
|
||||
}
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: latteView && latteView.effects ? latteView.effects : null
|
||||
property: "settingsMaskSubtracted"
|
||||
when: latteView && latteView.effects
|
||||
value: {
|
||||
if (LatteCore.WindowSystem.compositingActive
|
||||
&& root.editMode
|
||||
&& editModeVisual.editAnimationEnded
|
||||
&& (animations.needBothAxis.count === 0 || parabolic.factor.maxZoom===1) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! View::Positioner bindings
|
||||
Binding{
|
||||
target: latteView && latteView.positioner ? latteView.positioner : null
|
||||
|
Loading…
Reference in New Issue
Block a user