Skip to content

Commit

Permalink
nicer hideTitleBar behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
kupiqu committed Nov 23, 2019
1 parent 09c0f71 commit c70a490
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions breezedecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ namespace Breeze
{

auto c = client().data();
if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar );
else if( m_animation->state() == QPropertyAnimation::Running )
// if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar );
// else if( m_animation->state() == QPropertyAnimation::Running )
if( m_animation->state() == QPropertyAnimation::Running )
{
return KColorUtils::mix(
c->color( ColorGroup::Inactive, ColorRole::TitleBar ),
Expand Down Expand Up @@ -700,7 +701,7 @@ namespace Breeze
painter->restore();
}

if( !hideTitleBar() ) paintTitleBar(painter, repaintRegion);
paintTitleBar(painter, repaintRegion);

if ( hasBorders() ) // && !s->isAlphaChannelSupported() )
{
Expand Down Expand Up @@ -810,20 +811,22 @@ namespace Breeze

painter->restore();

// draw caption
QFont f; f.fromString(m_internalSettings->titleBarFont());
// KDE needs this FIXME: Why?
QFontDatabase fd; f.setStyleName(fd.styleString(f));
painter->setFont(f);
painter->setPen( fontColor() );

const auto cR = captionRect();
const QString caption = painter->fontMetrics().elidedText(c->caption(), Qt::ElideMiddle, cR.first.width());
painter->drawText(cR.first, cR.second | Qt::TextSingleLine, caption);

// draw all buttons
m_leftButtons->paint(painter, repaintRegion);
m_rightButtons->paint(painter, repaintRegion);
if( !hideTitleBar() ) {
// draw caption
QFont f; f.fromString(m_internalSettings->titleBarFont());
// KDE needs this FIXME: Why?
QFontDatabase fd; f.setStyleName(fd.styleString(f));
painter->setFont(f);
painter->setPen( fontColor() );

const auto cR = captionRect();
const QString caption = painter->fontMetrics().elidedText(c->caption(), Qt::ElideMiddle, cR.first.width());
painter->drawText(cR.first, cR.second | Qt::TextSingleLine, caption);

// draw all buttons
m_leftButtons->paint(painter, repaintRegion);
m_rightButtons->paint(painter, repaintRegion);
}
}

//________________________________________________________________
Expand Down

0 comments on commit c70a490

Please sign in to comment.