From 695e4aa231fccbe77a6b0a4e21ff6a84f87a5c44 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sun, 22 Mar 2015 20:39:47 +0100 Subject: [PATCH 3/5] Properly update size grip visibility on maximizedChanged, shadedChanged and resizeableChanged --- kdecoration/breezedecoration.cpp | 24 +++++++++++++++++------- kdecoration/breezedecoration.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp index dc4219c161f7a2467906083cf62039d5a0645303..08f6f7b17c4b0b7790d82630b168cedd832b6328 100644 --- a/kdecoration/breezedecoration.cpp +++ b/kdecoration/breezedecoration.cpp @@ -165,21 +165,21 @@ namespace Breeze ); connect(client().data(), &KDecoration2::DecoratedClient::activeChanged, this, &Decoration::updateAnimationState); - connect(client().data(), &KDecoration2::DecoratedClient::paletteChanged, this, + connect(client().data(), &KDecoration2::DecoratedClient::paletteChanged, this, [this]() { m_colorSettings.update(client().data()->palette()); m_useSeparator = (m_colorSettings.palette().color( QPalette::Window ) != m_colorSettings.activeTitleBar() ); update(); } ); - connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateTitleBar); + connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateTitleBar); connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateTitleBar); connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::setOpaque); - connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateButtonsGeometry); + connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, &Decoration::updateButtonsGeometry); connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateButtonsGeometry); - connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::recalculateBorders); - connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateButtonsGeometry); + connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::recalculateBorders); + connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateButtonsGeometry); createButtons(); createShadow(); @@ -208,6 +208,14 @@ namespace Breeze } //________________________________________________________________ + void Decoration::updateSizeGripVisibility() + { + auto c = client().data(); + if( m_sizeGrip ) + { m_sizeGrip->setVisible( c->isResizeable() && !isMaximized() && !c->isShaded() ); } + } + + //________________________________________________________________ int Decoration::borderSize(bool bottom) const { const int baseSize = settings()->smallSpacing(); @@ -582,10 +590,12 @@ namespace Breeze KDecoration2::DecoratedClient *c( client().data() ); if( !c ) return; - if( ( c->isResizeable() && c->windowId() != 0 ) ) + if( c->windowId() != 0 ) { m_sizeGrip = new SizeGrip( this ); - m_sizeGrip->setVisible( !( isMaximized() || c->isShaded() ) ); + connect( client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Breeze::Decoration::updateSizeGripVisibility ); + connect( client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Breeze::Decoration::updateSizeGripVisibility ); + connect( client().data(), &KDecoration2::DecoratedClient::resizeableChanged, this, &Breeze::Decoration::updateSizeGripVisibility ); } #endif diff --git a/kdecoration/breezedecoration.h b/kdecoration/breezedecoration.h index ac1ab3bdc136fd3e4a1e970e86abd0fb92cb6c56..16ff8ff84636f435c7c59d0a0f4835fb509b9b57 100644 --- a/kdecoration/breezedecoration.h +++ b/kdecoration/breezedecoration.h @@ -107,6 +107,7 @@ namespace Breeze void updateButtonsGeometry(); void updateTitleBar(); void updateAnimationState(); + void updateSizeGripVisibility(); private: -- 2.3.3