From b3de58529be2a671414b44f318993dbd34fd1eda Mon Sep 17 00:00:00 2001 From: Tsu Jan Date: Sun, 17 Mar 2024 07:08:17 +0330 Subject: [PATCH] Upgraded to 6.0 (for Plasma 6) --- CMakeLists.txt | 76 ++++++----- ChangeLog | 4 + Messages.sh | 4 - NEWS | 2 +- breeze.h | 8 +- breeze.json | 7 +- breezebutton.cpp | 45 ++++--- breezebutton.h | 9 +- breezedecoration.cpp | 139 ++++++++++---------- breezedecoration.h | 26 ++-- breezeenhanced.json | 16 +++ breezeexceptionlist.cpp | 35 ++--- breezeexceptionlist.h | 8 +- breezesettingsprovider.cpp | 18 +-- breezesettingsprovider.h | 8 +- config/CMakeLists.txt | 4 + config/breezeconfigwidget.cpp | 29 ++-- config/breezeconfigwidget.h | 15 +-- config/breezedetectwidget.h | 6 +- config/breezeenhancedconfig.desktop | 13 -- config/breezeexceptiondialog.h | 8 +- config/breezeexceptionlistwidget.cpp | 2 +- config/breezeexceptionlistwidget.h | 9 +- config/breezeexceptionmodel.h | 6 +- config/breezeitemmodel.cpp | 4 +- config/breezeitemmodel.h | 6 +- config/breezelistmodel.h | 44 +++---- config/kcm_breezeenhanced.cpp | 6 + config/kcm_breezeenhanced.json | 13 ++ libbreezecommon/CMakeLists.txt | 10 +- libbreezecommon/breezeboxshadowrenderer.cpp | 4 +- 31 files changed, 299 insertions(+), 285 deletions(-) delete mode 100644 Messages.sh create mode 100644 breezeenhanced.json create mode 100644 config/CMakeLists.txt delete mode 100644 config/breezeenhancedconfig.desktop create mode 100644 config/kcm_breezeenhanced.cpp create mode 100644 config/kcm_breezeenhanced.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 2913bf5..9bc07a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,22 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(breezeenhanced) -set(PROJECT_VERSION "5.27.0") -set(PROJECT_VERSION_MAJOR 5) +set(PROJECT_VERSION "6.0.0") +set(PROJECT_VERSION_MAJOR 6) include(WriteBasicConfigVersionFile) include(FeatureSummary) +set(QT_MIN_VERSION "6.6.0") +set(KF6_MIN_VERSION "6.0.0") -find_package(ECM 0.0.9 REQUIRED NO_MODULE) +find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) -set(QT_MIN_VERSION "5.15.0") -set(KF5_MIN_VERSION "5.102.0") - include(ECMInstallIcons) -include(KDEInstallDirs) +include(KDEInstallDirs6) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(GenerateExportHeader) @@ -25,13 +24,19 @@ include(GenerateExportHeader) find_package(KDecoration2 REQUIRED) +find_package(KF6KCMUtils ${KF6_MIN_VERSION}) +set_package_properties(KF6KCMUtils PROPERTIES + TYPE REQUIRED + DESCRIPTION "Helps create configuration modules" + PURPOSE "KCMUtils used for the configuration modules or the decoration and Qt Style" +) # old stuff add_definitions(-DTRANSLATION_DOMAIN="breeze_kwin_deco") -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons GuiAddons ConfigWidgets WindowSystem I18n) -find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS DBus) +find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS GuiAddons WindowSystem I18n) +find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets DBus) ################# includes ################# add_subdirectory(libbreezecommon) @@ -41,14 +46,11 @@ add_subdirectory(libbreezecommon) set(breezeenhanced_SRCS breezebutton.cpp breezedecoration.cpp - breezeexceptionlist.cpp breezesettingsprovider.cpp) -kconfig_add_kcfg_files(breezeenhanced_SRCS breezesettings.kcfgc) - ### config classes -### they are kept separately because they might move in a separate library in the future set(breezeenhanced_config_SRCS + breezeexceptionlist.cpp config/breezeconfigwidget.cpp config/breezedetectwidget.cpp config/breezeexceptiondialog.cpp @@ -56,35 +58,43 @@ set(breezeenhanced_config_SRCS config/breezeexceptionmodel.cpp config/breezeitemmodel.cpp ) - -set(breezeenhanced_config_PART_FORMS +ki18n_wrap_ui(breezeenhanced_config_SRCS config/ui/breezeconfigurationui.ui config/ui/breezeexceptiondialog.ui config/ui/breezeexceptionlistwidget.ui ) - -ki18n_wrap_ui(breezeenhanced_config_PART_FORMS_HEADERS ${breezeenhanced_config_PART_FORMS}) +add_library(breezeenhanced_STATIC STATIC ${breezeenhanced_config_SRCS}) +# Needed to link this static lib to shared libs +set_property(TARGET breezeenhanced_STATIC PROPERTY POSITION_INDEPENDENT_CODE ON) +kconfig_add_kcfg_files(breezeenhanced_STATIC breezesettings.kcfgc) +target_link_libraries(breezeenhanced_STATIC + PUBLIC + Qt6::Core + Qt6::Gui + Qt6::Widgets + Qt6::DBus + KDecoration2::KDecoration + PRIVATE + KF6::I18n + KF6::WindowSystem + KF6::KCMUtils +) ### build library add_library(breezeenhanced MODULE ${breezeenhanced_SRCS} - ${breezeenhanced_config_SRCS} ${breezeenhanced_config_PART_FORMS_HEADERS}) target_link_libraries(breezeenhanced - PUBLIC - Qt::Core - Qt::Gui - Qt::DBus PRIVATE - breezeenhancedcommon5 - KDecoration2::KDecoration - KF5::ConfigCore - KF5::CoreAddons - KF5::ConfigWidgets - KF5::GuiAddons - KF5::I18n - KF5::WindowSystem) - -install(TARGETS breezeenhanced DESTINATION ${KDE_INSTALL_PLUGINDIR}/org.kde.kdecoration2) -install(FILES config/breezeenhancedconfig.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}) + breezeenhancedcommon6 + breezeenhanced_STATIC + KF6::GuiAddons + KF6::I18n + KF6::WindowSystem + KF6::KCMUtils) + + +install(TARGETS breezeenhanced DESTINATION ${KDE_INSTALL_PLUGINDIR}/${KDECORATION_PLUGIN_DIR}) + +add_subdirectory(config) diff --git a/ChangeLog b/ChangeLog index 19bf621..51139a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +V6.0 +--------- + * Bumped the version to 6.0 and imported some changes from Breeze 6.0.2. + V5.27 --------- * Bumped the version to 5.27 and imported useful changes from breeze-5.27.2. diff --git a/Messages.sh b/Messages.sh deleted file mode 100644 index 4f38b6d..0000000 --- a/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!bin/sh -$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.cc -o -name \*.cpp -o -name \*.h` -o $podir/breeze_kwin_deco.pot -rm -f rc.cpp diff --git a/NEWS b/NEWS index 39b782b..b023d81 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ Latest version: - 24 Mar 2023, V5.27 + 17 Mar 2024, V6.0 See "ChangeLog" for changes. diff --git a/breeze.h b/breeze.h index 6dd93d5..8058259 100644 --- a/breeze.h +++ b/breeze.h @@ -1,6 +1,3 @@ -#ifndef breeze_h -#define breeze_h - /* * Copyright 2014 Hugo Pereira Da Costa * @@ -21,10 +18,12 @@ * along with this program. If not, see . */ +#pragma once + #include "breezesettings.h" -#include #include +#include namespace Breeze { @@ -70,4 +69,3 @@ namespace Breeze }; } -#endif diff --git a/breeze.json b/breeze.json index f3cc403..e4c7a6b 100644 --- a/breeze.json +++ b/breeze.json @@ -2,16 +2,11 @@ "KPlugin": { "Description": "Window decoration using the Breeze visual style for the Plasma Desktop", "EnabledByDefault": true, - "Id": "org.kde.breezeenhanced", "Name": "BreezeEnhanced", - "ServiceTypes": [ - "org.kde.kdecoration2" - ] }, + "X-KDE-ConfigModule": "kcm_breezeenhanced", "org.kde.kdecoration2": { "blur": true, - "defaultTheme": "BreezeEnhanced", - "kcmodule": true, "recommendedBorderSize": "None" } } diff --git a/breezebutton.cpp b/breezebutton.cpp index 6f0d515..7998c29 100644 --- a/breezebutton.cpp +++ b/breezebutton.cpp @@ -20,19 +20,18 @@ */ #include "breezebutton.h" -#include #include +#include //#include #include -#include #include +#include namespace Breeze { - - using KDecoration2::ColorRole; using KDecoration2::ColorGroup; + using KDecoration2::ColorRole; using KDecoration2::DecorationButtonType; @@ -58,8 +57,8 @@ namespace Breeze setIconSize(QSize( height, height )); // connections - connect(decoration->client().toStrongRef().data(), SIGNAL(iconChanged(QIcon)), this, SLOT(update())); - connect(decoration->settings().data(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure); + connect(decoration->client(), SIGNAL(iconChanged(QIcon)), this, SLOT(update())); + connect(decoration->settings().get(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure); connect( this, &KDecoration2::DecorationButton::hoveredChanged, this, &Button::updateAnimationState ); reconfigure(); @@ -82,37 +81,37 @@ namespace Breeze if (auto d = qobject_cast(decoration)) { Button *b = new Button(type, d, parent); - const auto c = d->client().toStrongRef(); + const auto c = d->client(); switch( type ) { case DecorationButtonType::Close: - b->setVisible( c->isCloseable() ); - QObject::connect(c.data(), &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible ); + b->setVisible(c->isCloseable()); + QObject::connect(c, &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Maximize: - b->setVisible( c->isMaximizeable() ); - QObject::connect(c.data(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible ); + b->setVisible(c->isMaximizeable()); + QObject::connect(c, &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Minimize: - b->setVisible( c->isMinimizeable() ); - QObject::connect(c.data(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible ); + b->setVisible(c->isMinimizeable()); + QObject::connect(c, &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::ContextHelp: - b->setVisible( c->providesContextHelp() ); - QObject::connect(c.data(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible ); + b->setVisible(c->providesContextHelp()); + QObject::connect(c, &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Shade: - b->setVisible( c->isShadeable() ); - QObject::connect(c.data(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible ); + b->setVisible(c->isShadeable()); + QObject::connect(c, &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible); break; case DecorationButtonType::Menu: - QObject::connect(c.data(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); }); + QObject::connect(c, &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); }); break; default: break; @@ -146,7 +145,7 @@ namespace Breeze { const QRectF iconRect( geometry().topLeft(), m_iconSize ); - const auto c = decoration()->client().toStrongRef(); + const auto c = decoration()->client(); /*if (auto deco = qobject_cast(decoration())) { const QPalette activePalette = KIconLoader::global()->customPalette(); QPalette palette = c->palette(); @@ -182,7 +181,7 @@ namespace Breeze /* scale painter so that its window matches QRect( -1, -1, 20, 20 ) this makes all further rendering and scaling simpler - all further rendering is preformed inside QRect( 0, 0, 18, 18 ) + all further rendering is performed inside QRect( 0, 0, 18, 18 ) */ painter->translate( geometry().topLeft() ); @@ -194,7 +193,7 @@ namespace Breeze const QColor backgroundColor( this->backgroundColor() ); auto d = qobject_cast( decoration() ); - bool isInactive(d && !d->client().toStrongRef().data()->isActive() + bool isInactive(d && !d->client()->isActive() && !isHovered() && !isPressed() && m_animation->state() != QAbstractAnimation::Running); QColor inactiveCol(Qt::gray); @@ -807,7 +806,7 @@ namespace Breeze auto d = qobject_cast( decoration() ); if(!d || d->internalSettings()->macOSButtons()) { QColor col; - if (d && !d->client().toStrongRef()->isActive() + if (d && !d->client()->isActive() && !isHovered() && !isPressed() && m_animation->state() != QAbstractAnimation::Running) { @@ -1001,7 +1000,7 @@ namespace Breeze } } else { - auto c = d->client().toStrongRef(); + auto c = d->client(); if( isPressed() ) { if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground ); diff --git a/breezebutton.h b/breezebutton.h index 0b04fd2..00be744 100644 --- a/breezebutton.h +++ b/breezebutton.h @@ -1,6 +1,3 @@ -#ifndef BREEZE_BUTTONS_H -#define BREEZE_BUTTONS_H - /* * Copyright 2014 Martin Gräßlin * Copyright 2014 Hugo Pereira Da Costa @@ -21,8 +18,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include + +#pragma once + #include "breezedecoration.h" +#include #include #include @@ -135,4 +135,3 @@ namespace Breeze } // namespace -#endif diff --git a/breezedecoration.cpp b/breezedecoration.cpp index 85b9077..cc55b70 100644 --- a/breezedecoration.cpp +++ b/breezedecoration.cpp @@ -36,19 +36,18 @@ #include #include +#include +#include +#include +#include #include +#include #include #include #include -K_PLUGIN_FACTORY_WITH_JSON( - BreezeDecoFactory, - "breeze.json", - registerPlugin(); - registerPlugin(); - registerPlugin(); -) +K_PLUGIN_FACTORY_WITH_JSON(BreezeDecoFactory, "breezeenhanced.json", registerPlugin(); registerPlugin();) namespace { @@ -144,8 +143,8 @@ namespace Breeze static int g_shadowSizeEnum = InternalSettings::ShadowLarge; static int g_shadowStrength = 255; static QColor g_shadowColor = Qt::black; - static QSharedPointer g_sShadow; - static QSharedPointer g_sShadowInactive; + static std::shared_ptr g_sShadow; + static std::shared_ptr g_sShadowInactive; //________________________________________________________________ Decoration::Decoration(QObject *parent, const QVariantList &args) @@ -160,8 +159,8 @@ namespace Breeze g_sDecoCount--; if (g_sDecoCount == 0) { // last deco destroyed, clean up shadow - g_sShadow.clear(); - g_sShadowInactive.clear(); + g_sShadow.reset(); + g_sShadowInactive.reset(); } } @@ -169,9 +168,9 @@ namespace Breeze QColor Decoration::titleBarColor() const { - const auto c = client().toStrongRef(); - if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar ); - return c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::TitleBar ); + const auto c = client(); + if(hideTitleBar()) return c->color(ColorGroup::Inactive, ColorRole::TitleBar); + return c->color(c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::TitleBar); } @@ -179,42 +178,42 @@ namespace Breeze QColor Decoration::fontColor() const { - const auto c = client().toStrongRef(); - return c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::Foreground ); + const auto c = client(); + return c->color(c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::Foreground); } //________________________________________________________________ - void Decoration::init() + bool Decoration::init() { - const auto c = client().toStrongRef(); + const auto c = client(); reconfigure(); updateTitleBar(); auto s = settings(); - connect(s.data(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::recalculateBorders); // a change in font might cause the borders to change recalculateBorders(); resetBlurRegion(); - connect(s.data(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::recalculateBorders); // buttons - connect(s.data(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::updateButtonsGeometryDelayed); - connect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &Decoration::updateButtonsGeometryDelayed); - connect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &Decoration::updateButtonsGeometryDelayed); // full reconfiguration - connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::reconfigure); - connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, SettingsProvider::self(), &SettingsProvider::reconfigure, Qt::UniqueConnection ); - connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::reconfigure); + connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, SettingsProvider::self(), &SettingsProvider::reconfigure, Qt::UniqueConnection ); + connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::updateButtonsGeometryDelayed); - connect(c.data(), &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::recalculateBorders); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedHorizontallyChanged, this, &Decoration::recalculateBorders); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedVerticallyChanged, this, &Decoration::recalculateBorders); - connect(c.data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration2::DecoratedClient::maximizedHorizontallyChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration2::DecoratedClient::maximizedVerticallyChanged, this, &Decoration::recalculateBorders); + connect(c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::recalculateBorders); - connect(c.data(), &KDecoration2::DecoratedClient::captionChanged, this, + connect(c, &KDecoration2::DecoratedClient::captionChanged, this, [this]() { // update the caption area @@ -222,37 +221,39 @@ namespace Breeze } ); - connect(c.data(), &KDecoration2::DecoratedClient::activeChanged, this, &Decoration::updateActiveState); - connect(c.data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateTitleBar); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateTitleBar); + connect(c, &KDecoration2::DecoratedClient::activeChanged, this, &Decoration::updateActiveState); + connect(c, &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateTitleBar); + connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateTitleBar); //connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::setOpaque); - connect(c.data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateButtonsGeometry); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateButtonsGeometry); - connect(c.data(), &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::updateButtonsGeometry); - connect(c.data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateButtonsGeometry); - - connect(s.data(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::resetBlurRegion); - connect(s.data(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedHorizontallyChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedVerticallyChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::resetBlurRegion); - connect(c.data(), &KDecoration2::DecoratedClient::heightChanged, this, [this]() { + connect(c, &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::updateButtonsGeometry); + connect(c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateButtonsGeometry); + + connect(s.get(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::resetBlurRegion); + connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::maximizedHorizontallyChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::maximizedVerticallyChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::resetBlurRegion); + connect(c, &KDecoration2::DecoratedClient::heightChanged, this, [this]() { if (!hasNoSideBorders()) resetBlurRegion(); }); createButtons(); updateShadow(); + + return true; } //________________________________________________________________ void Decoration::updateTitleBar() { auto s = settings(); - const auto c = client().toStrongRef(); + const auto c = client(); const bool maximized = isMaximized(); const int width = maximized ? c->width() : c->width() - 2*s->largeSpacing()*Metrics::TitleBar_SideMargin; const int height = maximized ? borderTop() : borderTop() - s->smallSpacing()*Metrics::TitleBar_TopMargin; @@ -328,7 +329,7 @@ namespace Breeze //________________________________________________________________ void Decoration::recalculateBorders() { - const auto c = client().toStrongRef(); + const auto c = client(); auto s = settings(); // left, right and bottom borders @@ -388,7 +389,7 @@ namespace Breeze } QRegion region; - const auto c = client().toStrongRef(); + const auto c = client(); QSize rSize(m_scaledCornerRadius, m_scaledCornerRadius); if (!c->isShaded() && !isMaximized() && !hasNoBorders()) @@ -525,11 +526,12 @@ namespace Breeze const int bHeight = captionHeight() + (isTopEdge() ? s->smallSpacing()*Metrics::TitleBar_TopMargin:0); const int bWidth = buttonHeight(); const int verticalOffset = (isTopEdge() ? s->smallSpacing()*Metrics::TitleBar_TopMargin:0) + (captionHeight()-buttonHeight())/2; - foreach( const QPointer& button, m_leftButtons->buttons() + m_rightButtons->buttons() ) + const auto buttonList = m_leftButtons->buttons() + m_rightButtons->buttons(); + for (const QPointer &button : buttonList) { - button.data()->setGeometry( QRectF( QPoint( 0, 0 ), QSizeF( bWidth, bHeight ) ) ); - static_cast( button.data() )->setOffset( QPointF( 0, verticalOffset ) ); - static_cast( button.data() )->setIconSize( QSize( bWidth, bWidth ) ); + button.data()->setGeometry(QRectF(QPoint(0, 0), QSizeF(bWidth, bHeight))); + static_cast