Abuse sizeGrip to indicate active window

Show the sizegrip in an active Color for active windows regardless of
resizability or such.
wilder-5.24
Jacopo De Simoi 4 years ago
parent d901e70c38
commit 8d1c1b4c8a
  1. 30
      kdecoration/breezedecoration.cpp
  2. 2
      kdecoration/breezesizegrip.h

@ -179,14 +179,7 @@ namespace Breeze
{
const auto c = client().toStrongRef();
if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar );
else if( m_animation->state() == QAbstractAnimation::Running )
{
return KColorUtils::mix(
c->color( ColorGroup::Inactive, ColorRole::TitleBar ),
c->color( ColorGroup::Active, ColorRole::TitleBar ),
m_opacity );
} else return c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::TitleBar );
return c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::TitleBar );
}
@ -209,7 +202,7 @@ namespace Breeze
void Decoration::init()
{
const auto c = client().toStrongRef();
// active state change animation
// It is important start and end value are of the same type, hence 0.0 and not just 0
m_animation->setStartValue( 0.0 );
@ -328,8 +321,11 @@ namespace Breeze
void Decoration::updateSizeGripVisibility()
{
const auto c = client().toStrongRef();
// I am stealing the sizeGrip to indicate that the window is
// active, so it should be visible provided that the client is
// active.
if( m_sizeGrip )
{ m_sizeGrip->setVisible( c->isResizeable() && !isMaximized() && !c->isShaded() ); }
{ m_sizeGrip->setVisible( c->isActive() && !c->isShaded() ); }
}
//________________________________________________________________
@ -398,7 +394,7 @@ namespace Breeze
updateShadow();
// size grip
if( hasNoBorders() && m_internalSettings->drawSizeGrip() ) createSizeGrip();
if( m_internalSettings->drawSizeGrip() ) createSizeGrip();
else deleteSizeGrip();
}
@ -553,6 +549,17 @@ namespace Breeze
//else
painter->drawRect( rect() );
if (c->isActive()) {
painter->setPen( c->color( ColorGroup::Active, ColorRole::TitleBar ) );
QPointF p=rect().bottomRight()+QPointF(0.5, 0.5);
// Unfortunately SizeGrip::GripSize is private
const int sizeGripSize = 18; //SizeGrip::GripSize;
QPointF q=p-QPoint(0, sizeGripSize);
QPointF r=p-QPoint(sizeGripSize, 0);
painter->drawLine( p, q );
painter->drawLine( p, r );
}
painter->restore();
}
@ -858,6 +865,7 @@ namespace Breeze
connect( c.data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateSizeGripVisibility );
connect( c.data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateSizeGripVisibility );
connect( c.data(), &KDecoration2::DecoratedClient::resizeableChanged, this, &Decoration::updateSizeGripVisibility );
connect( c.data(), &KDecoration2::DecoratedClient::activeChanged, this, &Decoration::updateSizeGripVisibility );
}
#endif

@ -68,7 +68,7 @@ namespace Breeze
//* grip size
enum {
Offset = 0,
GripSize = 14,
GripSize = 18,
};
//* decoration

Loading…
Cancel
Save