mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-01 01:17:51 +03:00
remove workaround for struts gap
--consider always the maskThickness when settings struts in order to avoid gaps at all cases
This commit is contained in:
parent
37b708ef52
commit
137cd36547
@ -63,6 +63,17 @@ void Effects::init()
|
||||
connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateEffects);
|
||||
connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateShadows);
|
||||
connect(m_view, &Latte::View::configWindowGeometryChanged, this, &Effects::updateMask);
|
||||
|
||||
connect(m_view, &QQuickWindow::widthChanged, this, [&]() {
|
||||
if (m_view->behaveAsPlasmaPanel() && m_view->formFactor() == Plasma::Types::Vertical) {
|
||||
updateMaskThickness();
|
||||
}
|
||||
});
|
||||
connect(m_view, &QQuickWindow::heightChanged, this, [&]() {
|
||||
if (m_view->behaveAsPlasmaPanel() && m_view->formFactor() == Plasma::Types::Horizontal) {
|
||||
updateMaskThickness();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool Effects::animationsBlocked() const
|
||||
@ -195,29 +206,40 @@ void Effects::setSettingsMaskSubtracted(bool enabled)
|
||||
|
||||
int Effects::maskThickness() const
|
||||
{
|
||||
if (m_view->mask().isEmpty()) {
|
||||
return m_view->formFactor() == Plasma::Types::Horizontal ? m_view->width() : m_view->height();
|
||||
return m_maskThickness;
|
||||
}
|
||||
|
||||
void Effects::setMaskThickness(const int &thickness)
|
||||
{
|
||||
if (m_maskThickness == thickness) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_maskThickness = thickness;
|
||||
emit maskThicknessChanged();
|
||||
}
|
||||
|
||||
void Effects::updateMaskThickness()
|
||||
{
|
||||
if (m_mask.isNull() || m_mask.width() == 0 || m_mask.height() == 0) {
|
||||
setMaskThickness(m_view->formFactor() == Plasma::Types::Horizontal ? m_view->height() : m_view->width());
|
||||
}
|
||||
|
||||
switch (m_view->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
return m_view->mask().boundingRect().bottom();
|
||||
setMaskThickness(m_mask.bottom());
|
||||
break;
|
||||
|
||||
case Plasma::Types::LeftEdge:
|
||||
return m_view->mask().boundingRect().right();
|
||||
setMaskThickness(m_mask.right());
|
||||
break;
|
||||
|
||||
case Plasma::Types::RightEdge:
|
||||
return m_view->mask().boundingRect().left();
|
||||
setMaskThickness(m_mask.left());
|
||||
break;
|
||||
|
||||
case Plasma::Types::BottomEdge:
|
||||
return m_view->mask().boundingRect().top();
|
||||
break;
|
||||
|
||||
default:
|
||||
return 64;
|
||||
setMaskThickness(m_mask.top());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -332,11 +354,13 @@ QRect Effects::mask() const
|
||||
|
||||
void Effects::setMask(QRect area)
|
||||
{
|
||||
if (m_mask == area)
|
||||
if (m_mask == area) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_mask = area;
|
||||
updateMask();
|
||||
updateMaskThickness();
|
||||
|
||||
// qDebug() << "dock mask set:" << m_mask;
|
||||
emit maskChanged();
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
void setInnerShadow(int shadow);
|
||||
|
||||
int maskThickness() const;
|
||||
void setMaskThickness(const int &thickness);
|
||||
|
||||
QRect mask() const;
|
||||
void setMask(QRect area);
|
||||
@ -110,12 +111,14 @@ signals:
|
||||
void editShadowChanged();
|
||||
void enabledBordersChanged();
|
||||
void maskChanged();
|
||||
void maskThicknessChanged();
|
||||
void innerShadowChanged();
|
||||
void rectChanged();
|
||||
void settingsMaskSubtractedChanged();
|
||||
|
||||
private slots:
|
||||
void init();
|
||||
void updateMaskThickness();
|
||||
|
||||
private:
|
||||
QRegion subtractedMask();
|
||||
@ -131,6 +134,7 @@ private:
|
||||
int m_backgroundOpacity{100};
|
||||
int m_editShadow{0};
|
||||
int m_innerShadow{0};
|
||||
int m_maskThickness{64};
|
||||
|
||||
QRect m_rect;
|
||||
QRect m_mask;
|
||||
|
@ -170,14 +170,17 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
}
|
||||
|
||||
m_connections[base] = connect(m_latteView->effects(), &ViewPart::Effects::maskThicknessChanged, this, [&]() {
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
});
|
||||
|
||||
m_connections[base] = connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, [&]() {
|
||||
m_connections[base+1] = connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, [&]() {
|
||||
if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
updateStrutsBasedOnLayoutsAndActivities(true);
|
||||
}
|
||||
});
|
||||
|
||||
m_connections[base+1] = connect(m_latteView, &Latte::View::activitiesChanged, this, [&]() {
|
||||
m_connections[base+2] = connect(m_latteView, &Latte::View::activitiesChanged, this, [&]() {
|
||||
if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
updateStrutsBasedOnLayoutsAndActivities(true);
|
||||
}
|
||||
@ -270,28 +273,30 @@ QRect VisibilityManager::acceptableStruts()
|
||||
|
||||
int visibleThickness = qMin(m_latteView->effects()->maskThickness(), m_latteView->normalThickness());
|
||||
|
||||
qDebug() << " VISIBLE THICKNESS ::: " << visibleThickness;
|
||||
|
||||
switch (m_latteView->location()) {
|
||||
case Plasma::Types::TopEdge: {
|
||||
calcs = QRect(m_latteView->x(), m_latteView->y(), m_latteView->width(), visibleThickness);
|
||||
break;
|
||||
}
|
||||
case Plasma::Types::TopEdge: {
|
||||
calcs = QRect(m_latteView->x(), m_latteView->y(), m_latteView->width(), visibleThickness);
|
||||
break;
|
||||
}
|
||||
|
||||
case Plasma::Types::BottomEdge: {
|
||||
int y = m_latteView->y() + m_latteView->height() - visibleThickness;
|
||||
calcs = QRect(m_latteView->x(), y, m_latteView->width(), visibleThickness);
|
||||
break;
|
||||
}
|
||||
case Plasma::Types::BottomEdge: {
|
||||
int y = m_latteView->y() + m_latteView->height() - visibleThickness;
|
||||
calcs = QRect(m_latteView->x(), y, m_latteView->width(), visibleThickness);
|
||||
break;
|
||||
}
|
||||
|
||||
case Plasma::Types::LeftEdge: {
|
||||
calcs = QRect(m_latteView->x(), m_latteView->y(), visibleThickness, m_latteView->height());
|
||||
break;
|
||||
}
|
||||
case Plasma::Types::LeftEdge: {
|
||||
calcs = QRect(m_latteView->x(), m_latteView->y(), visibleThickness, m_latteView->height());
|
||||
break;
|
||||
}
|
||||
|
||||
case Plasma::Types::RightEdge: {
|
||||
int x = m_latteView->x() + m_latteView->width() - visibleThickness;
|
||||
calcs = QRect(x, m_latteView->y(), visibleThickness, m_latteView->height());
|
||||
break;
|
||||
}
|
||||
case Plasma::Types::RightEdge: {
|
||||
int x = m_latteView->x() + m_latteView->width() - visibleThickness;
|
||||
calcs = QRect(x, m_latteView->y(), visibleThickness, m_latteView->height());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return calcs;
|
||||
|
Loading…
Reference in New Issue
Block a user