diff --git a/plugins/kdecorations/aurorae/src/aurorae.h b/plugins/kdecorations/aurorae/src/aurorae.h --- a/plugins/kdecorations/aurorae/src/aurorae.h +++ b/plugins/kdecorations/aurorae/src/aurorae.h @@ -74,6 +74,8 @@ void setupBorders(QQuickItem *item); void updateBorders(); void updateBuffer(); + void updateExtendedBorders(); + QRect m_contentRect; //the geometry of the part of the buffer that is not a shadow when buffer was created. QQuickItem *m_item = nullptr; QQmlContext *m_qmlContext = nullptr; diff --git a/plugins/kdecorations/aurorae/src/aurorae.cpp b/plugins/kdecorations/aurorae/src/aurorae.cpp --- a/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -348,14 +348,11 @@ trackBorders(m_borders); trackBorders(m_maximizedBorders); if (m_extendedBorders) { - auto updateExtendedBorders = [this] { - setResizeOnlyBorders(*m_extendedBorders); - }; updateExtendedBorders(); - connect(m_extendedBorders, &KWin::Borders::leftChanged, this, updateExtendedBorders); - connect(m_extendedBorders, &KWin::Borders::rightChanged, this, updateExtendedBorders); - connect(m_extendedBorders, &KWin::Borders::topChanged, this, updateExtendedBorders); - connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, updateExtendedBorders); + connect(m_extendedBorders, &KWin::Borders::leftChanged, this, &Decoration::updateExtendedBorders); + connect(m_extendedBorders, &KWin::Borders::rightChanged, this, &Decoration::updateExtendedBorders); + connect(m_extendedBorders, &KWin::Borders::topChanged, this, &Decoration::updateExtendedBorders); + connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, &Decoration::updateExtendedBorders); } connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders, Qt::QueuedConnection); connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders); @@ -410,6 +407,8 @@ return; } setBorders(*b); + + updateExtendedBorders(); } void Decoration::paint(QPainter *painter, const QRect &repaintRegion) @@ -556,6 +555,31 @@ connect(item, &QQuickItem::yChanged, this, update); } +void Decoration::updateExtendedBorders() +{ + // extended sizes + const int extSize = settings()->largeSpacing(); + int extLeft = m_extendedBorders->left(); + int extRight = m_extendedBorders->right(); + int extBottom = m_extendedBorders->bottom(); + + if (settings()->borderSize() == KDecoration2::BorderSize::None) { + if (!client().data()->isMaximizedHorizontally()) { + extLeft = qMax(m_extendedBorders->left(), extSize); + extRight = qMax(m_extendedBorders->right(), extSize); + } + if (!client().data()->isMaximizedVertically()) { + extBottom = qMax(m_extendedBorders->bottom(), extSize); + } + + } else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !client().data()->isMaximizedHorizontally() ) { + extLeft = qMax(m_extendedBorders->left(), extSize); + extRight = qMax(m_extendedBorders->right(), extSize); + } + + setResizeOnlyBorders(QMargins(extLeft, 0, extRight, extBottom)); +} + void Decoration::updateBuffer() { m_contentRect = QRect(QPoint(0, 0), m_view->bufferAsImage().size()); diff --git a/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp b/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp --- a/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp +++ b/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp @@ -208,63 +208,69 @@ break; } } else { + int minMargin; + int maxMargin; switch (d->borderSize) { + case KDecoration2::BorderSize::NoSides: case KDecoration2::BorderSize::Tiny: - // TODO: this looks wrong - if (isCompositingActive()) { - left = qMin(0, (int)left - d->themeConfig.borderLeft() - d->themeConfig.paddingLeft()); - right = qMin(0, (int)right - d->themeConfig.borderRight() - d->themeConfig.paddingRight()); - bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom() - d->themeConfig.paddingBottom()); - } else { - left = qMin(0, (int)left - d->themeConfig.borderLeft()); - right = qMin(0, (int)right - d->themeConfig.borderRight()); - bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom()); - } + minMargin = 1; + maxMargin = 4; + break; + case KDecoration2::BorderSize::Normal: + minMargin = 4; + maxMargin = 6; break; case KDecoration2::BorderSize::Large: - left = right = bottom = top = 4; + minMargin = 6; + maxMargin = 8; break; case KDecoration2::BorderSize::VeryLarge: - left = right = bottom = top = 8; + minMargin = 8; + maxMargin = 12; break; case KDecoration2::BorderSize::Huge: - left = right = bottom = top = 12; + minMargin = 12; + maxMargin = 20; break; case KDecoration2::BorderSize::VeryHuge: - left = right = bottom = top = 23; + minMargin = 23; + maxMargin = 30; break; case KDecoration2::BorderSize::Oversized: - left = right = bottom = top = 36; + minMargin = 36; + maxMargin = 48; break; - case KDecoration2::BorderSize::Normal: default: - left = right = bottom = top = 0; + minMargin = 0; + maxMargin = 0; + } + + left = qBound(minMargin, d->themeConfig.borderLeft(), maxMargin); + right = qBound(minMargin, d->themeConfig.borderRight(), maxMargin); + bottom = qBound(minMargin, d->themeConfig.borderBottom(), maxMargin); + + if (d->borderSize == KDecoration2::BorderSize::None) { + left = 0; + right = 0; + bottom = 0; + } else if (d->borderSize == KDecoration2::BorderSize::NoSides) { + left = 0; + right = 0; } + const qreal title = titleHeight + d->themeConfig.titleEdgeTop() + d->themeConfig.titleEdgeBottom(); switch ((DecorationPosition)d->themeConfig.decorationPosition()) { case DecorationTop: - left += d->themeConfig.borderLeft(); - right += d->themeConfig.borderRight(); - bottom += d->themeConfig.borderBottom(); top = title; break; case DecorationBottom: - left += d->themeConfig.borderLeft(); - right += d->themeConfig.borderRight(); bottom = title; - top += d->themeConfig.borderTop(); break; case DecorationLeft: left = title; - right += d->themeConfig.borderRight(); - bottom += d->themeConfig.borderBottom(); - top += d->themeConfig.borderTop(); break; case DecorationRight: - left += d->themeConfig.borderLeft(); right = title; - bottom += d->themeConfig.borderBottom(); - top += d->themeConfig.borderTop(); break; default: left = right = bottom = top = 0; diff --git a/plugins/kdecorations/aurorae/src/qml/aurorae.qml b/plugins/kdecorations/aurorae/src/qml/aurorae.qml --- a/plugins/kdecorations/aurorae/src/qml/aurorae.qml +++ b/plugins/kdecorations/aurorae/src/qml/aurorae.qml @@ -188,6 +188,11 @@ topMargin: parent.padding.top + parent.borders.top - margins.top bottomMargin: parent.padding.bottom + parent.borders.bottom - margins.bottom } + visible: parent.borders.left > fixedMargins.left + && parent.borders.right > fixedMargins.right + && parent.borders.top > fixedMargins.top + && parent.borders.bottom > fixedMargins.bottom + imagePath: backgroundSvg.imagePath prefix: "innerborder" opacity: (decoration.client.active && !decoration.client.maximized && backgroundSvg.supportsInnerBorder) ? 1 : 0 @@ -207,6 +212,12 @@ topMargin: parent.padding.top + parent.borders.top - margins.top bottomMargin: parent.padding.bottom + parent.borders.bottom - margins.bottom } + + visible: parent.borders.left > fixedMargins.left + && parent.borders.right > fixedMargins.right + && parent.borders.top > fixedMargins.top + && parent.borders.bottom > fixedMargins.bottom + imagePath: backgroundSvg.imagePath prefix: "innerborder-inactive" opacity: (!decoration.client.active && !decoration.client.maximized && backgroundSvg.supportsInnerBorderInactive) ? 1 : 0