Abuse sizeGrip to indicate active window

Show the sizegrip in an active Color for active windows regardless of
resizability or such.
wilder-pre-rebase
Jacopo De Simoi 7 years ago
parent 1f05bb97b0
commit c2f083c278
  1. 41
      kdecoration/breezedecoration.cpp
  2. 2
      kdecoration/breezesizegrip.h

@ -106,14 +106,20 @@ namespace Breeze
{
auto c = client().data();
if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar );
else if( m_animation->state() == QPropertyAnimation::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 );
// Always return the title bar color regardless of wheter or
// not the title bar is visible or not.
// if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar );
//else
// if( m_animation->state() == QPropertyAnimation::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 ); //
}
@ -238,8 +244,11 @@ namespace Breeze
void Decoration::updateSizeGripVisibility()
{
auto c = client().data();
// 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() ); }
}
//________________________________________________________________
@ -296,7 +305,7 @@ namespace Breeze
createShadow();
// size grip
if( hasNoBorders() && m_internalSettings->drawSizeGrip() ) createSizeGrip();
if( m_internalSettings->drawSizeGrip() ) createSizeGrip();
else deleteSizeGrip();
}
@ -453,6 +462,17 @@ namespace Breeze
// // Go sharper; no rounded edges
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();
}
@ -746,6 +766,7 @@ namespace Breeze
connect( c, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateSizeGripVisibility );
connect( c, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateSizeGripVisibility );
connect( c, &KDecoration2::DecoratedClient::resizeableChanged, this, &Decoration::updateSizeGripVisibility );
connect( c, &KDecoration2::DecoratedClient::activeChanged, this, &Decoration::updateSizeGripVisibility );
}
#endif

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

Loading…
Cancel
Save