From 53936854c7daa145dfd25cb9b75a2b33699e5acf Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Mon, 29 Jul 2019 21:22:52 +0300 Subject: [PATCH] [aurorae] Make QML-based decoration themes react to border size changes Summary: Currently only SVG-based decoration themes react to border size changes. QML-based decoration themes on the other hand, for example Plastik, don't react to such changes, only new windows will have decorations with the new border size. BUG: 408035 Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D22665 --- plugins/kdecorations/aurorae/src/aurorae.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/kdecorations/aurorae/src/aurorae.cpp b/plugins/kdecorations/aurorae/src/aurorae.cpp index f5937d9bc5..5abe482681 100644 --- a/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -306,7 +306,6 @@ void Decoration::init() const KConfigGroup themeGroup(conf, m_themeName.mid(16)); theme->setButtonSize((KDecoration2::BorderSize)(themeGroup.readEntry("ButtonSize", int(KDecoration2::BorderSize::Normal) - s_indexMapper) + s_indexMapper)); - updateBorders(); }; connect(this, &Decoration::configChanged, theme, readButtonSize); readButtonSize(); @@ -404,6 +403,18 @@ void Decoration::init() } } setupBorders(m_item); + // TODO: Is there a more efficient way to react to border changes? + auto trackBorders = [this](KWin::Borders *borders) { + if (!borders) { + return; + } + connect(borders, &KWin::Borders::leftChanged, this, &Decoration::updateBorders); + connect(borders, &KWin::Borders::rightChanged, this, &Decoration::updateBorders); + connect(borders, &KWin::Borders::topChanged, this, &Decoration::updateBorders); + connect(borders, &KWin::Borders::bottomChanged, this, &Decoration::updateBorders); + }; + trackBorders(m_borders); + trackBorders(m_maximizedBorders); if (m_extendedBorders) { auto updateExtendedBorders = [this] { setResizeOnlyBorders(*m_extendedBorders);