Abuse sizeGrip to indicate active window

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

@ -193,14 +193,20 @@ namespace Breeze
{
auto c = client().data();
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 );
// 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 ); //
}
@ -327,8 +333,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() ); }
}
//________________________________________________________________
@ -385,7 +394,7 @@ namespace Breeze
createShadow();
// size grip
if( hasNoBorders() && m_internalSettings->drawSizeGrip() ) createSizeGrip();
if( m_internalSettings->drawSizeGrip() ) createSizeGrip();
else deleteSizeGrip();
}
@ -542,6 +551,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();
}
@ -816,6 +836,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